How can I stop GDM on Ubuntu 18.04 Desktop in order to install NVIDIA Driver?

In the case of Ubuntu 16.04. I can download the NVIDIA driver run file and then ctrl+alt+F1 and then do the below

sudo service lightdm stop
sudo ./NVIDIA-Linux-x86_64-390.48.run

I follow on screen instructions to install and reboot and everything works.

Now I am trying to do the same thing on Ubuntu 18.04. I read that Ubuntu 18.04 switched to gdm so I tried

sudo service gdm stop
sudo gdm stop

None of them worked, after some searching I realized it could be gdm3 instead but I tried

sudo service gdm3 stop
sudo gdm3 stop

Still none of them worked, and of course sudo service lightdm stop doesn't work. When I tried to install the driver it kept telling me the x-server is still on so can't start the installation process.

What is the right way to stop gdm in Ubuntu 18.04?


Ubuntu has been using systemd for a while now. This worked for me.

sudo systemctl stop gdm3

Dropping to run-level 3 and then installing the driver worked for me. You can change run-level using: sudo telinit 3.