184

I have a Nvidia Ge force Ge6150 SE graphics card. I am running ubuntu 12.04. When I try to install the .run file it fails. It shows the message like this:

I tried to install it after uninstalling the old driver.still same message. Here is the log file:

nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Mon Jun 11 05:46:17 2012
installer version: 295.53

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

nvidia-installer command line:
    ./nvidia-installer

Using: nvidia-installer ncurses user interface
-> The file '/tmp/.X0-lock' exists and appears to contain the process ID '1062' of a >runnning X server.
ERROR: You appear to be running an X server; please exit X before installing.  For >further details, please see the section INSTALLING THE NVIDIA DRIVER in the README >available on the Linux driver download page at www.nvidia.com.
ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' >for details.  You may find suggestions on fixing installation problems in the README >available on the Linux driver download page at www.nvidia.com.

but no such file is shown in the process manager.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
Kiranraj
  • 2,103
  • 3
    Does installing the nvidia-current package in ubuntu with apt-get not work with your card? Why are you trying to install that version of the driver, rather than the supported version packaged for ubuntu 12.04? – dobey Jun 11 '12 at 01:05
  • 1
    It has problems with my card.It conflicts with unity.Glitches in video playback .Nvidia Current is still 295.40!It do not give me the resolution 1440*900 – Kiranraj Jun 11 '12 at 01:20
  • 5
    Don't use the .run file. Just sudo add-apt-repository ppa:graphics-drivers/ppa. The latest drivers will appear in "Software & Updates --> Additional Drivers". – Dominic Cerisano Sep 13 '17 at 19:41
  • Following this link surely helps you: https://unix.stackexchange.com/a/524151/365545 – Giang Nguyen Oct 05 '20 at 09:35
  • @DominicCerisano , this add option to software and update but further did not work for me. e.g., I could see driver v510 using nvidia-smi, but this command add v515. but next it says ...couldn't communicate with driver – bim Jun 22 '22 at 09:59
  • You really need to give the command lines you are using. Eg. the errors you gave indicate you need likely need to be root (sudo). – Dominic Cerisano Jun 22 '22 at 14:54
  • 1
    My bad, it is working perfectly now. the error message was because I did not restart the machine. – bim Jun 28 '22 at 08:34

17 Answers17

151

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.

  1. Hit Ctrl+Alt+F1 and login using your credentials.
  2. kill your current X server session by typing sudo service lightdm stop or sudo lightdm stop
  3. Enter runlevel 3 by typing sudo init 3
  4. Install your *.run file.
    1. you change to the directory where you have downloaded the file by typing for instance cd Downloads. If it is in another directory, go there. Check if you see the file when you type ls NVIDIA*
    2. Make the file executable with chmod +x ./your-nvidia-file.run
    3. Execute the file with sudo ./your-nvidia-file.run
  5. 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.
  6. It's worth mentioning, that when installed this way, you'd have to redo the steps after each kernel update.
mikewhatever
  • 32,638
