UEFI & OpenBSD 6.9 & Ubuntu 21.04 & Windows 10 Triple boot on 2 hard drives

dettus

Bicycle User
Hello!
So, I am posting this in English, since I googled A LOT to find it. I am sure there are other people out there with the same problem.

I have a special setup! My computer has 2 hard drives, and I wanted to install 3 operating systems. So why Dual Boot when you can TRIPLE BOOT?
I was also forced to use UEFI (Damn you Ubuntu 21.04), luckily this is no longer a problem for my favorite OS, OpenBSD 6.9. And because I like playing StarCraft 2, I needed a Windows 10 as well.

Here it goes...
First of all: NO BACKUP, NO MERCY!
Secondly: The order of installing the Operating systems is important. Mine was Windows, OpenBSD, Ubuntu.

Windows got the first hard drive, (actually nvme).
OpenBSD got the first 50% of the second drive, Ubuntu the second 50%.

For the impatient ones: This is what it looks like from the Ubuntu point of view in the end.

Code:
% fdisk /dev/nvme0n1
 
..
Command (m for help): p
...
Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048     206847     204800   100M EFI System
/dev/nvme0n1p2     206848     239615      32768    16M Microsoft reserved
/dev/nvme0n1p3     239616 1999364205 1999124590 953,3G Microsoft basic data
/dev/nvme0n1p4 1999366144 2000406527    1040384   508M Windows recovery environm
...
Command (m for help): q
...
% fdisk /dev/nvme1n1
...
Command (m for help): p
...
Device              Start        End    Sectors   Size Type
/dev/nvme1n1p2         64       1023        960   480K EFI System
/dev/nvme1n1p3 1000101124 2000409200 1000308077   477G Linux filesystem
/dev/nvme1n1p4       1024 1000101123 1000100100 476,9G OpenBSD data
...

Command (m for help): q
...

% cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'OpenBSD 6.9/amd64' {
    set root='(hd0,gpt4)'
    chainloader (hd0,gpt2)/efi/boot/bootx64.efi
}
% update-grub


STEP1: I started by doing a backup. (NO BACKUP, NO MERCY).


STEP 2: I used a different machine to create 3 USB drives for my 3 operating systems.
One for Windows: https://www.microsoft.com/en-us/software-download/
One for OpenBSD: https://ftp.openbsd.org/pub/OpenBSD/6.9/amd64/install69.img
One for Ubuntu: https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview

Creating the USB drive for the OpenBSD install works best on a Unix system:
Code:
% wget https://ftp.openbsd.org/pub/OpenBSD/6.9/amd64/install69.img
% dd if=install69.img of=/dev/XXXX bs=1M
For the other two, I used Windows.

STEP 3: I erased the first sector from my drives, to clear the partition table
Code:
% dd if=/dev/zero of=/dev/nvme0XXXX bs=1M count=16
% dd if=/dev/zero of=/dev/nvme1XXXX bs=1M count=16
Now there was no way back. Luckily, I had a backup ;)

STEP 4: I installed Windows. My BIOS required me to press F12 to see the boot options, I chose UEFI boot from the USB drive. I installed it on the first hard disk.

STEP 5: I booted the OpenBSD stick. At the prompt, I chose (S)hell.
Code:
# cd /dev/
# sh MAKEDEV sd1
# fdisk -e /dev/rsd1c
I set up the partions. In the following order: 0, 1, 3, 2
Code:
0: unused
1: type EF. From 64-960
3: type A6. From 1024-1000100100
2: type 83. From 1000100124-end
The exit and (I)nstall. I used the OpenBSD partition.
To be honest: I am writing this one down from memory. If it does now work, I guess that starting the installation, choosing (WHOLE) when prompted, and Interrupting during the disklabel setup, and then doing an fdisk might also be an option.

The next time I booted using the boot options, I had a new UEFI entry which was giving me OpenBSD. NICE!

STEP 6: I installed Ubuntu. When asked about the partitioning, I chose "Something else" and was LUCKY THAT Ubuntu used the Windows-UEFI-Partition for its bootloader.
The GRUB bootloader was able to find Windows on its own. I rebooted twice: Once to see if Linux was booting. Once to see if windows was booting, and if I could select which one using GRUB menu.

STEP 7: I had to figure out which harddrive the OpenBSD efi bootloader was on.
So when the grub screen showed up, I pressed (c) for command line options.
Code:
grub> ls
Which showed me some partitions. Since I installed the OpenBSD efi loader on partition 1 and OpenBSD on partition 3, I was able to find what i needed on (hd0,gpt2) and (hd0,gpt4).
Code:
grub> ls (hd0,gpt2)/efi/boot
bootx64.efi ...
grub> ls (hd0,gpt4)/
bsd bsd.rd ...
I tried it out, using
Code:
grub> set root='(hd0,gpt4)'
grub> chainloader (hd0,gpt2)/efi/boot/bootx64.efi
grub> boot
And it booted!

