You are not logged in.

#1 2018-04-29 04:07:58

jwhendy
Member
Registered: 2010-04-01
Posts: 621

[SOLVED] How one would use non-vfat filesystem with EFI?

I just got my first laptop that shipped with UEFI and Secure Boot by default. It's a work laptop, so I'm working within those constraints during my install of arch and ubuntu on a separate drive.

I'm following along with wiki on EFI System partition which says:

After creating the ESP, you must format it as FAT32

But on the rEFInd page, I also see this:

rEFInd has read-only drivers for ReiserFS, Ext2, Ext4, Btrfs, ISO-9660, HFS+, and NTFS.

The same appears supported by the list of bootloaders.

I followed the advice of using vfat, but didn't realize that links weren't possible. This is advantageous when one has versioned kernels; you can just maintain a link from something like arch-custom to arch-x.x.x.x. Recompiling doesn't require changing the boot menu. Now I'm two distro installs deep and thinking about this more and more and wonder if I really want to deal with this for the next three years of this laptop lease. I can either edit the boot menu each version change (granted, more of an issue on ubuntu than arch) or figure something else out.

I'd be happy to update the wiki with a strategy if someone suggests one. I find the advice conflicting at the moment. I think what might be suggested is something like:

- boot partition: mount to /boot, ext4
- esp partition: mount to /boot/efi, vfat
- system partition: btrfs in my case; /

I'm encrypted, so the bummer came when mounting my esp to /boot/efi and then realizing that the kernel and initramfs were in /boot which was part of my encrypted setup. When I reformatted boot to ext4, refind-install threw a warning that it must be vfat.

Thanks for any pointers.

Edit: is this really just about support to boot those filesystems?? It's late and now dawning on me that this is somehow purely about the support of a bootloader to load a root fs, not about what it can live on...

Last edited by jwhendy (2018-04-29 06:25:16)

Offline

#2 2018-04-29 04:14:22

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

Yes, your edit is correct.  The UEFI bios (or whatever it is called) can only read FAT filesystems.  However, assuming you install a bootloader that can support other file systems, then you can put the kernel on whatever filesystem your bootloader supports.  But the bootloader itself must be on FAT.

Offline

#3 2018-04-29 06:25:03

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

Awesome, thanks. Now I  have the connundrum of re-partitioning (and thus reinstalling) or trying to be a bit creative somehow about linking/alternatives (like a script).

Offline

#4 2018-04-29 07:33:06

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

Well, this is untrue on several levels. The UEFI can read an ESP with any filesystem formatting... assuming your UEFI has the filesystem drivers for it. Read the top of the linked wiki page...

Now, the UEFI spec only mandates support for fat, which is a different issue. But e.g. Apple extends their UEFI with HFS+ drivers, also there is for example https://github.com/pbatard/efifs

...

A separate issue is what actually has to be on the ESP at all. Only the EFI executable which is being loaded by the UEFI firmware needs to be on the ESP. systemd-boot, refind, and grub need to be on the ESP, in other words. From there, the EFI executable in question can load its own filesystem drivers to boot a kernel on ext4, btrfs, xfs, and many others... which refind and grub implement. Whereas systemd-boot only supports loading the kernel from the ESP.

If you use systemd-boot, you need to mount the fat formatted ESP as /boot and install the kernel there. Or you could use a different bootloader.

If you want to use encrypted boot, you need grub. Of course, one could also ask whether you're properly making use of encrypted boot by keeping your ESP on a secured and trusted flashdrive independent of your computer. Otherwise there is really no point to the endeavor.

...

Note: my preferred boot setup uses a 2MB fat12 partition for my ESP, which is just large enough to contain the grub bootloader binary. It loads everything from my btrfs root filesystem. Needless to say, my /boot is not formatted with fat32. smile

fat12 is in the UEFI spec, and you need it to create a partition that small.

Last edited by eschwartz (2018-04-29 07:39:20)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2018-04-29 15:46:20

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

@Eschwartz... I'll try to follow along! I admit that this all feels quite like swimming in the deep end on my first go.

- where would one check if the UEFI has filesystem drivers for it? By "vendor," I interpret this to mean that HP would have had to include such drivers at the hardware level?
- Your second comment about "From there, the EFI executale ..." would still suggest that the ESP = vfat with /boot = other. Is that accurate?

