Install OpenBSD On a Strato Root-Server

Disclaimer

Okay, here is a little howto to install OpenBSD Unix on a Strato root-server. If you are impatient, you won’t need more than a piece of paper, and a ssh connection. If you got time, you will also need a local installation of OpenBSD to make a bootable installation floppy. ANYHOW, I CAN’T GIVE YOU ANY GUARANTEE THAT THIS WILL WORK! YOU ARE BASICALLY ON YOUR OWN OUT THERE, BUT IF YOU ARE AN ADVANCED BSD-DEVIL, SOME TIPS MIGHT COME IN HANDY.

Installation Process

Serial console

First of all, get an account. Strato has the nice feature of a remote serial console, which actually CRIES out for installing a new Operating System. You have to activate it through the web-frontend. Do it, and read the instructions how to access your server.

Write down network information

Boot your server into default mode. It is important that you write down all your network information, because somehow the dhcp support failed. DON’T LOSE IT! We will destroy your system a little later. Make sure you have:

ipadress, broadcast, netmask -> run "ifconfig"
hostname                     -> run "hostname"
nameserver, domainname       -> run "cat /etc/resolv.conf"
defaultrouter                -> run "route -n"
serial port speed            -> run "cat /etc/lilo.conf"

Got everything? Great! Check it again… ;-) And watch out that your serial speed is 57600 if you want to use my bootfloppy!

Backing up

Now it is time to boot up the rescue system. Use the web-frontend to get it. It may take a few minutes until you can type in “reboot” to fire it up. If you want to play it safe, I recommend that you backup the first bytes of /dev/hda, just in case you chicken out, or something goes wrong with the floppy image:

dd if=/dev/hda of=harddiskbootimage.img bs=1k count=1440

Copy this image via scp to a save location.

Booting OpenBSD

Now it is time to boot up the rescue system. Use the web-frontend to get it. It may take a few minutes until you can type in “reboot” to fire it up. Anyhow, after it is done, you can write the image of an installation floppy directly to the harddisk. FOR THE IMPATIENT ONES: Use my floppyimage. ALL THE OTHERS: I will tell you later how to build up your own.

If you want to use my image, you can type in:

wget -O- http://www.dettus.net/floppy35_seriell.fs.gz | gzip -d -f >/dev/hda

(Its MD5sum is: 1cde7d54182efdfd2fdcfd9b5905ba28)

All your other stuff will be lost on your harddrive. But who needs it anyway? ;) (If anything goes wrong, you can still replace the first bytes by the backup you made.)

Boot your computer in normal mode now, and it will show you the familiar OpenBSD bootprompt. While the kernel boots, you will see a lot of broken characters, but don’t worry, it will drop you off at the famous “(U)pgrade, (I)nstall or (S)hell” prompt.

Testing the network

First of all, use the shell to setup all the network information you have written down. In my case, the netmask was wrong (255.255.255.255) so I ran into some trouble when I tried to setup up the default route. Don’t worry about this, just set it to the 255.255.255.0-value, and everything works out fine. Leave the shell and choose “(I)nstall”.

Installing

Installing OpenBSD is straightforward, I recommend using the whole harddisk for it. Read http://www.openbsd.org/faq4 for more information, if you like. Use the network information you have written down (and verified *g*) and choose (f)tp as installation medium. Choose whatever package you like, and install it over the net. (This costs traffic, you know?) And wait. And choose your Timezone. BUT DON’T REBOOT YET!

Setting up OpenBSD for a serial console

After you have installed everything, and the devices are set up, change to /mnt/etc and create a file called “boot.conf”:

echo "set tty com0" >>/mnt/etc/boot.conf
echo "stty com0 57600" >>/mnt/etc/boot.conf

This will boot up and all the standard output will pe written to the serial console. The next part is a bit tricky: You have to activate the serial console for a login. And you will have to use “ed” for that.

ed /mnt/etc/ttys

Type in numbers to jump through all the lines in the file. Type “1″ and press Enter to go to the first, type “2″ to go to the second and so on. Line “19″ contained the following entry at my installation:

 tty00   "/usr/libexec/getty std.9600"   unknown off

You have to change this. Use the “c” command for that, and type in

tty00   "/usr/libexec/getty std.57600"  vt220   on  secure

Press Enter and CTRL-D to exit the change mode. Then use “w” to write the file and “q” to get out of this editor. Other ed commands are “.” to show the contents of the actual line, and “d” to delete a line. Well, better then nothing! Use “cat /mnt/etc/ttys” to check if the file is broken. If not… hooray!

Rebooting your system

