As expected, Nvidia drivers have reduced my customizations. I can't login to Unity 3D session. I can't find any content to help me to uninstall the driver and I don't know what to do as I have never uninstalled them before.

  • About the unity, do "unity --reset" Commented Mar 9, 2014 at 17:49

7 Answers 7


For Ubuntu 12.04-22.04

Commands can be executed to terminal. You can open a terminal with Ctrl + Alt+T keys combo.

If you remove --purge the nvidia driver you will be OK. No need to blacklist something, but sometimes maybe a force-load of the nouveau module needed.

First uninstall completely the driver.

Search what packages from nvidia you have installed.

dpkg -l | grep -i nvidia

except the package nvidia-common all other packages should be purged.

If you want to be sure that you will purge everything related to nvidia you can give this command

sudo apt-get remove --purge '^nvidia-.*'

the .* in the end means (Purge everything that begins (^) with the name nvidia-)


above command will also remove the nvidia-common package and the nvidia-common package has as a dependency the ubuntu-desktop package.

So after above command you should also give the installation command for ubuntu-desktop package

sudo apt-get install ubuntu-desktop

Also sometimes the nouveau driver get blacklisted from nvidia driver. With purge command it should UN-blacklisted. If you want to be sure that nouveau will be load in boot, you can force-load it by add it to /etc/modules

echo 'nouveau' | sudo tee -a /etc/modules

Last , search for the xorg.conf file and remove it as well

sudo rm /etc/X11/xorg.conf

In summary

sudo apt-get remove --purge '^nvidia-.*'
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf
echo 'nouveau' | sudo tee -a /etc/modules

Although all above commands not needed, this is my way to completely purge the nvidia driver and use the open source nounveau.

  • 5
    Worked like a charm. Thanks! This was exactly what I needed.
    – VedVals
    Commented Oct 25, 2012 at 14:43
  • 20
    Your recipe just solved for me a similar problem that kept me last night fiddling with my computer until 3 am. Not enough thanks. Commented Feb 22, 2013 at 18:46
  • 1
    Yes indeed it worked as a charm!!
    – alvas
    Commented Apr 27, 2013 at 6:43
  • This answer is still helping out! Fixed my Lubuntu 13.10. Thanks!
    – travisw
    Commented Feb 3, 2014 at 15:02
  • 2
    On my Ubuntu 16.04 LTS there is no nvidia-common package so the extra step of sudo apt-get install ubuntu-desktop can be omitted. Also there is no /etc/X11/xorg.conf file. Running locate xorg.conf reveals many files. Commented May 6, 2018 at 17:05

I just used the nvidia-uninstall.

sudo nvidia-uninstall

In my case I got the driver directly from the nvidia website.

  • Thank you so much for saving my system! If this hadn't worked, I would have probably had to reinstall my entire system. Commented Nov 7, 2018 at 23:19
  • 5
    nvidia-uninstall no longer supported. No command found in Disco Dingo Commented Jun 12, 2019 at 7:32
  • 3
    @InfiniteLoops, that must be caused by you installing the drivers from repository. The driver that's installed from NVidia website does have the nvidia-uninstall command in 2019. Commented Jun 26, 2019 at 22:21
  • omg! its perfect! you save my night!
    – aimodify
    Commented May 28, 2022 at 23:53
  • This also unrolls / restores the X config modified by nvidia-xconfig.
    – John Doe
    Commented Aug 30, 2023 at 23:30

I realize that this is an old answer, but I have to add an answer here for sake of clarity and system stability.

First off, the * is an expansion operator for the shell which will grab everything and remove a lot of files you don't need to remove. The safest way to remove the nvidia driver is to do

$ dpkg -l | grep nvidia

Search for nvidia-xxx.xx version or nvidia-driver-xxx.xx version and then type

$ sudo apt purge nvidia-xxx.xx


$ sudo apt purge nvidia-driver-xxx.xx

It will only remove that package but will also flag its dependencies for removal.

To remove the dependencies is easy.

$ sudo apt autoremove
$ sudo apt autoclean

So for example, if you have the 390.xx package installed, it would be.

$ dpkg -l | grep -i nvidia
ii  libnvidia-cfg1-390:amd64                   390.48-0ubuntu3                     amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-390                       390.48-0ubuntu3                     all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-390:amd64                390.48-0ubuntu3                     amd64        NVIDIA libcompute package
ii  libnvidia-compute-390:i386                 390.48-0ubuntu3                     i386         NVIDIA libcompute package
ii  libnvidia-decode-390:amd64                 390.48-0ubuntu3                     amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-390:i386                  390.48-0ubuntu3                     i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-390:amd64                 390.48-0ubuntu3                     amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-390:i386                  390.48-0ubuntu3                     i386         NVENC Video Encoding runtime library
ii  libnvidia-fbc1-390:amd64                   390.48-0ubuntu3                     amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-390:i386                    390.48-0ubuntu3                     i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-390:amd64                     390.48-0ubuntu3                     amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-390:i386                      390.48-0ubuntu3                     i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-ifr1-390:amd64                   390.48-0ubuntu3                     amd64        NVIDIA OpenGL-based Inband Frame Readback runtime library
ii  libnvidia-ifr1-390:i386                    390.48-0ubuntu3                     i386         NVIDIA OpenGL-based Inband Frame Readback runtime library
ii  nvidia-compute-utils-390                   390.48-0ubuntu3                     amd64        NVIDIA compute utilities
ii  nvidia-dkms-390                            390.48-0ubuntu3                     amd64        NVIDIA DKMS package
ii  nvidia-driver-390                          390.48-0ubuntu3                     amd64        NVIDIA driver metapackage
ii  nvidia-kernel-common-390                   390.48-0ubuntu3                     amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-390                   390.48-0ubuntu3                     amd64        NVIDIA kernel source package
ii  nvidia-prime                               0.8.8                               all          Tools to enable NVIDIA's Prime
ii  nvidia-settings                            390.42-0ubuntu1                     amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-390                           390.48-0ubuntu3                     amd64        NVIDIA driver support binaries
ii  xserver-xorg-video-nvidia-390              390.48-0ubuntu3                     amd64        NVIDIA binary Xorg driver

