You are not logged in.

#1 2022-04-05 11:32:49

Somerandomnerd
Member
Registered: 2022-01-25
Posts: 21

Systemd-boot on btrfs /boot

Hi all, I've already checked the arch wiki on this, but there seems to be no solution. I want to move from grub to systemd-boot, but I have /boot as just a folder on my root btrfs partition. The arch wiki claims that systemd-boot can boot from any file system your BIOS recognises, but how do I add drivers/whatever for btrfs to systemd-boot? Should I have made another /boot partition when installing anyway?

(my ESP is on /efi)

Edit: I forgot to mention, systemd-boot only detect Windows 10 on my disk, and not the Arch partition.

Last edited by Somerandomnerd (2022-04-05 11:34:04)

Offline

#2 2022-04-05 14:26:20

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,480

Re: Systemd-boot on btrfs /boot

You can't, you need to use GRUB or refind for this if you want btrfs support. You could create another FAT partition and mount that to /boot if you don't want to reuse the ESP directly, but you need to make it adhere to the extended boot loader spec: https://wiki.archlinux.org/title/System … g_XBOOTLDR

Last edited by V1del (2022-04-05 14:29:59)

Online

#3 2022-04-05 14:27:32

Manix
Member
Registered: 2021-04-17
Posts: 80

Re: Systemd-boot on btrfs /boot

Hi,

did you add "rootflags=subvol=@" in your systemd-boot input options?

a "bootctl status" output would be welcome.


I don't love rosbeef

Offline

#4 2022-04-05 15:10:58

Somerandomnerd
Member
Registered: 2022-01-25
Posts: 21

Re: Systemd-boot on btrfs /boot

loader.conf

#timeout 3
#console-mode keep

default  arch.conf
timeout  4
console-mode max
editor   no

arch.conf

title   Arch Linux
linux   /vmlinuz-linux-lts
initrd  /intel-ucode.img
initrd  /initramfs-linux-lts.img
options root=UUID=930ff009-8fb5-4422-a745-c51e8f98072b zswap.enabled=0 loglevel=3 rootflags=subvol=@ rw

sudo bootctl status

System:
     Firmware: n/a (n/a)
  Secure Boot: disabled (unknown)
 TPM2 Support: yes
 Boot into FW: supported

Current Boot Loader:
      Product: n/a
     Features: ✗ Boot counting
               ✗ Menu timeout control
               ✗ One-shot menu timeout control
               ✗ Default entry control
               ✗ One-shot entry control
               ✗ Support for XBOOTLDR partition
               ✗ Support for passing random seed to OS
               ✗ Load drop-in drivers
               ✗ Boot loader sets ESP information
          ESP: n/a
         File: └─n/a

Random Seed:
 Passed to OS: no
 System Token: set
       Exists: yes

Available Boot Loaders on ESP:
          ESP: /efi (/dev/disk/by-partuuid/97ec61d0-6cc7-4a87-9d8c-7513345ae61d)
         File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot 250.4-2.1-arch)
         File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot 250.4-2.1-arch)
         File: └─/EFI/BOOT/BOOTIA32.EFI

Boot Loaders Listed in EFI Variables:
        Title: arch
           ID: 0x0000
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/97ec61d0-6cc7-4a87-9d8c-7513345ae61d
         File: └─/EFI/arch/grubx64.efi

        Title: Linux Boot Manager
           ID: 0x0002
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/97ec61d0-6cc7-4a87-9d8c-7513345ae61d
         File: └─/EFI/systemd/systemd-bootx64.efi

        Title: rEFInd Boot Manager
           ID: 0x0003
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/97ec61d0-6cc7-4a87-9d8c-7513345ae61d
         File: └─/EFI/refind/refind_x64.efi

        Title: Windows Boot Manager
           ID: 0x0001
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/97ec61d0-6cc7-4a87-9d8c-7513345ae61d
         File: └─/EFI/Microsoft/Boot/bootmgfw.efi

