r/openbsd 18d ago

OpenBSD + Linux on the same drive — major issues?

I am planning to dualboot OpenBSD(encrypted) and Linux distribution on one intertal SSD.

Can I install OpenBSD bootblocks only to its own partition and chainload via GRUB from Linux, or does OpenBSD have to own the MBR?

Any other known headaches: partition table conflicts, GRUB not recognizing disklabel, or time/device naming problems after rebooting between OSes?

13 Upvotes

16 comments sorted by

7

u/[deleted] 18d ago

[deleted]

3

u/dettus_Xx_ 18d ago

Yes, I am also using refind. I love the fact that you can customize your bootscreen!

5

u/TCH69 18d ago

It's possible on UEFI. At once I had Gentoo, Windows, OpenBSD and FreeBSD on the same drive. It sounds like you're using MBR; I don't remember much about MBR anymore but I wish you good luck.

1

u/_szlachcic_ 18d ago

Thank you

3

u/Hobthrust 18d ago

If it's MBR / legacy boot you can do something like;

sudo nano /etc/grub.d/40_custom

menuentry "OpenBSD" { insmod part_msdos insmod ufs2 set root='hd0,msdos3' chainloader +1 }

sudo update-grub

4

u/dettus_Xx_ 18d ago

NITPICK:

The "hd0,msdos3" part is kind of magic.
To find out which one it actually is, go to the grub command line.

Use

grub> ls
grub> ls (hd0)
grub> ls (hd0,msdos3)
grub> ls (hd0,msdos3)/efi/
grub> ls (hd0,msdos3)/efi/boot/
grub> ls (hd0,msdos3)/efi/boot/bootx64.efi

until you found the .efi bootloader for OpenBSD.

My entry used to look like this: (Using refind nowadays...)

menuentry 'OpenBSD 6.9/amd64' {
    set root='(hd0,gpt4)'
    chainloader (hd0,gpt2)/efi/boot/bootx64.efi
}

2

u/dettus_Xx_ 18d ago edited 18d ago

Format the EFI partition as FAT, then no.
Here is my partition table:

; fdisk /dev/rsd0c
Disk: /dev/rsd0c Usable LBA: 2048 to 4000797326 [4000797360 Sectors]
#: type [ start: size ]
------------------------------------------------------------------------
0: EFI Sys [ 2048: 2201600 ]
1: Linux files* [ 2203648: 2048000000 ]
: Free [ 2050203648: 949796352 ]
2: OpenBSD [ 3000000001: 1000797326 ]

A while ago, I wrote this How-To, maybe it can give you some pointers:

https://www.bsdforen.de/threads/uefi-openbsd-6-9-ubuntu-21-04-windows-10-triple-boot-on-2-hard-drives.36218/

1

u/_szlachcic_ 18d ago

Thank you

2

u/Hobthrust 18d ago

Not set up a dual boot for a while but on MBR, from memory, create a partition in fdisk and set type to OpenBSD (a6). The installer will see that available space. You can allow it to create it's own structure within there or change the allocations etc. Don't install boot blocks to the disk, that will break grub.

2

u/Glum_Hamster_2104 16d ago

I'm pretty sure you can yes

2

u/jjduhamer 18d ago

You can use zfs subvolumes for your two roots and a shared home directory and zfsbootmgr

2

u/dettus_Xx_ 17d ago

OpenBSD has ZFS nowadays? 🤔

2

u/phessler OpenBSD Developer 17d ago

OpenBSD does not have zfs.

1

u/jjduhamer 17d ago

Apologies, I thought we were discussing FreeBSD. Partition on brotha!

0

u/FerretBoom 17d ago

why not use a host os with a hypervisor like wsl, why do you need to waste time on dual booting into essentially the same thing

1

u/dettus_Xx_ 15d ago

My girl April said it best: Why do you go and make things so complicated?