LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Multiboot of Slackware Linux with DragonFly BSD and OpenBSD on UEFI (https://www.linuxquestions.org/questions/slackware-14/multiboot-of-slackware-linux-with-dragonfly-bsd-and-openbsd-on-uefi-4175676620/)

tramni1980 06-06-2020 01:13 PM

Multiboot of Slackware Linux with DragonFly BSD and OpenBSD on UEFI
 
Dear all,

multiboot installation of a BSD system with other operating systems
(OSs) on UEFI hardware is not officially supported by any of the popular
BSDs. Because of the general interest in this topic, here I would like
to share my experience of running DragonFly BSD, OpenBSD, and Slackware
Linux on an UEFI ASUS laptop. The only boot manager you need is
rEFInd.

Preliminaries

As each OS is going to reside on its own hard drive slice,
the first step of setting your system for multiboot is slicing the hard
drive. In general, if you want to multiboot n OSs, you would need n + 1
slices. The extra slice is for the EFI system partition (ESP). Of
course, you have to make sure each partition is large enough for the OS that is
going to reside on it. As mentioned, in this post I share my experience
with installing DragonFly, OpenBSD, and Slackware Linux. I sliced the hard
drive from DragonFly, which I have exemplarily described in the
DragonFly documentation on multiboot. Of course, you will slice the hard drive from the first OS that you are going
to install. In the above link to the DragonFly documentation, I have also
described how the ESP is to be set up. The installation of OpenBSD is described
in this post. Therefore, in the following I assume your first OS has already been installed
in its slice, rEFInd has been installed in the ESP, and I only consider the
specifics of the Slackware installation.

Installation of Slackware Linux

After booting with the installation media, use gdisk make the Linux partition
of type 8300 or 8e00 in case you use LVM. After creating your LVM partitions,
you can type setup and proceed with the Slackware installation. Install
neither lilo nor elilo. At the end of the installation do not reboot but
change to shell. Chroot to /mnt, create the initrd image, mount the ESP, create
a Slackware directory under EFI/BOOT in the ESP and copy the generic-kernel
image and the initrd to EFI/BOOT/Slackware. Assuming the Slackware partition is
nvme0n1p4 as on my system, run

Code:

blkid nvme0n1p4
to obtain the UUID and PARTUUID. These are to be used at the
'volume' and 'options' entries of refind.conf, respectively.
Add the following entry to refind.conf:

Code:

menuentry "Slackware" {
  icon /EFI/BOOT/icons/os_slackware.png
  volume the-UUID-from-blkid
  loader /EFI/BOOT/Slackware/vmlinuz-generic-kernel_version
  options "ro root=PARTUUID=the-PARTUUID-from-blkid"
  initrd /EFI/BOOT/Slackware/initrd-kernel_version.gz
}

Reboot and have fun!

Best regards,

Martin

hitest 06-06-2020 01:17 PM

Very cool! Thanks for sharing. :cool:

Regnad Kcin 06-06-2020 06:03 PM

Quote:

The only boot manager you need is
rEFInd.
It's the only one I need.

rkelsen 06-06-2020 08:58 PM

Quote:

Originally Posted by tramni1980 (Post 6131565)
I sliced the hard drive from DragonFly, which I have exemplarily described in the
DragonFly documentation on multiboot. Of course, you will slice the hard drive from the first OS that you are going to install. In the above link to the DragonFly documentation, I have also described how the ESP is to be set up. The installation of OpenBSD is described
in this post. Therefore, in the following I assume your first OS has already been installed in its slice, rEFInd has been installed in the ESP, and I only consider the specifics of the Slackware installation.

Many thanks for your efforts in this area.

I've been following DragonFlyBSD for the past few years, but have only ever tried it in a Virtualbox VM.

Those instructions for manual installation are most welcome, and will be studied inside & out as I try to wrap my head around the process. :)

The laptop I'm installing it on already has rEFInd on it, dual booting Windows and Slackware Linux. At this point, I could probably ditch Windows since I never use it, but it isn't taking that much space and it might serve some purpose one day.

After shrinking the Windows partition back when I first bought the laptop, I set up more partitions than necessary with the thought that one of them would house a *BSD one day... and that day looks like it's here.

Given that the EFI partition is already set up, and the spare partition is ready to use I gather it's a matter of tweaking these instructions:
Quote:

Create the DragonFly slice of, say 200 GiB:

# gpt -v show nvme0 gpt add -i 1 -s 419430400 -t dfly nvme0

