Installing OpenBSD on CF under kvm (QEMU) on Debian for later net5501 deployment
Prerequisites
- Fast 1GB CF Card
- Debian (or other GNU/Linux distribution)
- CF-card reader
Limitations, the system is too low on ram to be able to run syspatch
, as that will require allocating
a big /tmp
on mfs
(Memory File System), and that will in turn make the kernel relinking fail due to too little free memory.
Preparations for installation
debian$ curl -O https://ftp.uni-stuttgart.de/pub/OpenBSD/7.0/i386/install70.iso
Plug-in the CF card in the cf card reader. If your system auto mounts the file system on the CF card, umount it.
Change the permission of /dev/sdb
(or the device name your cf got when you plugged it in) so you can access it as non root user. e.g.
debian$ sudo chmod 777 /dev/sdb
Start kvm:
debian$ kvm -drive file=/dev/sdb,format=raw -cdrom install70.iso -boot d -m 512
IP-network settings: use dhcp for now (Note: change this later when you do system configuration after reboot)
Perform a normal OpenBSD install with the following partition table
wd0a 100m / (wd0b 0 swap) wd0d 100m /var wd0e 40m /home wd0f 760(rest) /usr
Note: skipping /tmp
for later
I used the following sets
[X] bsd [X] bsd.rd [X] base70.tgz [ ] comp70.tgz [X] man70.tgz [ ] game70.tgz [ ] xbase70.tgz [ ] xshare70.tgz [ ] xfont70.tgz [ ] xserv70.tgz
After installation (do not reboot before completing the following section), select "Exit to (S)shell"
Edit /mnt/etc/fstab
and change the filesystem type on /tmp
and /var/run
to mfs
to minimize the wear of the CF card
openbsd# echo "swap /tmp mfs rw,nodev,nosuid,-s=10m 0 0" >> /mnt/etc/fstab openbsd# echo "swap /var/run mfs rw,nodev,nosuid,-s=4m 0 0" >> /mnt/etc/fstab
apply the following change to /mnt/etc/rc
# Unmount all filesystems except root.
umount -a >/dev/null 2>&1
# Mount all filesystems except those of type NFS and VND.
mount -a -t nonfs,vnd
+chmod 1777 /tmp
# Re-mount the root filesystem read/writeable. (root on nfs requires this,
# others aren't hurt.)
mount -uw /
chmod og-rwx /bsd
If you use ed
openbsd# ed /mnt/etc/rc /mount -a -t nonfs/ a chmod 1777 /tmp ctrl-d w q
A word of warning, starting with OpenBSD 5.6 /etc/rc
is no longer a config file so this need to be redone after unpacking baseNN.tgz
Example of what should be done when you later upgrade
# cp /bin/ed /bin/oed # tar -C / -xzphf base71.tgz # /bin/oed /etc/rc /mount -a -t nonfs/ a chmod 1777 /tmp ctrl-d w q
Fix the domain name (will be my.domain by default)
openbsd# echo "<hostname>.<domain>" > /mnt/etc/myname # (e.g. calvin.example.com)
Now it's time to halt and restart the system
openbsd# halt
Exit QEMU (close the window) and restart QEMU
debian$ kvm -drive file=/dev/sdb,format=raw -m 512
System configuration after reboot
When the system is up after the first reboot we can use vi instead of ed to perform some more configurations.
Enable soft updates and disable atime by editing /etc/fstab
(we will reboot later)
<DUID> / ffs rw,softdep,noatime 1 1 <DUID> /home ffs rw,nodev,nosuid,softdep,noatime 1 2 <DUID> /usr ffs rw,wxallowed,nodev,softdep,noatime 1 2 <DUID> /var ffs rw,nodev,nosuid,softdep,noatime 1 2 swap /tmp mfs rw,nodev,nosuid,-s=10m 0 0 swap /var/run mfs rw,nodev,nosuid,-s=4m 0 0
Fix /etc/hosts
by adding the real (FQDN) hostname (only localhost is there after installation), example after fixing:
127.0.0.1 localhost ::1 localhost 192.168.1.1 calvin.example.com
Install BASH, CURL, & NGREP
openbsd# pkg_add -v bash openbsd# pkg_add -v curl openbsd# pkg_add -v ngrep
Verify that bash is in /etc/shells
openbsd# grep bash /etc/shells /usr/local/bin/bash
Change shell to bash
openbsd# chsh -s bash openbsd# chsh -s bash <user>
Continue configuring the system and before last QEMU shutdown (before moving CF to the net5501 box):
Edit /etc/ttys
and fix the tty00
line
-tty00 "/usr/libexec/getty std.9600" unknown off +tty00 "/usr/libexec/getty std.19200" vt200 on secure
Add the file /etc/boot.conf
stty com0 19200 set tty com0