Console login on Ubuntu
From LinodeWiki
This document describes how to set up LISH console login on Ubuntu with upstart init (rather than sysvinit). This will apply to many but not all Ubuntu systems version 6.10 and higher, particularly those upgraded from previous versions, as the upgrade had some bugs.
Contents |
[edit] Am I running upstart?
Run this command:
# dpkg -S /sbin/init
If the answer is "upstart: /sbin/init", then you're running upstart and this guide applies to you. If the answer is anything else (probably "sysvinit: /sbin/init"), then you aren't and this document will not be helpful for you.
[edit] I can't log in to the console
You can try to get a console login by following the instructions at https://www.linode.com/members/remote.cfm titled "Remote Console Access with Lish (Linode Shell)". If putting in your username (or "root") and the appropriate password seems to have no effect whatsoever, you may need this fix. If you can login that way, you're all set, and can ignore this document.
Note that even if you can't see a login prompt, you might still be able to log in. Ubuntu bug 75830 means that as of Ubuntu 7.04 the username prompt is being displayed before the boot sequence finishes. That means you might not see it among all the boot messages. Try typing a username (or "root") and pressing Enter. If a "Password:" line comes up you can enter your password and get in. If it doesn't you likely need this document.
[edit] Step 0: Log in some other way
Log into your server over ssh or similar.
If the reason you're trying to get to the console is because you can't log into Ubuntu any other way, never fear, check out the Finnix LiveCD Recovery Distribution and boot into that. You'll be able to get to its console, mount your Ubuntu filesystems, and fix them in there.
[edit] Step 1: backup
Make a backup of /etc/event.d/tty0:
# cp /etc/event.d/tty0 /etc/event_d_tty0.bak-`date +%Y-%m-%d-%H:%M:%S`
If you break something, there will be a file starting with /etc/event_d_tty0.bak- (and some date/time info afterwards) to copy back to /etc/event.d/tty0
[edit] Step 2: fix /etc/event.d/tty0 settings
Now edit the file /etc/event.d/tty0 (or create it if it doesn't exist), so that it has this (and only this) in it:
# tty0 - getty # # Copied from Linode wiki at http://www.linode.com/wiki/index.php?title=Console_login_on_Ubuntu start on runlevel 2 start on runlevel 3 start on runlevel 4 start on runlevel 5 stop on shutdown respawn exec /sbin/getty 38400 tty0
If you're wondering why it might have looked otherwise, there was a bug in Ubuntu's migration of /etc/inittab lines to /etc/event.d files. Non-standard ttys (like tty0 and also serial consoles) were migrated incorrectly.
[edit] Step 3: Reboot and test
Reboot your Linode and test that you can log in via LISH.
[edit] Removing tty1, tty2, tty3, tty4, tty5, tty6
The system-services package is probably starting six other consoles for you. You can't access these, so there's no need to run the processes (although it doesn't hurt anything either).
To stop them spawning on boot, you can delete the relevant event.d files:
# rm /etc/event.d/tty[123456]
These files may be reinstalled on upgrades that upgrade system-services and then would have to be deleted again.
To stop the existing ones without rebooting:
# stop tty1 # stop tty2 # stop tty3 # stop tty4 # stop tty5 # stop tty6
[edit] More about upstart
See /usr/share/doc/system-services/README.Debian.gz on your system (you can page through it by running "zless /usr/share/doc/system-services/README.Debian.gz") and also http://upstart.ubuntu.com/