Boot Loader Entries:
        $BOOT: /efi (/dev/disk/by-partuuid/97ec61d0-6cc7-4a87-9d8c-7513345ae61d)

Default Boot Loader Entry:
        title: Arch Linux
           id: arch.conf
       source: /efi/loader/entries/arch.conf
        linux: /vmlinuz-linux-lts (No such file or directory)
       initrd: /intel-ucode.img (No such file or directory)
               /initramfs-linux-lts.img (No such file or directory)
      options: root=UUID=930ff009-8fb5-4422-a745-c51e8f98072b zswap.enabled=0 loglevel=3 rootflags=subvol=@ rw

WARNING: default boot entry is broken

I think the cause is that it should be @/vmlinuz instead of /vmlinuz and so forth... gonna try it

edit: does not work

Last edited by Somerandomnerd (2022-04-05 15:54:50)

Offline

#5 2022-04-05 15:39:54

Manix
Member
Registered: 2021-04-17
Posts: 80

Re: Systemd-boot on btrfs /boot

you have refind and systemd-boot, i think 1 bootloader would be enough.
moreover there is still a grub entry.

it looks like the linux images are not in the right place.

I have something like that, if it helps you:

bootctl status :

System:
     Firmware: UEFI 2.70 (American Megatrends 5.17)
  Secure Boot: disabled (setup)
 TPM2 Support: yes
 Boot into FW: supported

Current Boot Loader:
      Product: systemd-boot 250.4-2-arch
     Features: ✓ Boot counting
               ✓ Menu timeout control
               ✓ One-shot menu timeout control
               ✓ Default entry control
               ✓ One-shot entry control
               ✓ Support for XBOOTLDR partition
               ✓ Support for passing random seed to OS
               ✓ Load drop-in drivers
               ✓ Boot loader sets ESP information
          ESP: /dev/disk/by-partuuid/cf441c61-ed1f-40b5-93ef-a398aa9ab89b
         File: └─/EFI/SYSTEMD/SYSTEMD-BOOTX64.EFI

Random Seed:
 Passed to OS: yes
 System Token: set
       Exists: yes

Available Boot Loaders on ESP:
          ESP: /boot (/dev/disk/by-partuuid/cf441c61-ed1f-40b5-93ef-a398aa9ab89b)
         File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot 250.4-2-arch)
         File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot 250.4-2-arch)

Boot Loaders Listed in EFI Variables:
        Title: Linux Boot Manager
           ID: 0x0000
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/cf441c61-ed1f-40b5-93ef-a398aa9ab89b
         File: └─/EFI/SYSTEMD/SYSTEMD-BOOTX64.EFI

        Title: Windows Boot Manager
           ID: 0x0002
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/cf441c61-ed1f-40b5-93ef-a398aa9ab89b
         File: └─/EFI/MICROSOFT/BOOT/BOOTMGFW.EFI

Boot Loader Entries:
        $BOOT: /boot (/dev/disk/by-partuuid/cf441c61-ed1f-40b5-93ef-a398aa9ab89b)

Default Boot Loader Entry:
        title: Arch Linux
           id: arch.conf
       source: /boot/loader/entries/arch.conf
        linux: /vmlinuz-linux
       initrd: /amd-ucode.img
               /initramfs-linux.img
      options: root="LABEL=arch_os" rootflags=subvol=/@ audit=0 rw

lsblk :

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   2,7T  0 disk
└─sda1        8:1    0   2,7T  0 part /3to
nvme1n1     259:0    0 232,9G  0 disk
├─nvme1n1p1 259:2    0   512M  0 part /boot
├─nvme1n1p2 259:3    0     1G  0 part [SWAP]
└─nvme1n1p3 259:4    0 231,4G  0 part /var/log
                                      /home
                                      /.snapshots
                                      /
nvme0n1     259:1    0 465,8G  0 disk
├─nvme0n1p1 259:5    0    16M  0 part
└─nvme0n1p2 259:6    0 465,7G  0 part

