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
Replace username
and 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. Immediately, 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 start the basic shell.
We can either mount only the partitions we need (such as the root partition as read/write and /usr
):
# mount -rw / # mount /usr
The /usr partition provides us with basic system utilities.
Or we can mount all partitions in /etc/fstab:
# mount -a
Finally, if we want to edit some text with vi, we can set the terminal type:
# export TERM=vt220
To turn on networking, run:
# sh /etc/netstart
After any necessary repairs have been performed, you can exit from single user mode and login as usual:
# exit