Getting a serial console (for login purposes) on OpenSolaris seems to be a two-sided operation. Either it is insultingly simple, or a convoluted mess. The two options I’ve discovered so far, in order of difficulty.
The easy way
By default Solaris starts a login console on /dev/console, whatever that happens to be at a given moment. Passing -B console=ttya on the kernel command line (via GRUB) will change the primary system console to the first serial port in the system (what Linux calls ttyS0), automagically creating a login prompt there when the system has finished booting.
The hard way
Assuming that for whatever reason /dev/console is not supposed to be on ttya, things move into twilight territory.
Historically a getty was spawned from inittab, and that was it. Sometime in the past Solaris changed this behaviour to a more complicated scheme.
Login processes are handled by the Service Access Controller (sac(1M)), which handles port monitors. Port monitors bind services to ports, for example ttymon(1M), which handles baud rates and spawning the login process. I have to admin that I have not completely understood the architectural design behind all this. As far as I was able to deduce from the manual pages for pmadm(1M), ttyadm(1M) and sacadm(1M) the default setting ought to produce a login prompt on the first two serial ports. Alas, it does not.
It looks like ttymons are no longer handled by SAC, no matter what the documentation says, but are instead spawned directly by SMF, specifically by svc:/system/console-login. This SVC has several instances that handle the login prompts on the virtual consoles for VGA. Adding an instance for ttya makes a login prompt appear on the first serial port. The following creates and activates this instance:
# svccfg -f - <<EOF
select svc:/system/console-login
add ttya
select svc:/system/console-login:ttya
addpg ttymon application
setprop ttymon/device = astring: /dev/term/a
setprop ttymon/label = astring: console
setprop ttymon/modules = astring: ldterm,ttcompat
setprop ttymon/nohangup = boolean: true
setprop ttymon/prompt = astring: "`uname -n` ttya login:"
addpg general framework
setprop general/enabled = boolean: true
EOF
#
Please note that due to the default settings in /etc/security/login root logins are not possible on this terminal.
Now I am waiting for one of two things to happen:
- Someone telling me that I’ve got it all wrong and that there’s a better way to do things
- Someone telling me that this is the official way to do it and that it is documented somwhere.
I’m not holding my breath on either one.