Pelicanux

Just A Few Random Words

Install OpenBSD From USB Stick

I have spent quite a long time struggeling to install OpenBSD on my home server. This one does not have any CD-Rom reader, I could only use the USB-stick. Of course, I could have tried with PXE, but I have focused on USB, and here is how to do this;

Global idea

Just install OpenBSD on a virtual dummy system and put this system on the USB stick. Make it bootable, and voilà :)

To prepare the USB key, just make sure there isn’t any weird filesystem on it. In case, just run

1
dd if=/dev/zero of=/dev/sdb

to ensure partition table will be erased.

Installing virtual machine

1
2
3
wget ftp://ftp.fr.openbsd.org/pub/OpenBSD/5.3/i386/install53.iso
qemu-img create openbsd.img 1G
qemu -boot d -hda openbsd.img -k fr -cdrom install53.iso

qemu will create this dummy image. It will be 1G large. Booting it will start the installation process, providing a French (fr) keyboard and using the downloaded install53.iso as CDRom. The installation steps will remain the same as a standard OpenBSD install (in fact, this is completely equivalent).

Do not forget to avoid the installation of useless packets such as X graphics stuff and compil53.gz; keep in mind this is only installing a device to install the beast on the target server. Use -x* , -compil53.gz, and -man.gz.

Power off the virtual machine once installation is done.

Use VM to copy to USB stick

Power On the VM with the USB stick as a second disk:

1
qemu -boot c -hda openbsd.img -hdb /dev/sdb -k fr

Once started:

1
2
3
4
5
6
7
8
9
fdisk -i /dev/wd1 # Create a new MBR on the stick
disklabel -E wd1  # Create a new partition on it
newfs /dev/wd1a  # Format the stick (BSD Filesystem then)
mount /dev/wd1a /mnt # mount it!
cp bsd.rd /mnt
cp boot /mnt
ls /mnt -> boot bsd.rd
# This last command makes the USB stick bootable
/usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot wd1

The end!

Umount stick, poweroff virtual system, and try it locally before the actual install on server:

1
qemu -boot c -hda /dev/sdz -k fr