Unless I hear a way to change all of /boot to, say, ext4 and have rEFInd exist on it... I think my pursuit will be what it sounds like you do:
- /boot: ext4 (holds my kernel images and initrds)
- /boot/efi: vfat (holds rEFInd .efi files)

Let me know if this sounds reasonable. Thanks!

Offline

#6 2018-04-29 16:00:33

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

Yes, the vendor would have to provide drivers for it, yes, you should use vfat unless you already know your vendor (HP apparently) supports something else, which they almost certainly don't, and yes, this setup sounds reasonable.

...

EFI filesystem drivers can be baked into the UEFI firmware, or you could use efifs drivers which obviously require being loaded from some filesystem the builtin UEFI firmware can read which is a bit of a chicken-and-egg problem.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2018-04-29 20:13:38

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

For others finding this, it worked! There were a couple gotchas. Here's the setup and corresponding rEFInd entry I ended up with:

$ mount
/dev/nvme0n1p2 on /boot type ext4
/dev/nvme0n1p1 on /boot/efi type vfat
menuentry "arch" {
    icon         /EFI/refind/icons/os_arch.png
    volume       BOOT_PARTUUID
    loader       /vmlinuz-linux
    initrd       /initramfs-linux.img
    options      "luks.uuid=DEVICE_UUID root=UUID=MAPPER_UUID rootflags=compress=lzo,discard,ssd,subvol=arch luks.options=discard add_efi_memmap rw"
}

The id's are from blkid
- BOOT_PARTUUID: output for PARTUUID of the /boot partition (not esp)
- DEVICE_UUID: partition UUID itself
- MAPPER_UUID: UUID assigned to the opened crypt device (e.g. /dev/mapper/root)

One gotcha... I think that the volume entry changes the relative root of everything that follows. Originally, I had volume first, then the icon line in the stanza. I thought maybe since it was pointing to /boot, I needed to modify the icon path to /efi/EFI/..., but that also didn't work. I ended up just moving it up one and it worked! I think rEFInd might be loading icons relative to it's own path first (esp) and then switching to the device specified by volume. I'm still a little confused on that little hangup, but it works so I'm happy.

Hope this helps someone, and I'm happy I can link kernels again. Thanks all!

Last edited by jwhendy (2018-04-30 15:40:10)

Offline

#8 2018-04-30 10:41:29

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 592

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

jwhendy wrote:

One gotcha... I think that the volume entry changes the relative root of everything that follows. Originally, I had volume first, then the icon line in the stanza. I thought maybe since it was pointing to /boot, I needed to modify the icon path to /efi/EFI/..., but that also didn't work. I ended up just moving it up one and it worked! I think rEFInd might be loading icons relative to it's own path first (esp) and then switching to the device specified by volume. I'm still a little confused on that little hangup, but it works so I'm happy.

Your observation is correct, "volume" by default is the volume from which rEFInd is launched, but once you set the "volume" in the boot stanza all subsequent paths are relative to the new "volume". Since the icons are on the ESP you must specify "volume" after "icon".

Are you sure you posted the correct boot stanza? Since you have a separate /boot partition, why is your kernel specified as "/boot/vmlinuz-linux" instead of "/vmlinuz-linux"?
Also there is no such thing as "luks.allow=discards", see https://wiki.archlinux.org/index.php/Dm … _.28SSD.29 .

Offline

#9 2018-04-30 15:49:28

jwhendy
Member
Registered: 2010-04-01
Posts: 621

Re: [SOLVED] How one would use non-vfat filesystem with EFI?

@nl6720:

- thanks for the clarification on how the volumes change
- good catch on /boot/foo and sorry about that. I was taking notes and that was an intermediate troubleshooting step based on some examples I'd seen. When it worked, I got excited and pasted here but it wasn't the correct version (fixed above)
- wow... I've been using that discards line for a loonnng time and it appears to be a bad interpretation of "luks.allow-discards", which appears to be real. I fixed above to avoid someone inadvertently copying the bad line.

Last edited by jwhendy (2018-04-30 15:50:19)

Offline

Board footer

Powered by FluxBB