2009-08-09

Getting rid of the DisplayManager, Choose your run level

The Display Manager (generally: GDM, KDM, or XDM, Slim ...) is there for historical reason, but it isn't useful unless you need special features.
Now the problem is that Ubuntu restricted the uses of Run Levels ! So you have to tweak the system a little bit if you want to start in text mode.
So lets read:
Add a text-only runlevel to Ubuntu Gutsy and
Boot time RunLevel
Then modify your /etc/event.d/rc-default:
#
# This task guesses what the "default runlevel" should be and starts the
# appropriate script.

start on stopped rcS

script
runlevel --reboot || true

if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
telinit S
elif RL="$(grep -o "[[:blank:]][2345]$" /proc/cmdline || true)"; then
if [ -n "$RL" ]; then
telinit $RL
else
telinit 2
fi
elif [ -r /etc/inittab ]; then
RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
if [ -n "$RL" ]; then
telinit $RL
else
telinit 2
fi
else
telinit 2
fi
end script


Then knowing that I use Grub 2, the following file has to be modified /etc/grub.d/10_linux (no more menu.lst). Just add the bold part:
...
cat << EOF
menuentry "${OS}, linux ${version}" {
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
EOF
if test -n "${initrd}" ; then
cat << EOF
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
}
EOF

cat << EOF
menuentry "${OS}, linux ${version} (text mode)" {
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro 3 ${GRUB_CMDLINE_LINUX}
EOF
if test -n "${initrd}" ; then
cat << EOF
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
}
EOF

cat << EOF
menuentry "${OS}, linux ${version} (single-user mode)" {
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro single ${GRUB_CMDLINE_LINUX}
EOF
if test -n "${initrd}" ; then
cat << EOF
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
}
EOF

...

That worked for me, but be careful as it can screw your system !
Now just log in and type: $ startx awesome

No comments:

2023 summary

  Life is bigger than what you can imagine.  Still using Roam  http://www.roamresearch.com/  to take notes Still using Mastodon mainly, but ...