How to completely remove broken GNOME/GDM installed on Ubuntu Server?

7,819

Solution 1

sudo apt-get remove does not remove the configuration files, but since you already removed the packages you cannot purge the config files. Your best bet is to reinstall the same packages then purge them, thus removing all configuration files.

sudo apt-get update
sudo apt-get install xserver-xorg xfonts* gnome gdm
sudo apt-get purge xserver-xorg xfonts* gnome gdm

Solution 2

While as Scott Goodgame says apt-get purge can only purge packages that are installed, dpkg -P does not have this limitation. So there's no need to reinstall a package for the purpose of re-uninstalling it with the purge action.

Those skeptical that dpkg has this ability can test it out, perhaps by installing, removing, and dpkg -P-purging a package rarely present on desktop systems, with configuration files but minimal dependencies, such as gamin.

To remove the packages' systemwide configuration files (this will also uninstall the packages if they're still installed, this acting like sudo apt-get purge ... in that case), run:

sudo dpkg -P xserver-xorg `dpkg-query -f '${binary:Package} ' -W xfonts\*` gnome gdm

apt-get matches regular expressions like xfonts*, but dpkg doesn't, which is the reason for the italicized backticked expression.

As a secondary matter, you might be surprised to learn apt-get interprets xfonts* as a regexp. If xfonts* were expanded with shell-like expansion, it would match all names starting with xfonts. Since it's expanded as a regexp instead, it matches all names with xfont (not xfonts, xfont) anywhere in them, including packages like fonts-ipaexfont-gothic. This is because, in regular expressions, x* means "zero or more xes." The pattern you probably want is ^xfonts, which matches xfonts at the beginning of a package name (or of a line, in the general use case).

Share:
7,819

Related videos on Youtube

Kiara
Author by

Kiara

Updated on September 18, 2022

Comments

  • Kiara
    Kiara over 1 year

    I have installed an Ubuntu Server. It obviously comes with no graphical interface. I tried to install one with:

    apt-get install xserver-xorg xfonts* gnome gdm
    

    Then I got an error message trying to log in with GNOME and eventually I uninstalled everything:

    apt-get remove xserver-xorg xfonts* gnome gdm
    

    However, it seems Ubuntu still has some scripts trying to launch GNOME since when starting I get:

    Starting GNOME Display Manager   fail
    ...
    Stopping system v run level compatibility
    

    And the system stops forever. (I know I can use Alt+F1.)

    What should I modify to get this completely uninstalled? I cannot find anything in the rc2.d directory.

    • Kendor
      Kendor almost 11 years
      If you want to keep the server a pure server, you may want to install something like Webmin, which can give you a web-based GUI for a lot of configuration options. ubuntuserverguide.com/2012/06/…
  • Kiara
    Kiara almost 11 years
    I think I have it... Removing /etc/rcS.d/S70x11-common and /etc/init/gdm.conf Not totally sure but apparently that made it!
  • Scott Goodgame
    Scott Goodgame almost 11 years
    You might want to use remove if you have configured the program but the executables/libraries are corrupted, but I usually just purge it to make sure it is gone,gone,gone.