Thursday, March 02, 2006

Getting >console to work in 10.4

Since 10.4, using the >console login from the login window has been, at best, sporadic. Many times, the error "Operation not supported by device" for /dev/console will be given. Here is a kludge to make it work, but must be repeated anytime the machine is restarted.

Read on for more detail

First, you must login as a normal user through the login window. Once here, open up a Terminal window and cd to /etc. There is a file, ttys which controls what actually handles /dev/console (among other things). Temporarily changing this file, handling a basic getty login, then changing the file back is the kludge here.
While in /etc, run

sudo cp -p ttys ttys.orig

to have the original on hand. Next, edit ttys with your preferred editor (emacs, nano, pico, or vi and don't forget the sudo). What you want to do is uncomment the first line with console in it, which looks like

#console "/usr/libexec/getty std.57600" vt100 on secure

and make it look like

console "/usr/libexec/getty std.57600" vt100 on secure

Then comment-out the second line about console, which should look like

console "/System/Library/CoreServices/" vt100 on secure onoption="/usr/libexec/getty std.9600"

and make it look like

#console "/System/Library/CoreServices/" vt100 on secure onoption="/usr/libexec/getty std.9600"

Save and quit.

Now, tell launchd (successor to init) to reread the file:

sudo kill -1 1

Now logout, and a basic console-only login should be presented instead of the normal graphic login window.

Back to normal
Login to the console, then switch the ttys back and tell launchd again:

sudo mv /etc/ttys.orig /etc/ttys
sudo kill -1 1

Logout again, and the graphic login window should be working again. However, using >console should also work as it once did.

On reboots
Just remember, this works until the machine is restarted, then it'd have to be done again, but until then, >console should work.

Update (2006-04-17)
Three things: First, when you do this you may see the "Operation not supported by device" several times before a login prompt shows. Each time this happens, you have to wait thirty seconds, so it could take a couple minutes.

Second, don't reboot with this setting in place, as otherwise you'll be sitting and staring at the "Starting Up" window forever. If you do have to reboot for whatever reason, be sure to boot in single user to put the ttys.orig back in place, otherwise you'll need to be able to ssh into the machine to fix it. This would entail putting the ttys back in place, HUPing launchd, and killing off getty and possibly a WindowServer process.

Finally, be sure to read Wout's comment below if you use ARD.