Ubuntu – Don’t start Xserver


I'm trying to convince Ubuntu's init system not to start X11 at boot-up. Removing gdm did not change the fact that each time the machine restarts, X11 with Gnome comes up.

How do I get rid of it? I need to auto-login as root with no Xserver after startup. It's inteded for a very specific automation-purpose to behave like that and not meant for Desktop experience 😉

Best Answer

  • There are two files controlling X startup in a standard Ubuntu installation: /etc/init/gdm.conf and /etc/init/failsafe-x.conf. While the first is owned by package gdm, the second is owned by x11-common and will be triggered if GDM fails to start, which happens in particular when you remove GDM.

    However, you need not remove packages to prevent GDM from starting; it enough to tell the upstart system not to start it:

    1. edit the /etc/init/gdm.conf and the /etc/failsafe-x.conf files (it might be a good idea to make a backup copy of the files before editing)
    2. change the existing start on ... stanza with a condition that is not met in your standard environment; for instance, you might want to start X only on "runlevel 5" which is what other Linux distros traditionally did:

      start on runlevel [5]
    3. save your changes and restart

    Complete documentation on the upstart configuration files can be read by man 5 init.