ls /boot :

total 153M
drwxr-xr-x 5 root root 4,0K  1 janv.  1970  ./
drwxr-xr-x 1 root root  170 23 déc.  16:54  ../
drwxr-xr-x 7 root root 4,0K 21 nov.  18:31  EFI/
drwxr-xr-x 3 root root 4,0K  5 avril 08:34  loader/
drwxr-xr-x 2 root root 4,0K 20 févr. 18:43 'System Volume Information'/
-rwxr-xr-x 1 root root  50K 11 mars  20:21  amd-ucode.img*
-rwxr-xr-x 1 root root  84M  3 avril 08:17  initramfs-linux-fallback.img*
-rwxr-xr-x 1 root root  60M  3 avril 08:17  initramfs-linux.img*
-rwxr-xr-x 1 root root  11M 29 mars  20:41  vmlinuz-linux*

ls /boot/EFI :

drwxr-xr-x 7 root root 4,0K 21 nov.  18:31 ./
drwxr-xr-x 5 root root 4,0K  1 janv.  1970 ../
drwxr-xr-x 2 root root 4,0K 21 nov.  18:32 arch_netboot/
drwxr-xr-x 2 root root 4,0K 18 mars  22:28 BOOT/
drwxr-xr-x 2 root root 4,0K 18 nov.  10:56 Linux/
drwxr-xr-x 4 root root 4,0K 25 déc.  12:20 Microsoft/
drwxr-xr-x 2 root root 4,0K 18 mars  22:28 systemd/

I don't love rosbeef

Offline

#6 2022-04-05 16:01:08

Somerandomnerd
Member
Registered: 2022-01-25
Posts: 21

Re: Systemd-boot on btrfs /boot

you have refind and systemd-boot, i think 1 bootloader would be enough.
moreover there is still a grub entry.

I have refind in case grub doesn't work, and systemd-boot doesn't work so I am using grub to boot.

And to the rest of the message, I have ESP on /efi, but yeah, basically the same.

Offline

#7 2022-04-05 16:07:52

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,480

Re: Systemd-boot on btrfs /boot

Again. You can't make systemd-boot boot from a btrfs partition. The "drivers" in this case would need to be provided by your actual motherboard. You can either substitute your ESP for /boot and put everything there or create an additional FAT partition.

Online

#8 2022-04-05 16:08:30

Somerandomnerd
Member
Registered: 2022-01-25
Posts: 21

Re: Systemd-boot on btrfs /boot

Figured it out, systemd-boot can only see /efi as /. no other partition.

Guess I'll have to make seperate /boot if I want it to work :shrug:

Offline

#9 2022-04-05 16:09:13

Somerandomnerd
Member
Registered: 2022-01-25
Posts: 21

Re: Systemd-boot on btrfs /boot

You can't make systemd-boot boot from a btrfs partition. The "drivers" in this case would need to be provided by your actual motherboard

Alright, sorry for bothering you.

Offline

#10 2022-04-05 16:11:50

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,800

Re: Systemd-boot on btrfs /boot

What you read about it reading other filesystems means that it can load from the ESP or XBOOTLDR partitions with other filesystems. What you're trying isn't going to work.

Edit: wow, WAY too slow.

Last edited by Scimmia (2022-04-05 16:12:16)

Offline

#11 2022-04-05 16:13:31

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,800

Re: Systemd-boot on btrfs /boot

V1del wrote:

Again. You can't make systemd-boot boot from a btrfs partition. The "drivers" in this case would need to be provided by your actual motherboard. You can either substitute your ESP for /boot and put everything there or create an additional FAT partition.

That's actually not true anymore. As of systemd 250:

        * sd-boot gained support for automatically loading all EFI drivers
          placed in the /EFI/systemd/drivers/ subdirectory of the EFI System
          Partition (ESP). These drivers are loaded before the menu entries are
          loaded. This is useful e.g. to load additional file system drivers
          for the XBOOTLDR partition.

