Use upstart to replace rc.local

October 18, 2009

linux

On my new netbook I wanted to get rid of gdm and just start X right away. I use auto-login anyway so it is a bit stupid to first start gdm and then immediately start X.

So I removed gdm and edited /etc/rc.local to start X:

    su - miekg -c xinit xterm

But this sort of does not work anymore in Ubuntu Karmic. Karmic now uses upstart as an init replacement. So I figured why not write an upstart job that starts X?

The upstart jobs in Ubuntu are stored in /etc/init. Gdm’s upstart script was a good starting point so I copied that.

I finally settled on the following job:

% cat /etc/init/X.conf
# X - start X
description "Start X"
author  "Miek Gieben <miek@miek.nl>"

start on (filesystem and started hal)
stop on runlevel [016]

task
console output
emits starting-x

script
su - miekg -c xinit xterm
end script

So now I can enjoy a really fast boot and fast X startup. You’ll need a ~/.xinitrc to start up XFCE or GNOME or whatever.

Note; after reading some docs I still don’t know what the keyword task means in the above job.

None