After all this trouble you have bin through, you are finally able to reboot your freshly handcrafted OpenBSD-Box. Just type in “reboot”, and you’ll be set.

Setting up your netmask correctly (No guarantee and Strato-specific)

After booting up you may want to be able to reach all the users in your subnet which is impossible if you still have the /24-netmask. You actually need the /32 netmask at strato! So what Kili did was to write the following stuff into hostname.fxp0:

inet 81.169.133.xxx 0xffffffff
!route add 81.169.132.1 -link $if: -interface

and the router (81.169.132.1)

81.169.132.1

went into /etc/mygate. Replace 81.169.133.xxx with your ip-address and 81.169.132.1 with your routers. And done!

Have fun!

APPENDIX A: Setting up your own bootfloppy

As I told you before here are some tips for making your own bootfloppy: Some of them are quite hazardous, and could be done in a much more proper way. Anyhow, this is how I did it:

The simple way

Theoretically it is enough if you download the floppy35.fs from your favourite OpenBSD-mirror and set up a file /etc/boot.conf on it. To do this, mount it:

vnconfig svnd0 floppy35_serial.fs
mount /dev/svnd0a /mnt

create a directory /etc:

mkdir /mnt/etc

and setup a file called “boot.conf” in it:

echo "set tty com0" >/mnt/etc/boot.conf
echo "stty com0 57600" >>/mnt/etc/boot.conf

unmount it:

umount /mnt
vnconfig -u svnd0

If you don’t have any operating system at had which is able to read the OpenBSD filesystem, just use the bootdisk itself. Simply boot your computer up with it, whether directly or in VMWare. Choose S)hell, and then type

mount /dev/fd0c /mnt
mkdir /mnt/etc
echo "set tty com0" >/mnt/etc/boot.conf
echo "stty com0 57600" >>/mnt/etc/boot.conf
umount /mnt

to get the same effect.

And now write it into your bootsector as described in the “Booting OpenBSD” section. I don’t know if this works, I did it the complicated way. If it’s not working for you, keep reading!

Get src.tar.gz and sys.tar.gz

You need a running installation of OpenBSD at home for this. Get both the src.tar.gz and sys.tar.gz packages for this. Install them to /usr/src and /usr/src/sys.

Configuring the Kernel

Go to /usr/src/sry/arch/i386/conf and copy the RAMDISK config to RAMDISK.orig. Edit RAMDISK after that (I know, I know…). Comment out the following devices:
pckbc0, pckbd* wskbd*, vga0, vga*, pcdisplay0, wsdisplay*, wsdisplay*. That way you make sure that booting the floppy will print out as much as possible on the serial console. NAnT told me, that you also need the option PCIBIOS_INTR_FIXUP_FORCE in your kernel, if you are running into problems with some fxp0 timeout messages.

Compiling Crunch

Crunch is a tool needed for the creation of the bootdisks. Go to the directory /usr/src/distrib/crunch and run

make ; make install

Editing the miniroot partition.

Go to /usr/src/distrib/miniroot, and create a file called “boot.conf” with the following entries:

set tty com0
stty com0 57600

(The number “57600″ is the baudrate of the serial console, it should match the value that you have written down from /etc/lilo.conf on your rootserver!) Make sure that boot.conf gets onto your disk: Edit the file located in the /usr/src/distrib/i386 directory, called “common”. Find the line with “protocols” and duplicate it. After that replace “protocols” with “boot.conf” in one of them.

Compilation

Now it is time to build the bootfloppy:

cd /usr/src/distrib/i386/ramdiskA
make

When everything works smoothly, you’ll have a file called “floppy35.fs” at your hands. If it complains about some missing “.c”-files, it could be because those files are located somewhere beneath “/usr/src/sys” in the kernel sources. Find them and copy them to where the compilation failed. Re-run make. When it’s done, move the “floppy35.fs” file to “floppy35_serial.fs” or something so that you won’t be confused.

Mount your floppy

Mount your bootfloppy.

vnconfig svnd0 floppy35_serial.fs
mount /dev/svnd0a /mnt

and copy /usr/src/distrib/miniroot/boot.conf to /mnt/etc/boot.conf

mkdir /mnt/etc
cp /usr/src/distrib/miniroot/boot.conf

and unmount the imagefile

umount /mnt
vnconfig -u svnd0

And your bootfloppy is ready!!! Write it onto the harddrive in your rootserver like I mentioned before.

Have fun with your OpenBSD at Strato!

Note: Again: If you keep getting a “fxp0: device timeout” and you are not able to get your network running, try compiling the kernel with “PCIBIOS_INTR_FIXUP_FORCE”. (Thank you Markus and Marcus for that hint)

Speak Your Mind

*