Rey Leonard Amorato
  • 2,238
  • 1
  • 16
  • 27
  • 2
    I only see a blank, black screen when trying to access the tty terminals. How should I go about installing the drivers? – Kevin Wheeler Aug 18 '15 at 06:44
  • 25
    This made my laptop unusable. I boot successfully into the login screen, but when I login to any account, I see a black screen for a second and I am back at the login screen... any idea what's going on or how to resolve it? :( – user1111929 Feb 11 '16 at 14:41
  • This happened to me on my GT220 card, updating to nvidia 340. Apparently, the card is not supported by the latest driver. You may try going down a version or two until you have a usable desktop. Good luck! – Rey Leonard Amorato Feb 12 '16 at 15:12
  • 3
    "Enter runlevel 3 by typing sudo init 3 and install your *.run file" can you please clarify how to install the .run file? – Kalamalka Kid Jun 10 '16 at 07:03
  • Once you've managed to enter runlevel 3, you can simply type <path to your *.run file> and execute. The installer will guide you through the process. – Rey Leonard Amorato Jun 20 '16 at 06:49
  • Notice that runlevel 3 is the same as runlevel 2-5 in all Debian distros (including Ubuntu), see: Debian and Ubuntu Linux Run Levels.
    This means that you need to sudo service lightdm stop after that you enter to runlevel 3. In our case, it seems redundant to enter to runlevel 3, isn't it?
    – Dor Oct 06 '16 at 17:39
  • They are not the same. More like similar because they are all multi-user modes. #2 has a graphical display manager, whereas #3 does not. Read the part about `#telinit 3' somewhere near the bottom. – Rey Leonard Amorato Oct 08 '16 at 02:28
  • 20
    Great advice to kill your machine... – Shautieh Apr 19 '17 at 06:53
  • If you have a black screen you might have a terminal prompt out of view, type enter a handful of times to make sure you still don't have a terminal session open but you just can't see it. – Andrea Thacker Jul 06 '17 at 02:40
  • 11
    This killed my Ubuntu installation after stopping the lightdm service. Now I have another problem to solve. Why is this the most upvoted answer? – Jabberwockey Aug 12 '17 at 18:59
  • @Jabberwockey A few things have changed since this answer was posted but this is still the correct process. More likely you installed the wrong Nvidia driver for your card or a corrupted file. Ask a new question with the specifics. – Seth Aug 13 '17 at 00:44
  • 1
    @Jabberwockey, how did you solved your installation issue? I follow these instructions and it crashed my installation too. – XavM Aug 23 '17 at 09:58
  • You can restart from terminal with shutdown -r 0 – crypdick Nov 01 '17 at 15:15
  • 1
    I couldn't get any of the .run files from Nvidia's site to work (they would install but driver was broken). Using the graphics-drivers PPA instantly worked for me, as detailed in this answer: https://askubuntu.com/questions/61396/how-do-i-install-the-nvidia-drivers/61433#61433. nvidia-390. – thirtydot Apr 09 '18 at 01:32
  • for some reason service lightdm stop doesn't stop it. had to manually kill it. – thang Jun 12 '18 at 23:20
  • If your install for some reason has lightdm permanently disabled on reboot (causing login issues), edit the conf at bootup with 'e', find the line starting with 'linux', and append a '3' to the end of the line. This should start you up straight into terminal, where you can then restart the lightdm. – user2979044 Oct 09 '18 at 12:14
  • Works on Ubuntu 18.10. Thanks! Additionally, I used this link https://askubuntu.com/questions/842256/nvidia-driver-install-ubuntu-16-04 and during installation say yes to all installation steps (nvidia-xconfig utility, 32-bit OpenGL libraries, DKMS support) – Mr. Unnormalized Posterior Apr 01 '19 at 08:28
  • I do not undestand, how do I do anything when I am not logged in – Brana Jun 13 '19 at 00:07
  • @user1111929 I also the same problem. Did you find any way to resolve it? Or just reinstall Ubuntu? – Hossein Aug 24 '19 at 19:08
  • @Hossein This was 3.5 years ago, I do not remember sorry. But given the 18 upvotes on my comment, I suspect we're not the only ones. – user1111929 Sep 12 '19 at 18:55
  • 1
    It killed my pc awwwwwwwwwwwwwwwwwww – Giang Nguyen Oct 05 '20 at 08:57
  • Alright! This is how I solved the problem: sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt update sudo apt install nvidia-367 sudo reboot – Giang Nguyen Oct 05 '20 at 09:07
  • Also, follow this link to install cuda driver: https://unix.stackexchange.com/a/524151/365545 – Giang Nguyen Oct 05 '20 at 09:35
  • 1
    this solution does not work and destroyed my graphics and ubuntu. now nothing is working. – bim Jun 22 '22 at 10:28
  • for step.2 and .5, since I don't have lightdm installed, I used /etc/init.d/gdm3 stop and /etc/init.d/gdm3 restart, which worked – zheyuanWang Mar 08 '23 at 05:43
25

I installed latest nvidia drivers by this method:

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current

It is working fine with unity 3d. Thanks to all.

amc
  • 7,142
