[FAQ Index] [To Section 8 - General Questions] [To Section 10 - System Management]

9 - Migrating to OpenBSD

Table of Contents

9.1 - Tips for users of other Unix-like operating systems

While OpenBSD is a very traditional Unix-like operating system and will be very familiar to those who have used other Unix-like systems, there are important differences. New users to OpenBSD must look at their own experience: if your only knowledge of Unix is some experience with one variant of Linux, you may find OpenBSD "strange." Rest assured, Linux looks pretty strange to anyone who starts from OpenBSD. You must recognize the difference between "standard" and your experience.

If you learned Unix from any of the good books on general Unix, understanding the "Unix philosophy" and then extending your knowledge to a particular platform, you will find OpenBSD to be a very "true" and familiar Unix. If you learned Unix using a "type this to do that" process or a book such as "Learn PinkBeenie v8.3 in 31.4 Hours" and told yourself you "know" Unix, you will most likely find OpenBSD very different.

One important difference between OpenBSD and many other operating systems is the documentation. OpenBSD developers take great pride in the system man pages. The man pages are the authoritative source of OpenBSD documentation -- not this FAQ, not third-party independently maintained pages, not "howto" guides, etc. When a developer makes a change to the system, they are expected to update the man pages along with their change to the system code, not "later" or "when they get around to it" or "when someone complains." A manual page exists for virtually every program, utility, driver, configuration file, and so on on the stock system. It is expected that a user will check the man pages before asking for help on the mailing lists.

Here are some of the commonly encountered differences between OpenBSD and other Unix variants.

9.2 - Dual booting Linux and OpenBSD (amd64/i386)

Multibooting is not trivial, and it requires an understanding of ALL the operating systems you wish to have coexist on the machine. The GRUB loader commonly used with Linux can boot OpenBSD as a generic operating system. From time to time, GRUB tries to natively handle OpenBSD booting -- using this feature is NOT recommended, as there is no coordination with OpenBSD development. As such, this feature is often broken, and there's really no need for it. Just use OpenBSD's boot code, and what GRUB terms "chain loading" to invoke it.

A GRUB entry which could boot OpenBSD installed on the second MBR partition (partition "1" in OpenBSD's fdisk) might look like:

menuentry "OpenBSD" {
	set root=(hd0,2)
	chainloader +1
Your milage will vary.

9.3 - Converting your Linux (or other Sixth Edition-style) password file to BSD-style

First, figure out if your Linux password file is shadowed or not. If it is, install John the Ripper from packages or ports (security/john) and use the "unshadow" utility that comes with it to merge your passwd and shadow files into one Sixth Edition-style file.

Using your Linux password file, we'll call it linux_passwd, you need to add in ::0:0 between fields four and seven. awk(1) does this for you.

# awk -F : '{printf("%s:%s:%s:%s::0:0:%s:%s:%s\n", \
> $1,$2,$3,$4,$5,$6,$7); }' linux_passwd > new_passwd
At this point, you want to edit the new_passwd file and remove the root and other system entries that are already present in your OpenBSD password file or aren't applicable with OpenBSD (all of them). Also, make sure there are no duplicate usernames or user IDs between new_passwd and your OpenBSD box's /etc/passwd. The easiest way to do this is to start with a fresh /etc/passwd.
# cat new_passwd >> /etc/master.passwd
# pwd_mkdb -p /etc/master.passwd
The last step, pwd_mkdb is necessary to rebuild the /etc/spwd.db and /etc/pwd.db files. It also creates a Sixth Edition-style password file (minus encrypted passwords) at /etc/passwd for programs which use it. OpenBSD uses a stronger encryption for passwords, blowfish, which is very unlikely to be found on any system which uses full Sixth Edition-style password files. To switch over to this stronger encryption, simply have the users run passwd and change their password. The new password they enter will be encrypted with your default setting (usually blowfish unless you've edited /etc/login.conf). Or, as root, you can run passwd username.

9.4 - Running Linux binaries on OpenBSD

OpenBSD/i386 is able to run Linux binaries when the kernel is compiled with the COMPAT_LINUX option and the runtime sysctl kern.emul.linux is also set. If you are using the GENERIC kernel (which you should be), COMPAT_LINUX is already enabled, and you will just need to do:
# sysctl kern.emul.linux=1
For this to be done automatically each time the computer boots, add it to /etc/sysctl.conf.
#  echo 'kern.emul.linux=1' >> /etc/sysctl.conf
Reboot your system to have it take effect.

To run any Linux binaries that are not statically linked (most of them), you need to follow the instructions in the compat_linux(8) manual page.

A simple way to get most of the useful Linux libraries is to install the fedora/base package from your nearest mirror. To find out more about the packages and ports system read FAQ 15 - The OpenBSD Packages and Ports System. To install the above mentioned package, you would issue these commands:

# export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
# pkg_add fedora_base
Note that pkg_add(1) will automatically execute sysctl to set kern.emul.linux to the correct value upon adding this package. However, it does not change /etc/sysctl.conf, so if you want Linux emulation to be enabled by default, you need to set kern.emul.linux there.

9.5 - Accessing your Linux files from OpenBSD

OpenBSD supports the EXT2 file system for read/write, and can read EXT4. For further information, see FAQ 14.

[FAQ Index] [To Section 8 - General Questions] [To Section 10 - System Management]