Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

Disabling X server autostart (gdm) on Ubuntu Karmic (9.10)

Posted by Admin • Monday, November 16. 2009 • Category: Linux

There are many reasons one may wish to do this - running their desktop installation as a sever (temporarily perhaps), solving some video issues... or just doing it to get that facet of control back. I, for instance, prefer to run X with "startx" when I'm ready to do so. I do not enjoy a black screen when the latest intel video driver doesn't work - I'd rather Ctrl-Alt-Backspace and fix it.

Anyway, so Karmic (and apparently certain installs before Karmic, as well) uses an init system called "Upstart". If you've tried messing with update-rc and noticed that disabling /etc/init.d/gdm doesn't work, this is why. Oh sure, you can run /etc/init.d/gdm stop, but it's only temporary, assuming that works for you at all - for me it does not - my console does not recover and I get a black screen.

To get it to stop permanently the proper way is apparently to work with upstart. You'll notice some definitions in /etc/init (no, not /etc/init.d). These work somewhat like the Gentoo init.d scripts - you can define dependencies, events, phases, etc. So looking at /etc/init/gdm.conf I see:

# gdm - GNOME Display Manager
# The display manager service manages the X servers running on the
# system, providing login and auto-login services

description     "GNOME Display Manager"
author          "William Jon McCann "

# I Commented these out:
#start on (filesystem
#         and started hal
#         and tty-device-added KERNEL=tty7
#         and (graphics-device-added or stopped udevtrigger))
#stop on runlevel [016]

emits starting-dm


    [ ! -f /etc/X11/default-display-manager -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/gdm" ]

    # Check kernel command-line for inhibitors
    for ARG in $(cat /proc/cmdline)
        case "${ARG}" in
                exit 0

    if [ -r /etc/default/locale ]; then
        . /etc/default/locale
        export LANG LANGUAGE
    elif [ -r /etc/environment ]; then
        . /etc/environment
        export LANG LANGUAGE

    initctl emit starting-dm DM=gdm

    exec gdm-binary $CONFIG_FILE
end script

Notice that I commented out the start on and stop on lines. That took care of it. You can still start it with /etc/init.d/gdm start (or perhaps more correctly: initctl start gdm) but it won't start on boot.

0 Trackbacks

  1. No Trackbacks


Display comments as (Linear | Threaded)
  1. No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Standard emoticons like :-) and ;-) are converted to images.
Markdown format allowed

Submitted comments will be subject to moderation before being displayed.