Offline

#12 2022-04-05 16:18:36

diyfan
Member
Registered: 2022-04-05
Posts: 15

Re: Systemd-boot on btrfs /boot

V1del wrote:

You can't, you need to use GRUB or refind for this if you want btrfs support. You could create another FAT partition and mount that to /boot if you don't want to reuse the ESP directly, but you need to make it adhere to the extended boot loader spec: https://wiki.archlinux.org/title/System … g_XBOOTLDR

But somehow I managed to run systemd-boot in a btrfs partition without XBOOTDLR.

Offline

#13 2022-04-05 16:20:11

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,800

Re: Systemd-boot on btrfs /boot

diyfan wrote:
V1del wrote:

You can't, you need to use GRUB or refind for this if you want btrfs support. You could create another FAT partition and mount that to /boot if you don't want to reuse the ESP directly, but you need to make it adhere to the extended boot loader spec: https://wiki.archlinux.org/title/System … g_XBOOTLDR

But somehow I managed to run systemd-boot in a btrfs partition without XBOOTDLR.

Oh? And where are your kenrel/initramfs?

Offline

#14 2022-04-05 16:42:12

Manix
Member
Registered: 2021-04-17
Posts: 80

Re: Systemd-boot on btrfs /boot

I don't know if it's possible:

- copy "microsoft" folder
- chroot
- uninstall refind and grub
- format /boot partition
- install systemd-boot
- generate linux image
- copy "microsoft" folder
- add the microsoft entry ? https://wiki.archlinux.org/title/System … om_Windows


I don't love rosbeef

Offline

#15 2022-04-08 12:21:21

diyfan
Member
Registered: 2022-04-05
Posts: 15

Re: Systemd-boot on btrfs /boot

Scimmia wrote:
diyfan wrote:
V1del wrote:

You can't, you need to use GRUB or refind for this if you want btrfs support. You could create another FAT partition and mount that to /boot if you don't want to reuse the ESP directly, but you need to make it adhere to the extended boot loader spec: https://wiki.archlinux.org/title/System … g_XBOOTLDR

But somehow I managed to run systemd-boot in a btrfs partition without XBOOTDLR.

Oh? And where are your kenrel/initramfs?

in /boot

and my ESP is in /efi

I had btrfs-progs installed, maybe that's why it worked for me

Offline

#16 2022-04-08 13:04:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,800

Re: Systemd-boot on btrfs /boot

diyfan wrote:
Scimmia wrote:
diyfan wrote:

But somehow I managed to run systemd-boot in a btrfs partition without XBOOTDLR.

Oh? And where are your kenrel/initramfs?

in /boot

and my ESP is in /efi

I had btrfs-progs installed, maybe that's why it worked for me

No, btrfs-progs has nothing to do with any of this.

There is no way for systemd-boot to be reading /boot on your btrfs root. It just doesn't work that way. If I had to guess, you're actually using grub or something.

Offline

#17 2022-04-10 13:50:07

brian001
Member
Registered: 2021-01-04
Posts: 10

Re: Systemd-boot on btrfs /boot

This should be possible. Has anyone tried it?

systemd version 250 introduced this in December 2021.

✓ Load drop-in drivers

Arch has a community package named efifs that adds the efi drivers from https://efi.akeo.ie/ to /usr/lib/efifs-aa64/ and from there you copy the ones you want to [efi partition]/EFI/systemd/drivers/ and they get automatically loaded.

I'd appreciate if anyone has any experience on this before I rearrange my partition scheme. Thanks.

If it works well, then the wiki needs an update!

Last edited by brian001 (2022-04-10 13:50:49)

Offline

#18 2022-04-10 14:08:44

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,480

Re: Systemd-boot on btrfs /boot

Well the stipulation that you'd need a XBOOTLDR marked partition still holds regardless. Not sure how well things will behave if you change the identifier for your root GUID: https://wiki.archlinux.org/title/System … g_XBOOTLDR , I'd guess from a linux perspective this shouldn't matter much, but don't have any hands on expereince.