Kiranraj
  • 2,103
  • it's not clear if this gets around the problem of trying to install the driver while an X server is running. – amc Aug 01 '13 at 07:33
  • 4
    This doesn't fix the X server issue when trying to install the .run file, but it does offer another way to install/update to the latest nvidia drivers packaged for the unbuntu distro. – Felby Jan 12 '15 at 22:49
  • 3
    The driver this serves up is many versions outdated. Is there a way to get the actual current version through apt-get? – Nathan Schwermann Mar 20 '15 at 19:40
  • 9
    I strongly not recommend this method. It made my X server to refuse to start on system start, I had to remove it on console mode. It seems that those drivers are now very outdated and not updated anymore. – Aracthor Oct 28 '15 at 01:45
  • I strongly recommend this console method (don't use the website or .run files at all) as confirmed here: http://askubuntu.com/a/624967/662072 – MasterHD Mar 07 '17 at 12:03
  • Although this method works with unity, it will crash when installing driver with a gnome desktop – Yossarian42 Aug 05 '19 at 11:14
20

Add the --no-x-check flag when you run this in the terminal:

sudo ./NVIDIAxxxx.run --no-x-check
muru
  • 197,895
  • 55
  • 485
  • 740
user179092
  • 317
  • 2
  • 3
  • 7
    jalal@klein:~/Downloads$ sudo ./cuda_8.0.44_linux.run --no-x-check Unknown option: no-x-check – Mona Jalal Oct 08 '16 at 02:33
  • 1
    This doesn't resolve the issue on 16.04 for me. Driver installation still detects X server running and fails. – khaverim Feb 19 '17 at 05:41
  • 2
    From the docs: `--no-x-check

    Do not abort the installation if nvidia-installer detects that an X server is running. Only under very rare circumstances should this option be used.`

    – marcelocra Jan 23 '20 at 03:01
  • @marcelocra , Where did you find such document? Could you attach the link? – IgNite Mar 17 '20 at 16:26
  • The ./NVIDIAxxxx.run command is a bash script. I believe the documentation was inside of it. If that's really the case, try vim ./NVIDIAxxxx.run (sorry, I don't remember anymore, but since I didn't link it, that is probably correct). – marcelocra Mar 18 '20 at 20:30
  • Worked for me Debian 10 Buster, Nvidia Driver 460.91.03. – eXPRESS May 24 '22 at 18:00
  • +1 for the sudo - other answers did not mention this, but the error in the OP indicates root is required. – Dominic Cerisano Jun 22 '22 at 14:56
7

I had the same problem installing the driver for an old GeForce 9800 GT in Ubuntu 14.04-2. It was the NVIDIA-Linux-x86_64-340.76.run

I switched to the the tty1 using Ctrl+Alt+F1 and also stopped the service lightdm and when running the executable got the same error .

What I did to solve the problem was navigate to the /tmp folder and erase the .X0-lock file.

You will only see it listed if you use ls -la as it is a hidden folder by default(that is why it has a dot in front of the name)

cd /tmp
rm -rf .X0-lock

After erasing that folder and executing the NVIDIA-Linux-x86_64-340.76.run it installed just fine.

muru
  • 197,895
  • 55
  • 485
  • 740
Juan P
  • 89
  • 1
  • 3
2

This instructions Works great under ubuntu server 12.04 with ubuntu desktop for nvidia 8400GS PCI 512MB too just need to unistall all previous versions of default versions under ubuntu like 173 etc or any other before installing or there will be conflict or crash. Follow this tread instructions + read me install info from your card model example in my case latest driver version 319.23, see link below:

http://us.download.nvidia.com/XFree86/Linux-x86/319.23/README/installdriver.html

user162663
  • 21
  • 1
2

What worked for me:

sudo killall Xorg

and I had to run this multiple times, until I got a message saying

Xorg: no process found.

Then I am sure X server is stopped.

Xin
  • 121
  • 1
  • 5
2

Ubuntu 16.04 with Quadro 4000 confirmed that this method work:

sudo apt-get update
sudo apt-get install nvidia-375

Note that I don't use nvidia-current as I downloaded the run file from NVIDIA and its version is 375.66

Pokamy
  • 21
1

There is one more method, more elegant imho:

1. Run in terminal

sudo systemctl set-default multi-user.target
sudo reboot now

2. Install your *.run file

3. Type into terminal

sudo systemctl set-default graphical.target
sudo reboot now
Ivan Talalaev
  • 251
  • 2
  • 4
1

Try this :

  • Press Alt+F1, then log in.

  • Run sudo telinit 3 (if that doesn't work, try /sbin/telinit 3). Check that it is changed to level 3 with runlevel that should output something like 5 3 which means that the current run level is 3 and before it was 5.


In case that doesn't work, try:

ps ax | grep X

In the output you would see the PID number of the process X, so you should kill it with sudo kill -9 number where number is the PID number of the process.

Eliah Kagan
  • 117,780
user244991
  • 19
  • 1
  • This is a duplicate of this answer: https://askubuntu.com/questions/149206/how-to-install-nvidia-run/149224#149224 – karel Aug 24 '17 at 05:33
0

I had the same problem with ubuntu 18.04, so in order to solve this problem, I deleted lock file.

cd /tmp
ls -a
sudo rm -rf .X1-lock

Then you can install your Nvidia driver. Hope it will help ubuntu 18.04 users this is copied from @Juan P

Dhiren Hamal
  • 215
  • 3
  • 10
0

I had a hangup installing the 3.19 driver today because I did not remove the existing 3.13 driver. I used:

apt-get remove nvidia*

to get rid of all existing files, then

telinit 3
sh NVI*.run

Success. I already had DKMS installed, and the driver program asked if it should use DKMS, so no worries about kernel upgrades.

amc
  • 7,142
0

I tried all of these things and none of them worked for me, because I kept getting a Stop: Unknown instance error when I ran "sudo stop lightdm". I finally killed the x server by going into the lightdm log and finding its process number, then killing it that way:

  1. cd /var/log/lightdm

  2. open the .log file (you may need to use sudo to do this)

  3. look for something in the file that says "launching process 'process number'"

  4. sudo kill -9 'process number'

Good luck!

joe
  • 1
  • 1
0

I want to add my answer here because I couldn't install the NVidia driver, I couldn't get tty working and I wasn't able to install it in safe mode root shell. What I did was a combination of two answers here:

NOTE: before doing this, be sure that the NVidia driver is already downloaded and in an accessible directory.

For reference, I have NVIDIA GEFORCE GTX 750 TI and the following worked for me: Installing the generic Nvidia driver will get tty working, do this with:

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current 

Now you won't be able to get past the login screen in Ubuntu, but that's OK. Restart the computer and once you are brought to the sign in screen go to tty1 [ ctrl + alt + f1 ]. Now do the following commands:

sudo service lightdm stop
cd <path/to/NVIDIA>
sudo sh ./NVIDIA*

Follow the prompts and viola. After restarting everything should be working fine and dandy.

Klik
  • 322
  • I have 15.04 and the same graphics card. x-updates is apparently now just updates. Also I had to install nvidia-304 before nvidia-current as a prerequisite. And now, alas, accessing tty1 is perpetually stuck saying Scanning for Btrfs filesystems, so I am sad. I can't issue commands in tty1, and so I can't access my computer anymore, until I find a way – khaverim Feb 19 '17 at 05:57
0

If you have an NVIDIA .run file

  1. Remember (or write down) the folder you saved it in!
  2. Make .run file executable by

    Right click > Properties > Permissions> Allow executing file as program

    or from command line with:

    chmod u+x NVIDIA-blabla.run

  3. Log out

  4. Press Ctrl+Alt+F1 to enter the virtual console and log in to it

  5. Kill the X-server by

    sudo service lightdm stop or sudo lightdm stop

  6. sudo /path/to/the/file/NVIDIA-blabla.run

  7. Follow the instructions in the installer

  8. sudo service lightdm start or sudo lightdm start

  9. Press Ctrl+Alt+F7 to log in to graphical mode

  10. If it doesn't work, go back to virtual console and restart/shutdown, e.g.

    sudo reboot now

Noidea
  • 101
0

On Ubuntu 16, if you done lightdmstop and telinit 3, but the X server is still running (it will have "failsafe" string in process command line in ps), try this. Press Alt-F2 (perhaps try other F-keys for other consoles) and see if you get a graphic dialog window saying something about low graphics mode.

For me it had a number of options one of which was to go to the console. I chose it and the X server finally stopped so I could install the driver from Nvidia runfile.

0

I got this error when stopped X server to install CUDA. My system is Ubuntu 16.04 and i installed CUDA 8.0 from runfile. I fixed it just by upgrading my system. When the error message appears, press Ctrl + Alt + F1, log in with your account, and then run the two following commands:

sudo apt-get update

and

sudo apt-get dist-upgrade

Afterward, sudo reboot it should be working fine.

0

nvidia-installer log file '/var/log/nvidia-installer.log' creation time: Mon Jun 11 05:46:17 2012 installer version: 295.53

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

nvidia-installer command line: ./nvidia-installer

Using: nvidia-installer ncurses user interface -> The file '/tmp/.X0-lock' exists and appears to contain the process ID '1062' of a >runnning X server. ERROR: You appear to be running an X server; please exit X before installing. For >further details, please see the section INSTALLING THE NVIDIA DRIVER in the README >available on the Linux driver download page at www.nvidia.com. ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log' >for details. You may find suggestions on fixing installation problems in the README >available on the Linux driver download page at www.nvidia.com.

Killing X Server

As mentioned in the log, process ID 1062 is the reason X server is running.

Kill 1062

will kill the process and after that installation of NVIDIA driver will run smoothly.

Newton
  • 1
  • Kill [ID] killing process ID is logging me out and have to login again. Is X server related to logged in UI? – Sarz Mar 13 '18 at 09:07