To verify, you can do

$ apt-cache search nvidia | grep driver
nvidia-settings - Tool for configuring the NVIDIA graphics driver
ubuntu-drivers-common - Detect and install additional Ubuntu driver packages
vdpau-driver-all - Video Decode and Presentation API for Unix (driver metapackage)
xserver-xorg-video-nouveau - X.Org X server -- Nouveau display driver
nvidia-340-dev - NVIDIA binary Xorg driver development files
nvidia-384 - Transitional package for nvidia-driver-390
nvidia-384-dev - Transitional package for nvidia-driver-390
nvidia-driver-390 - NVIDIA driver metapackage
nvidia-utils-390 - NVIDIA driver support binaries
xserver-xorg-video-nvidia-390 - NVIDIA binary Xorg driver
bumblebee-nvidia - NVIDIA Optimus support using the proprietary NVIDIA driver
kubuntu-driver-manager - Driver Manager for Kubuntu
kubuntu-driver-manager-dbg - Driver Manager for Kubuntu -- debug symbols
nvidia-common - transitional package for ubuntu-drivers-common
nvidia-304 - NVIDIA legacy binary driver - version 304.137
nvidia-304-dev - NVIDIA binary Xorg driver development files
nvidia-340 - NVIDIA binary driver - version 340.107
nvidia-387-dev - Transitional package for nvidia-driver-390
nvidia-387 - Transitional package for nvidia-driver-390
nvidia-390-dev - Transitional package for nvidia-driver-390
nvidia-390 - Transitional package for nvidia-driver-390
nvidia-driver-396 - NVIDIA driver metapackage
nvidia-utils-396 - NVIDIA driver support binaries
xserver-xorg-video-nvidia-396 - NVIDIA binary Xorg driver

Once you've targeted the package to remove, do

$ sudo apt purge nvidia-390 (nvidia-driver-XXX) -y
$ sudo apt autoremove -y
$ sudo apt autoclean

Make sure to install whatever driver you plan on using right after you do this and if you don't have livepatch because of whatever reason, just reboot your system and you should be good to go.

This way you don't ever have to worry about removing system dependencies while clearing out your drivers. You'll have a sane and stable system afterwards and don't have to worry about re-installing other packages that your system may depend on. That's apts job, not yours.

  • 1
    You can do it even more simply: dpkg -l | grep nvidia-driver. Then purge the driver and perform the autoremove and autoclean. This will get you to the same point but avoid you from having to look through more dpkg results
    – Greg
    Commented Jan 15, 2021 at 19:35

If you have only access to GRUB:

  1. Restart your computer
  2. Select Advanced options for Ubuntu at GRUB Boot Menu
  3. Select Ubuntu ..... (recovery mode)
  4. Select dpkg Repair broken packages at the Recovery Menu (this will stop the nvidia processes so we can uninstall). Choose Yes. When finished press ENTER (even if it found problems)
  5. Select root (Drop to root shell promt at the Recovery Menu)
  6. Type your root password
  7. Type: apt-get remove --purge nvidia-*
  8. If finished type: reboot
  9. Boot as usual, it should go to your Ubuntu Login screen now
  • user383919 and your answer did the trick. thanks a lot
    – Hossein
    Commented May 11, 2022 at 2:57

I didn't want to modify /etc/modules, and just revert to an install without the nvidia drivers. So I mostly did as the accepted suggested, but instead of the last step, I do this:

sudo rm /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -k all -u

So my variant summary:

sudo apt-get remove --purge nvidia-*
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf
sudo rm /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -k all -u

I'm not sure how correct or wrong this answer is but here what I did:

sudo apt-get remove nvidia*
sudo apt-get remove libnvidia*
sudo apt-get autoremove
# dpkg -l | grep nvidia
# rc  libnvidia-compute-510:amd64                510.73.05-0ubuntu0.22.04.1                                 # amd64        NVIDIA libcompute package
# ii  libnvidia-compute-510:i386                 510.73.05-0ubuntu0.22.04.1                                 # i386         NVIDIA libcompute package
# rc  nvidia-compute-utils-510                   510.73.05-0ubuntu0.22.04.1                                 # amd64        NVIDIA compute utilities
# rc  nvidia-dkms-510                            510.73.05-0ubuntu0.22.04.1                                 # amd64        NVIDIA DKMS package
# rc  nvidia-kernel-common-510                   510.73.05-0ubuntu0.22.04.1                                 # amd64        Shared files used with the kernel module
# rc  nvidia-prime                                                                        # all          Tools to enable NVIDIA's Prime
# rc  nvidia-settings                            510.47.03-0ubuntu1                                         # amd64        Tool for configuring the NVIDIA graphics driver
sudo apt-get remove libnvidia-compute-510:i386
# I don't know if next makes any sense at all
sudo apt-get remove *nvidia*

To uninstall nVIDIA driver, open terminal by pressing (Ctrl+Alt+T) then type:

sudo apt-get purge nvidia-current
  • 1
    what if you only have access to GRUB? Commented Oct 18, 2014 at 21:49
  • @MattO'Brien one thing you could try is append init=/bin/bash to your Linux boot line from within GRUB. that would boot you up to the command line where you can do the rest. Alternatively, try appending novideo or novga to image line/root fs line instead. Commented Mar 24, 2015 at 20:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .