LinkedIn Sourceforge

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

Having several BSD boot on same machine

Posted on 2020-03-10 22:31:00 from Vincent in OpenBSD

I would like to re-run DragonflyBSD on my laptop where OpenBSD is running. So I'll explain how I've setup a multi-boot system.


Introduction

There are several possibilities to run multiples OS on the same machine. Virtual Machines are clearly the current trend. The other option is to dedicate each disks to an OS.

In this page, I will explain how I've done a dual boot on my laptop in order to have both OpenBSD and DragonflyBSD using exactly the same Hardware resources. Moreover , this will remind me my old days playing with Linux. This was the time with Daniel Robbins and Alan Cox. Alan Cox was rewarded at Fosdem in 2004, I was there :-)

Requirements

I plan to have a boot loader able to manage the different systems. My initial idea was to have grub.
To do that, I'm forced to install a mini linux distro. Indeed, grub is no more present in the ports. It was only for i386 machines.

Which linux system of today is simple enough for a BSD person like me, who have not touch Linux since about 10 years ?

After some research I found Alpine Linux. This sounds quite close to BSD and very small foot print on a machine. It's worth to mention that since 2017 they provide, by default, an hardened linux kernel. And most important, they do not rely on systemd !!. I'm not against Systemd, but I do not know it; and I do not want to learn it. And, I was looking for a Linux distribution as close as possible as BSD machines. Alpine Linux use OpenRC.

Install Alpine Linux

Since my machine already runs OpenBSD, and I do not want to remove or erase it, I've fully backuped this OpenBSD system with cpio and store all those files on my NAS.

As a primarily task, I need to split my disk into 3 primary partitions. I did it with the USB disk on which I have the installation set of OpenBSD. After having boot on this USB disk (with OpenBSD), I escape the shell and use usual tools to partition my disk. For Linux I allocate 10GB, the rest was split between OpenBSD and DragonflyBSD (115GB each). I remind that partition ID are "83" for Linux, "A6" for OpenBSD and "A5" for Freebsd (the same as for DragonflyBSD).

That done, I plug the USB disk where the installation set of Alpine Linux is copied.

The installation process is not very different than what we have in OpenBSD.

You can find details on their website: installation

In short, what I did is:

  • download the iso file and out it on a USB disk
  • boot the machine on with this USB
  • login as "root" (no password at this stage)
  • trigger the "setup-alpine" script and you will get usual installation's questions
  • select keyboard type
  • define an hostname
  • confirm network interface (I was connected via cable and dhcp)
  • create a root password
  • select the timezone
  • chose the ntp client (I've chosen openntp)
  • then type "f" to select the fastest package's repository
  • I select "openssh" for the ssh server (I was not aware that others exist :-) )
  • select the disk (previously created)
  • confirm the installation
  • reboot

All in all, it take less that 10 minutes.

Once rebooted, I suggest you to update it with the 2 following commands

apk update
apk upgrade

And Voila. We have a running linux system with several standard commands around the kernel. But no man pages !!!!. Quite frustrating, but, I suppose because their minimalism objective, you do not have "man" command.

This installation process is very similar to what we know on OpenBSD.

Configure Alpine boot software

What is interesting, it that Alpine Linux does not come with Grub, but with extlinux, a Syslinux variant to boot Linux. And this tool will perform the job perfectly. No need to install grub.

I've adapted the file /boot/extlinux.conf, like this

DEFAULT menu.c32
PROMPT 0
MENU TITLE Boot Menu
MENU AUTOBOOT Alpine will be booted automatically in # seconds.
TIMEOUT 80
LABEL vanilla
  MENU LABEL Linux vanilla
  LINUX /boot/vmlinuz-vanilla
  INITRD /boot/initramfs-vanilla
  APPEND root=UUID=bc697041-d225-437f-8045-10233c313ad3 modules=sd-mod,usb-storage,ext4 nomodeset quiet rootfstype=ext4
# added by Vincent
LABEL Openbsd
  COM32 chain.c32
  APPEND hd0 2
LABEL DragonFlyBSD
  COM32 chain.c32
  APPEND hd0 3
MENU SEPARATOR

As you guess, I've added the 2 LABEL entries with their respective chain boot loader. "hd0" is my disk's name and the next parameter is the partition number (starting from 1).

To install this information into the boot process, we have the execute the following command.

extlinux --install /boot

WARNING: Copy immediately /boot/extlinux.conf file into /boot/extlinux.conf_bkp.
Indeed, after an "apt upgrade" the fine /boot/extlinux.conf will be overwriten.

This boot system present you a blue screen with you 3 operating system.
With the config here above, Linux will start automatically after 8 seconds.
With the cursor, you can select the 2nd line and hit enter to start OpenBSD.

Install BSD

Then I just have to re-install OpenBSD and restore my backups and to install DragonflyBSD.

But those steps are the subject of this page

Conclusion

Alpine Linux is a very tiny and do not require lot of effort to manage for a person coming from OpenBSD like me.

The whole boot process of Alpine linux is hyper fast. It takes less than 3 seconds to have my login prompt when I've not network cable connected (thus without network setup). With the cable connected, it takes 15 seconds in total to have the login prompt.
In Alpine Linux, the "update" and "upgrade" process are amazingly fast too.

Via few "apk add", I've been able to have openbox, xterm and firefox. Do not forget to also add xorg-server.

But most importantly, I'm now able to dual boot OpenBSD and DragonflyBSD (or any other operating system)



47, 48
displayed: 8431



What is the last letter of the word Python?