Last edited by V1del (2022-04-10 14:09:31)

Online

#19 2022-04-10 15:38:46

brian001
Member
Registered: 2021-01-04
Posts: 10

Re: Systemd-boot on btrfs /boot

It's difficult to tell with almost no documentation of the new feature, but from glanicing through the git issues and commits I get the impression that XBOOTDLR is completely separate.

Right now I put my kernel and initrd on my FAT efi system partition with a LUKS encrypted ext4 root partition.

I would like to move to btrfs with encryption. What is the advantage of having kernels and initrds on a separate unencrypted btrfs partition rather than the ESP? Snapshots of the kernels?

Offline

#20 2022-04-10 18:01:43

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,480

Re: Systemd-boot on btrfs /boot

More fault resilience than FAT is my usual argument, you can trivially corrupt your FAT partition if you have e.g. a blackout after an update without an explicit sync. Fairly certain that no matter the driver, actual unencryption of a drive is still currently out of scope.

Regarding the "completely seperate" I don't get that impression at all. You still need to have a partition explicitly marked as such so that it is even considered to be loaded and looked at for entries, unless my reading comprehension is completely shot.

E.g. https://github.com/systemd/systemd/blob … 2488-L2497 there are entries added on the root dir (... in this case systemd-boot's root which is the ESP) and an additional line for explicitly checking XBOOTLDR partitions

Last edited by V1del (2022-04-10 18:04:58)

Online

#21 2022-04-11 13:05:37

brian001
Member
Registered: 2021-01-04
Posts: 10

Re: Systemd-boot on btrfs /boot

You might be right.

But I was thinking of a situation where I have a small unencrypted install of archlinux as an emergency recovery partition. I could put the kernel and initrd in /boot on that partition to keep it separate. If I format that partition as btrfs and then I reference that partition by UUID in a loader entry in systemd-boot, then it should work if the file system driver has been loaded. I wouldn't get the autodiscovery of using XBOOTLDR, but the partition would be self contained and I could load it from systemd-boot.

I guess I'll have to test it.

Edit: altho as an emergency recovery, it might be better to have the /boot on FAT so I could boot it directly from bios?

Last edited by brian001 (2022-04-11 13:13:36)

Offline

#22 2022-04-11 13:41:17

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,800

Re: Systemd-boot on btrfs /boot

AFAIK, systemd-boot has no way to "reference that partition".

Offline

#23 2022-04-11 13:42:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,480

Re: Systemd-boot on btrfs /boot

Not sure whether a loader entry allows to lookup arbitrary UUIDs. but for the case as you describe it I'd just try to set the XBOOTLDR GUID, AFAIK linux doesn't actually require that to be of a certain value.

Last edited by V1del (2022-04-11 13:49:24)

Online

#24 2022-04-11 14:17:46

brian001
Member
Registered: 2021-01-04
Posts: 10

Re: Systemd-boot on btrfs /boot

I see. So at this time, systemd-boot will only load a kernel from the ESP or the XBOOTLDR with their unique GUIDs.

And if you make a XBOOTLDR with a file system other than fat32, you gain some advantages, but you lose the ability to load directly from most efi bioses.

Last edited by brian001 (2022-04-11 14:20:56)

Offline

#25 2022-04-11 14:23:59

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,800

Re: Systemd-boot on btrfs /boot

brian001 wrote:

I see. So at this time, systemd-boot will only load a kernel from the ESP or the XBOOTLDR with their unique GUIDs.

Well, kind of. It's from the partition that systemd-boot is on or XBOOTLDR. Since the firmware's boot manager does reference things by PARTUUID, the partition systemd-boot is on doesn't technically have to be an ESP, but it generally is. Systems can also have more than 1 ESP, but systemd-boot won't load things from the ones it's not on.

Last edited by Scimmia (2022-04-11 14:33:00)

Offline

Board footer

Powered by FluxBB