Singleuser

Single User Mode

If your system has damaged or missing files, you may need to boot into single user mode to repair the operating system. This is described in the OpenBSD FAQ.

Here's how you do it if you have a virtual machine running inside OpenBSD's VMM. First, login to the host machine:

$ ssh username@host.example.com

Once logged in, stop and restart the virtual machine:

$ vmctl stop username
stopping vm user: requested to shutdown vm 11
$ vmctl start -c 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

You must quickly boot into single user mode before automatic booting begins. Type boot -s:

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

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. Finally, we set the terminal type.

After any necessary repairs have been performed, you can reboot and login as usual:

# shutdown -r now