I want the Live CD to boot and automatically log my user into a graphical environment, and I want to do that using the least amount of resources. I installed Squeeze, including LXDE for my graphical environment. This pulled in the GNOME Desktop Manager by default, which I don’t want, so I removed it.
sudo apt-get remove --purge gdm
My plan was to simply edit the inittab and tell it to start up X on a new terminal, so I did this first.
sudo vim /etc/inittab
The default run level for Debian is 3, so under the line:
6:23:respawn:/sbin/getty 38400 tty6
I set the following line:
7:3:once:/bin/su - user -l -c "/bin/bash --login -c startx" &>/dev/null
The command basically says to switch root to my user, “user”, and execute the startx command from a bash session.
Running the command “startx” will of course start the X server, but I need to tell it what environment to load. To do this, I created an .xinitrc in my user’s home directory.
echo "exec startlxde" > ~/.xinitrc
Unfortunately, upon a reboot X wouldn’t start. It took a little while to work out why this wasn’t working as I expected. Turns out that Debian limits who can start an X session, so I had to edit the file
/etc/X11/Xwrapper.config and set
allowed_users=anybody rather than just “root”.
This can also be achieved by running:
sudo dpkg-reconfigure x11-common
The only issue I have at the moment is that logging out of LXDE and selecting “Restart” or “Shutdown” from the menu does not actually perform said task. I’m assuming this is because my user doesn’t have permissions to do so, as X was not started by root. Well, time to fix that next 🙂