Label the DragonFly slice:

# gpt label -i 1 -l "DragonFly BSD" nvme0

Now you can create your disklabel partitions on the DragonFly slice. Normally, you want a disk layout consisting of an "a" partition for /boot, a "b" partition for swap and a "d" partition for the root file system.
Is it simply a matter of:
1. changing the partition/slice type
2. labelling the DragonFly slice
3. creating the disklabel and then following the rest of the instructions.

Can I use the gpt command to change the partition/slice type to "dfly"?

To label the slice, would I need to modify the command above by changing 'nvme0' to something like 'nvme0s3'?

I greatly appreciate any comments, hits & tips.

tramni1980 06-07-2020 01:06 AM

Quote:

Originally Posted by rkelsen (Post 6131649)
The laptop I'm installing it on already has rEFInd on it, dual booting Windows and Slackware Linux. At this point, I could probably ditch Windows since I never use it, but it isn't taking that much space and it might serve some purpose one day.

After shrinking the Windows partition back when I first bought the laptop, I set up more partitions than necessary with the thought that one of them would house a *BSD one day... and that day looks like it's here.

Given that the EFI partition is already set up, and the spare partition is ready to use I gather it's a matter of tweaking these instructions:

Is it simply a matter of:
1. changing the partition/slice type
2. labelling the DragonFly slice
3. creating the disklabel and then following the rest of the instructions.

Exactly. But your ESP is still not completely set up, you need to copy the DragonFly BSD's boot code (/boot/boot1.efi ) to the EFI/BOOT under your ESP as described in the DragonFly documentation and add a DragonFly BSD entry to refind.conf.
I would also like to note that while one can slice the hard drive from one OS to prepare the slices for the other OSs, setting the slice type for each OS may have to be done later from that OS. For example, from DragonFly BSD it is not possible to set the slice type of the OpenBSD partition to A6; you have to do that from OpenBSD after booting the OpenBSD install medium; from Slackware's gdisk it might be possible to set a slice type to A6 for OpenBSD or dfly for DragonFly, but I do not know. With DragonFly BSD, so long as I know, there is no way to change the slice type after the slice has been created. Therefore, just leave some space for your DragonFly slice. Then, after booting the DragonFly install medium, create the slice with type dfly. For example, if
Code:

gpt -v show -l nvme0
shows you already have slices 0 (ESP), 1 (Windows), and 2 (Slackware), then you should create a slice with number 3 for DragonFly like this:

Code:

gpt add -i 3 -s 419430400 -t dfly nvme0
gpt label -i 3 -l "DragonFly BSD" nvme0

Quote:

Originally Posted by rkelsen (Post 6131649)
Can I use the gpt command to change the partition/slice type to "dfly"?

As I mentioned above, so long as I know you cannot change the type of an existing slice in DragonFly. You will have to either create a new slice for DragonFly using the DragonFly install medium or delete the existing slice and create it again with the desired type. Actually, for DragonFly I think setting the slice type to dfly is not crucial when installing manually. Maybe you can just skip setting the slice type and proceed making the disklabel partitions. However, I have not tested this. You are welcome to try and share your experience with us :-).

Quote:

Originally Posted by rkelsen (Post 6131649)
To label the slice, would I need to modify the command above by changing 'nvme0' to something like 'nvme0s3'?

No, no. nvme0 is just a parameter to gpt that points to the hard drive whose slices are being edited. It is the -i parameter that specifies which slice gpt has to modify. So, if you want to label slice number 3 on nvme0, you should issue

Code:

gpt label -i 3 -l "DragonFly BSD" nvme0
nvme0s3 is the third slice on the nvme0 drive. The gpt command needs nvme0 supplied as disk drive parameter and slice number 3 supplied via the -i parameter.

Quote:

Originally Posted by rkelsen (Post 6131649)
I greatly appreciate any comments, hits & tips.

You are welcome.

Cheers,
Martin

rkelsen 06-07-2020 02:28 AM

Thank you sir! I'll have a go at some point over the next week or so and will report back. :)

tramni1980 06-07-2020 12:31 PM

Quote:

Originally Posted by rkelsen (Post 6131684)
Thank you sir! I'll have a go at some point over the next week or so and will report back. :)

Wow, "sir" :-) No need to be that formal :) I come from Eastern Europe and we don't have such titles there ;-)

I would be happy to get your feedback.

Cheers,
Martin


All times are GMT -5. The time now is 12:53 AM.