Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 May 2020 23:30:47 +0200
From:      Per Hedeland <per@hedeland.org>
To:        salvatorembartolotta@libero.it
Cc:        questions@freebsd.org
Subject:   Re: rEFInd and _two_ FREEBSD systems on the same disk on the same UEFI laptop
Message-ID:  <ac6fd70d-eb35-dfa0-f5d4-7f256f74ae67@hedeland.org>
In-Reply-To: <1590634251.1341132.1590515827296@mail1.libero.it>
References:  <1590634251.1341132.1590515827296@mail1.libero.it>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2020-05-26 19:57, Salvatore Bartolotta via freebsd-questions wrote:
>
> Has anyone installed two BSD (say -RELEASE and -STABLE) on the same disk on the same UEFI machine using rEFInd?

Yes - I routinely have two different -RELEASE installs, and "upgrade"
by replacing the older one. Allows for quick switch-back when the new
version is b0rken, as well as easily finding the config tweaks that I
had forgotten when upgrading (since the complete previous version is
still available - and mounted).

> Setting up dual booting - Windows 10 and FreeBSD-whatever - via rEFInd is just a matter of bcdediting a path and copying the appropriate .efi files. (duh).
>
> The /boot/boot1.efi copied in \EFI\FreeBSD-STABLE does its job and loads the _first_ FreeBSD system, as says uefi(8).  What if I want to boot _another_ FreeBSD system on the _same_ GPT-partitioned disk?

The solution I use can also be found in uefi(8), but it's really ugly
- if anyone knows of a cleaner way, I'd be happy to learn about it.
Anyway, uefi(8) says:

     3.   boot1.efi searches partitions of type freebsd-ufs and
          freebsd-zfs for loader.efi. [...]

I.e. you can control which partition/install gets booted by making
sure that it's the only one that has a loader.efi file. So:

$ df
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/ada0p7  25389052 11405824 11952104    49%    /
devfs               1        1        0   100%    /dev
/dev/ada0p6  25389052 22339544  1018384    96%    /oldroot
/dev/ada0p9 127953980 67120872 50596792    57%    /local
fdescfs             1        1        0   100%    /dev/fd
procfs              4        4        0   100%    /proc

$ ls {/oldroot,}/boot/loader.efi*
/boot/loader.efi                        /oldroot/boot/loader.efi.dontuse

Switching amounts to

# mv /oldroot/boot/loader.efi.dontuse /oldroot/boot/loader.efi
# mv /boot/loader.efi /boot/loader.efi.dontuse
# reboot

(You can get away with using .dontuse on only one of them if you trust
that the search order will always be the same, and you can remember
what it is.)

I *said* it was ugly...:-) I haven't looked into any of the stuff you
discuss below (which seems nice) - my (quite possibly incorrect)
understanding is that FreeBSD's boot1.efi has to be loaded from the
"EFI system partition", meaning that e.g. rEFInd is out of the picture
for selection between FreeBSD partitions/installs.

--Per

> Specifying the GUID of the partition in the menuentry stanza i.e.
> ...
> volume GPTGUID
> loader boot/boot1.efi
> ....
>
> isn't enough and does not work(TM).
>
> I suppose rEFInd_x64.efi can't access the second system without an appropriate ufs driver.  There are, indeed, drivers for linux filesystems (ext2, ext4, etc.) in the rEFInd directory.  And FreeBSD?
>
> How am I supposed to solve the problem _within_ FreeBSD with rEFInd?
>
> My apologies for the crazy/mad question and many thanks in advance for your help, pointers, suggestions.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ac6fd70d-eb35-dfa0-f5d4-7f256f74ae67>