github gitlab mastodon email rss
DragonFlyBSD - UEFI dual boot with Linux

In order to install DragonFlyBSD on a UEFI machine one might want to keep the already installed operating system, in my case Arch Linux, leading to what people usually call dual boot.

I won’t describe the DragonFlyBSD installation process, I might in a following article, but just what’s required before and what needs to be done after to get it to boot.

Prerequisites

So before installing I had a working Linux installation and I’m using the UEFI boot manager from my laptop (an HP Elitebook), to boot it. This is the result of running the efibootmgr command prior to installing DragonFlyBSD.

sudo efibootmgr -v
BootCurrent: 0011
Timeout: 0 seconds
BootOrder: 000D,0011,0012,000E,000B,000C,0012,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000F,000A
Boot0000  Startup Menu	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)....ISPH
[...]
Boot0011* Arch Linux	HD(1,GPT,be65cb5c-c9ba-4aae-aaa6-ab8670046434,0x800,0xb4000)/File(\EFI\arch\vmlinuz-linux)r.o.o.t.=.U.U.I.D.=.1.a.e.a.4.7.d.1.-.1.b.b.3.-.4.a.9.0.-.b.1.b.c.-.e.9.3.5.4.c.c.a.1.4.1.7. .r.w. .r.o.o.t.f.l.a.g.s.=.s.u.b.v.o.l.=.r.o.o.t. .l.u.k.s...u.u.i.d.=.4.4.7.3.9.d.f.0.-.7.6.0.5.-.4.5.e.1.-.a.b.3.0.-.e.b.2.e.7.d.4.f.0.0.c.8. .l.u.k.s...u.u.i.d.=.b.7.c.0.5.8.3.4.-.a.9.9.5.-.4.1.2.f.-.b.b.0.e.-.6.3.0.6.9.7.7.8.d.2.1.a. .r.e.s.u.m.e.=./.d.e.v./.m.a.p.p.e.r./.l.u.k.s.-.b.7.c.0.5.8.3.4.-.a.9.9.5.-.4.1.2.f.-.b.b.0.e.-.6.3.0.6.9.7.7.8.d.2.1.a. .i.n.t.e.l._.i.o.m.m.u.=.o.n. .i.n.i.t.r.d.=.\.E.F.I.\.a.r.c.h.\.i.n.t.e.l.-.u.c.o.d.e...i.m.g. .i.n.i.t.r.d.=.\.E.F.I.\.a.r.c.h.\.i.n.i.t.r.a.m.f.s.-.l.i.n.u.x...i.m.g. .q.u.i.e.t. .s.p.l.a.s.h.

In my case there’s a single SSD disk containing an EFI partition, a partition that will contain the DragonFlyBSD system, and 3 Linux partitions as shown below.

sudo fdisk -l /dev/sda
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Disk model: SanDisk SD7SN6S-
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5C10A881-F456-4FD3-815A-9A75BA2DBAAA

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    739327    737280   360M EFI System
/dev/sda2     739328 232022015 231282688 110.3G unknown
/dev/sda7  232022016 233046015   1024000   500M Linux filesystem
/dev/sda8  233046016 249300991  16254976   7.8G Linux filesystem
/dev/sda9  249300992 460738559 211437568 100.8G Linux filesystem

boot1.efi

When installing DragonFlyBSD the important part is to mount the EFI partition, and create a dfly directory in the already existing EFI directory and copy the file /boot/boot1.efi from the installation medium inside.

 
mkdir /mnt/efi
mount_msdos /dev/serno/IDOFMYDISK /mnt/efi
mkdir -p /mnt/efi/dfly
cp /boot/boot1.efi /mnt/efi/dfly/

Seen from the linux side that gives us the following (I mounted my efi partition /dev/sda1 into /mnt/efi) :

 
ls -l /mnt/efi/EFI/dfly
total 44
-r-xr-xr-x 1 root root 43107 Oct 26 17:35 boot1.efi

UEFI boot manager entry

And we will now create the appropriate entry in the UEFI bootloader, using the disk /dev/sda(adapt to your case), using the EFI partition (counted as 0 in gpt’s terms) giving it a lavel DragonFlyBSD (what the boot menu will show you) and using the efi file we copied earlier as the loader. Below is the command and the command used to check that everything is correctly setup.

sudo efibootmgr --disk /dev/sda --part 0 --create --gpt --label "DragonFlyBSD" --loader /EFI/DFLY/boot1.efi

sudo efibootmgr -v
BootCurrent: 0011
Timeout: 0 seconds
BootOrder: 000D,0011,0012,000E,000B,000C,0012,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000F,000A
Boot0000  Startup Menu	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)....ISPH
[...]
Boot0011* Arch Linux	HD(1,GPT,be65cb5c-c9ba-4aae-aaa6-ab8670046434,0x800,0xb4000)/File(\EFI\arch\vmlinuz-linux)r.o.o.t.=.U.U.I.D.=.1.a.e.a.4.7.d.1.-.1.b.b.3.-.4.a.9.0.-.b.1.b.c.-.e.9.3.5.4.c.c.a.1.4.1.7. .r.w. .r.o.o.t.f.l.a.g.s.=.s.u.b.v.o.l.=.r.o.o.t. .l.u.k.s...u.u.i.d.=.4.4.7.3.9.d.f.0.-.7.6.0.5.-.4.5.e.1.-.a.b.3.0.-.e.b.2.e.7.d.4.f.0.0.c.8. .l.u.k.s...u.u.i.d.=.b.7.c.0.5.8.3.4.-.a.9.9.5.-.4.1.2.f.-.b.b.0.e.-.6.3.0.6.9.7.7.8.d.2.1.a. .r.e.s.u.m.e.=./.d.e.v./.m.a.p.p.e.r./.l.u.k.s.-.b.7.c.0.5.8.3.4.-.a.9.9.5.-.4.1.2.f.-.b.b.0.e.-.6.3.0.6.9.7.7.8.d.2.1.a. .i.n.t.e.l._.i.o.m.m.u.=.o.n. .i.n.i.t.r.d.=.\.E.F.I.\.a.r.c.h.\.i.n.t.e.l.-.u.c.o.d.e...i.m.g. .i.n.i.t.r.d.=.\.E.F.I.\.a.r.c.h.\.i.n.i.t.r.a.m.f.s.-.l.i.n.u.x...i.m.g. .q.u.i.e.t. .s.p.l.a.s.h.
Boot0012* DragonFlyBSD	HD(1,GPT,be65cb5c-c9ba-4aae-aaa6-ab8670046434,0x800,0xb4000)/File(\EFI\DFLY\boot1.efi)

The last step is to reboot and use the UEFI boot manager (pressing F9 when seeing HP logo in my case), then select DragonFlyBSD to boot it.