Uninstall gnome from Debian / Ubuntu - full apt remove commands

I accidentally installed Debian 12 with GNOME on a "headless" virtual machine with only 10 GB of disk space with a low-cost hosting provider.  I would only ever need to SSH into such a VM. Rather than re-installing again I tried to see if I could remove the GNOME/X11 components.  Various Reddit, Stackexchange and Superuser threads gave some commands but they were far from complete, at least for the newer Debian 11 and 12 versions.

Using "sudo apt list --installed" showed what else was remaining after I ran "sudo apt remove gnome". Some of these I looked up online to see if they truly were graphical only.

Warning: Do not just run "sudo apt remove gnome*" or "sudo apt remove x11*".  One of these ended up doing a cascade uninstall of sudo itself!  Fortunately I had the root password and could re-install it, but if you don't, I'd try these commands separately.  

    sudo apt remove totem
    sudo apt remove xauth
    sudo apt remove nautilus
    sudo apt remove indicator-power
    sudo apt remove indicator-datetime
    sudo apt remove powernow
    sudo apt remove x11-common
    sudo apt remove libx11*
    sudo apt remove gnome-online-accounts
    sudo apt remove gnome-control-center
    sudo apt remove gnome-online-accounts
    sudo apt remove gnome-backgrounds
    sudo apt remove gnome-bluetooth-3-common
    sudo apt remove gnome-accessibility-themes
    sudo apt remove adwaita-icon-theme
    sudo apt remove gnome-menus
    sudo apt remove gnome-themes-extra
    sudo apt remove gnome-themes-extra-data
    sudo apt remove gnome-user-data
    sudo apt remove gnome-user-share
    sudo apt remove font*
    sudo apt remove pipewire*
    
    sudo apt --purge autoremove

The removals freed up a few GB as well as far fewer running processes and more importantly, a smaller attack surface. Interestingly the adwaita-icon-theme had a ton of related tools that got removed. I am sure there are still a few small packages that could be removed, but I believe I got the bulk of them.

Some relevant threads: 

https://unix.stackexchange.com/questions/110882/installing-and-uninstalling-gnome-on-debian
https://forums.debian.net/viewtopic.php?t=134463
https://www.reddit.com/r/linuxquestions/comments/12z1k22/how_to_remove_gnome_desktop_in_debian_already/


Comments

Popular posts from this blog

Domain registrar pricing comparison (2014)

How to block the Admiral anti ad-block detection message

usoclient.exe in Windows 10 wakes up my PC with Wake Source: Unknown