login.conf

Troubleshooting

Suppose /etc/login.conf and /etc/login.conf.db are missing or were deleted. You might see this error:

OpenBSD/amd64 (example.ircnow.org) (tty00)

login: root
login: Failure to retrieve default class

The way to fix this is to reboot the system into single user mode? as described in the OpenBSD FAQ:

$ vmctl stop username
stopping vm user: requested to shutdown vm 11
$ vmctl start username
vmctl: started vm 11 successfully, tty /dev/ttypa

You then have to quickly load the console before the system boots:

coconut$ vmctl console username
Connected to /dev/ttypa (speed 115200)
Using drive 0, partition 3.
Loading......
probing: pc0 com0 mem[638K 510M a20=on]
disk: hd0+
>> OpenBSD/amd64 BOOT 3.52
/
com0: 115200 baud
switching console to com0
>> OpenBSD/amd64 BOOT 3.52

(Hint: You may want to press some alphanumeric letters on your keyboard to prevent automatic bootup, then delete them)

Type boot -s to boot into single user mode:

boot> boot -s
...
com0: console
vscsi0 at root
scsibus3 at vscsi0: 256 targets
softraid0 at root
scsibus4 at softraid0: 256 targets
root on sd0a (6dd62d70bdd3bab6.a) swap on sd0b dump on sd0b
Enter pathname of shell or RETURN for sh:

Press enter to continue:

# mount -rw /
# mount /usr
# export TERM=xterm
# vi /etc/login.conf

Here we are mounting the root partition as read-write (previously it was read-only). Then, we mount /usr in order to have access to basic system utilities. Then, we set the terminal type, then edit /etc/login.conf.

You can grab the default login.conf from CVSWeb, following the src -> etc -> etc.amd64 -> login.conf -> Revision 1.18 download link. Copy paste this into /etc/login.conf, save, then quit.

# cap_mkdb /etc/login.conf
# shutdown -r now  

Now, log in as usual.