Ubuntu – Stopping lightdm while trying to install nvidia driver ends-up to black screen


I get an error while trying to install the nvidia proprietary driver, which states that:

you appear to be running an XServer.

So I've followed instruction provided here.

But when I enter

sudo service lightdm stop

My screen goes completely blank and I am unable to proceed.

Running Ubuntu 16.04
Linux version 4.4.0-66-generic (buildd@lgw01-28) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

Best Answer

  • First of all, it's always a good practice to only install and use tested and reliable drivers from Ubuntu repositories.

    Here is what I would done If I wanted to install Nvidia proprietary driver.

    As your question states, the driver is complaining about a running X server.

    I ran the command you mentioned to stop X, and as you said I end-up with a black screen too, but when I pressed: CTRL+ALT+F2 I went to tty2 and I was able to login and do my stuff without any running X Server.

    So it seems when you stop lightdm, you are still at the tty7 which graphical environment was running and it's not anymore, thats why you are getting a black screen. just change the tty with CTRL+ALT+F1 or to F6 and you will be good to go.

    Anyway if you have some problems with that approach and it does not works for you, you can always kill the x:

    pkill Xorg

    But let it for when nothing else works.

    You can also try the installation process by going into multi-user.target like:

    sudo systemctl isolate multi-user.target

    If you've got trouble with this one too (which is rare).

    • Reboot your system
    • When grub menu appears press e to edit the menu
    • At the end of line which starts with linux add systemd.unit=multi-user.target
    • Press ctrl+x

    Your system will bootup into multi-user target without a running X server. do your installation. then run:

    sudo systemctl isolate graphical.target

    To run the graphical environment, or reboot the system if driver need it.