Installing OpenBSD on CF under kvm (qemu) on Debian for later net4801 deployment
Pre requisites
Fast 1GB CF Card Debian (or other GNU/Linux distribution) CF-card reader
Preparations for installation
debian$ wget http://ftp.sunet.se/pub/OpenBSD/5.1/i386/cd51.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) you can access it as non root user. e.g.
debian$ sudo chmod 777 /dev/sdb
Start kvm:
debian$ kvm -hda /dev/sdb -cdrom cd51.iso -boot d
Perform a normal OpenBSD install with the following partition table
wd0a 300m / (wd0b 0 swap) wd0d 120m /var wd0e 80m /home wd0f 500(rest) /usr
Note: skipping /tmp for later
IP-network settings: use dhcp for now (Note: change this later when you do system configuration after reboot)
Installation options
http installation Server: ftp.sunet.se
I used the following sets
[X] bsd [X] bsd.rd [ ] bsd.mp [X] base51.tgz [X] etc51.tgz [ ] comp51.tgz [X] man51.tgz [ ] game51.tgz [ ] xbase51.tgz [ ] xetc51.tgz [ ] xshare51.tgz [ ] xfont51.tgz [ ] xserv51.tgz
After installation (do not reboot before this)
Edit /mnt/etc/fstab and change /tmp and /var/run to mfs
openbsd# echo "swap /tmp mfs rw,nodev,nosuid,-s=19456 0 0" >> /mnt/etc/fstab openbsd# echo "swap /var/run mfs rw,nodev,nosuid,-s=19456 0 0" >> /mnt/etc/fstab
apply the following change to /mnt/etc/rc
umount -a >/dev/null 2>&1 mount -a -t nonfs,vnd +chmod 1777 /tmp mount -uw / # root on nfs requires this, others aren't hurt rm -f /fastboot # XXX (root now writeable)
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 base56.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 -hda /dev/sdb
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,nodev,softdep,noatime 1 2 <DUID> /var ffs rw,nodev,nosuid,softdep,noatime 1 2 swap /tmp mfs rw,nodev,nosuid,-s=19456 0 0 swap /var/run mfs rw,nodev,nosuid,-s=19456 0 0
Fix /etc/hosts (my.domain will be there as well).
Install BASH, WGET, LSOF & NGREP
openbsd# pkg_add -v http://ftp.sunet.se/pub/OpenBSD/5.1/packages/i386/bash-4.2.20.tgz openbsd# pkg_add -v http://ftp.sunet.se/pub/OpenBSD/5.1/packages/i386/wget-1.13.4.tgz openbsd# pkg_add -v http://ftp.sunet.se/pub/OpenBSD/5.1/packages/i386/lsof-4.83p7.tgz openbsd# pkg_add -v http://ftp.sunet.se/pub/OpenBSD/5.1/packages/i386/ngrep-1.45p4.tgz
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 (e.g. disable ident, daytime and time for both IPv4 and IPv6 in /etc/inetd.conf)
Before last qemu shutdown (before moving CF to the net4801 box):
Edit /etc/ttys and fix the tty00 line
tty00 "/usr/libexec/getty std.19200" vt220 on secure
Add the file /etc/boot.conf
stty com0 19200 set tty com0