STEP 8: I rebooted into Linux, and updated grub. More precisely /etc/grub.d/40_custom. This is what it looked like afterwards:

Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'OpenBSD 6.9/amd64' {
    set root='(hd0,gpt4)'
    chainloader (hd0,gpt2)/efi/boot/bootx64.efi
}

All that was left now was running

Code:
% update-grub
(I ignored the warnings about those extra partitions. )
So now, at boot time, I can choose any of my three Operating systems.

Keywords: Tutorial. Tripe Boot. Dual Boot. Grub. UEFI. OpenBSD. Linux. Ubuntu. Windows.
 
Wir haben ja auch ein schönes Wiki hier, vielleicht magst du das auch dort einpflegen? Wobei ich nicht weiß wie die Regeln sind, eigentlich ist es ja ein "deutsches Wiki". Ich persönlich finde die Idee HowTos und Tuts auf englisch zu schreiben auch meist besser da man mehr Leute erreicht.

Wenns dir mit Win nur um SC2 geht hättest du dir das sparen können, das läuft (wie alle Blizzard Games) sehr gut mit Wine und Ubuntu hast du ja. Vorausgesetzt natürlich dein Ubuntu erkennt die HW ordentlich.
 
Sehr Offtopic, aber dennoch eine ernst gemeinte Frage: Warum Dualboot? Warum Tripleboot? Boote das Betriebssystem deiner Wahl und virtualisiere den Rest. Gibt es Gründe?
 
Gutes Tutorial. Ich wünschte das hätte ich vor einem 1 Jahr gehabt ... :)
Ich vorgestern auch ;)


Sehr Offtopic, aber dennoch eine ernst gemeinte Frage: Warum Dualboot? Warum Tripleboot? Boote das Betriebssystem deiner Wahl und virtualisiere den Rest. Gibt es Gründe?
OpenBSD auf dem Desktop hat einfach einen hohen Coolness-Faktor.
Und ich brauche unter Windows und Linux vollen Zugriff auf die Hardware, deswegen kann ich die nicht einfach in eine VM verschieben. Und moege diese noch so gut sein.
 
Ich kann nur für mich sprechen aber es gibt halt ein paar Sachen (bei mir ist's Videoschnitt und Netflix&Co) die Linux benötigen. Und das Windows war vorinstalliert und mir eigentlich egal. Bei mir gings um reine Machbarkeit: 3 Betriebssysteme auf einer Platte.
 
Ich vorgestern auch ;)



OpenBSD auf dem Desktop hat einfach einen hohen Coolness-Faktor.
Und ich brauche unter Windows und Linux vollen Zugriff auf die Hardware, deswegen kann ich die nicht einfach in eine VM verschieben. Und moege diese noch so gut sein.
Wunderbar, danke für die Erläuterung. :)
 
Anfänger :D:D:D
Ich habe hier einen UEFI Quadrupel-Boot. Allerdings habe ich GRUB noch nie verstanden, deshalb mache ich das immer mit rEFInd als Bootloader.
Normalerweise würde es dann reichen, wenn man auf der EFI, von der man bootet, alle Bootloader in Unterverzeichnisse legt und dann bei rEFInd einbindet. Aber leider gibt es einige OS, die dann die jeweilige / Partition nicht finden (ja, ich meine Dich, FreeBSD).
Da muss man dann eine EFI Partition auf der Platte mit / haben und von dort den Bootloader einbinden.
 
Allerdings habe ich GRUB noch nie verstanden
dito.
Allerdings war mir der Beitrag eben doch bei einem ganz anderen Problem durchaus hilfreich. Es bot zwar nicht die Lösung, aber immerhin schubste es mich dorthin. (Nur kurz: ich hatte ein laufendes GNU/Linux "kopiert", aber auf neue Dateisysteme gelegt. Dass sich die UUIDs damit ändern: klar. Mein System-Dateisystem sollte aber BTRFS sein (mit Komprimierung, aber manuell erstellt) und das hatte mich doch etwas überfordert und ich wusste nicht weiter und nicht, wo der Fehler lag.)
 
Hallo,

auch ich habe ein Triple-Boot, Windows 10, Slackware 14.2 und OpenBSD 6.9, allerdings auf einer Festplatte in mehreren Partitionen mit einer EFI Partition; wenn ich bald Zeit und Lust habe, werde ich noch auf dem Thinkpad X260 einen Hackintosh in einer weiteren Partiton installieren.
Mein "boot manager" ist "rEFInd"; funktioniert bestens und wird auch im Manual zu OpenBSD empfohlen
 
Zurück
Oben