TOTO ZABRALO

sudo service lightdm stop

sudo service gdm stop

sudo service kdm stop //this is the one that worked for mi as I use kdm and Linux mint

As the error states, you are still running an X server. This error occurs when you try to install the Nvidia .run files while logged in.

Make sure you are logged out.

Hit CTRL+ALT+F1 and login using your credentials.
kill your current X server session by typing sudo service lightdm stop or sudo stop lightdm
Enter runlevel 3 (or 5) by typing sudo init 3 (or sudo init 5) and install your .run file.
You might be required to reboot when the installation finishes. If not, run sudo service lightdm start or sudo start lightdm to start your X server again.

#<------------------------------------ ------------------------------------>#

nvidia-smi <===> vypíšedetaily o verzi ovladače, CUDA atd. ??

nvidia-settings <===> zobrazi graficky X Server Informace


#<------------------------------------ ------------------------------------>#

rada1:installing/updating nvidia:

0) apt install linux-headers-amd64 <===> nainstalovat headers??

1) CTRL+ALT+F1
2) sudo stop lightdm (or sudo service lightdm stop) <===> kill your current X server session by typing
3) sudo init 3 (or sudo init 5) <===> Enter runlevel 3 (or 5) and install your .run file

You might be required to reboot when the installation finishes. If not, run

sudo service lightdm start
or
sudo start lightdm

to start your X server again.

rada2:
Type in the terminal
sudo killall Xorg
Then install Nvidea driver

#<------------------------------------ ------------------------------------>#

How to remove Nouveau kernel driver (fix Nvidia install error)

1) sudo apt-get remove nvidia* && sudo apt autoremove <===> remove all nvidia related packages
no matches found: nvidia* <===> if you get the following error it means that you never had an nvidia package installed and is ok

2) sudo apt-get install dkms build-essential linux-headers-generic <===> Now install some required dependencies

3) sudo vim /etc/modprobe.d/blacklist.conf <===> block and disable nouveau kernel driver

4) And append the follow lines to the blacklist.conf
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

5) echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf <===> Disable the Kernel nouveau

6) sudo update-initramfs -u <===> update
7) reboot


#<------------------------------------ ------------------------------------>#

One or more modprobe configuration files to disable Nouveau have been written. For some distributions, this may be sufficient to disable Nouveau; other distributions
may require modification of the initial ramdisk. Please reboot your syste, and attempt NVIDIA driver installation again. Note if you later wish to reenable Nouveau, you will need to delete these files:
/usr/lib/modprobe.d/nvidia-installer-disable-nouveau.conf
/etc/modprobe.d/nvidia-installer-disable-nouveau.conf

.......................................................
1 – Download the driver from NVIDIA: R290.10 64-bit. Driver’s filename looks like to
NVIDIA-Linux-x86_64-290.10.run. I saved the file at the root of my home directory.

2 – To install the driver, the X-server must be stopped. All operations must be executed from the command line (virtual console). Fortunately, only few operations are required. To open the first virtual console, type [Ctrl]+[Alt]+[F1]. There are six virtual consoles and any console from F1 to F6 is ok. Once the console it opened, enter your login. Now you can stop the X-server with:

sudo /etc/init.d/gdm stop

This command is better:

sudo stop gdm

The following command can also help:

sudo killall Xorg

3 – Now you can install the driver:

sudo sh NVIDIA-Linux-x86_64-290.10.run

How to Update the NVIDIA Graphics Drivers under Linux

#<------------------------------------ ------------------------------------>#


Blacklist Nvidia nouveau driver
Open up terminal and enter the following linux commands:

$ sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
$ sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"

Confirm the content of the new modprobe config file:

$ cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0

Update kernel initramfs
Enter the following linux command to regenerate initramfs:

$ sudo update-initramfs -u
Reboot

All should be ready now. Reboot your system:

$ sudo reboot

#<------------------------------------ ------------------------------------>#

## How to install NVIDIA driver using Debian repository step by step instructions
1) Enable the non-free and contrib repository.
As an administrative user open the /etc/apt/sources.list and add the non-free repository. For example change the repository definition:

FROM:
deb http://ftp.au.debian.org/debian/ buster main
TO:
deb-src http://ftp.au.debian.org/debian/ buster main non-free contrib
Once ready update the repository index files using the below command:

# apt update

2) Install nvidia-detect utility by execution of the below command:
# apt -y install nvidia-detect

3) Detect your Nvidia card model and suggested Nvidia driver. To do so execute the above installed nvidia-detect command. For example:
# nvidia-detect
Detected NVIDIA GPUs:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] [10de:1c03] (rev a1)

Checking card: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)
Your card is supported by the default drivers and legacy driver series 390.
It is recommended to install the
nvidia-driver
package.

4)As suggested install the recommended driver by the previous step:
# apt install nvidia-driver

5)All done. Reboot your Debian 10 Buster Linux box:
# systemctl reboot