Bug#783990: efivarfs is a separate fs and needs moutning

Ian Jackson ijackson at chiark.greenend.org.uk
Fri Jul 16 17:06:05 BST 2021

Control: tags -1 + patch

Thorsten Glaser writes ("Re: Bug#783990: efivarfs is a separate fs and needs moutning"):
> /sys/firmware/efi does not exist for me.


> >> I suggest the following approach in mountkernfs:
> 1.	See if /sys/firmware/efi/efivars/somefile exists;
> 	if it does, it’s already mounted, and there’s
> 	nothing to do.

It turns out that the domount function in mount-functions.sh already
uses a utility called `mountpoint` to check if something is already
mounted, so I think it's probably best just to go with that.

> Is /sys/firmware/efi also a mountpoint, or is it a mere directory?
> Does it always contain an efivars subdirectory? (Though, if it
> doesn’t, we can’t create it anyway, I guess.)

On my EFI system, /sys/firmware is just a directory in /sys.  Likewise
/sys/firmware/efi.  Ie, the mountpoints are just /sys and
/sys/firmware/efi/efivars (and of course various other things in /sys
like /sys/fs/pstore or whatever).

Indeed, I don't think we can create the efivars subdir.

> Sure¹, but let’s hold out a bit, we need some fixed file within
> /sys/firmware/efi/efivars/ to test for… or see if it’s empty,
> depending. I might have a look at the kernel source if needed.

As I say, I don't think we need that.  I tested my patched script and
on my system it is silently idempotent.

Also, I looked in mjy /sys/firmware/efivars and OMG.  It's full of
crazy stuff with names coming from EFI0land and I don't think there
would be anything sensible to test in it.

>  I just switched all my systems from sid to bullseye to avoid
>   the latest TC decision, but I can just live-patch the file
>   in question.

Here you go, in diff format and also a file you can just run.  I
haven't rebooted with it (yet), but I did manually unmount the efivars
subdir and verify that the new mountkernfs script remounts it.

I notice that my added section is very similar to the pstore section
immediately above - and this happened without me copying it :-), which
gives me confidence.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mountkernfs-Mount-sys-firmware-efi-efivars-if-necess.patch
Type: application/octet-stream
Size: 1400 bytes
Desc: not available
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20210716/0a07b2e6/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mountkernfs.sh
Type: application/octet-stream
Size: 1821 bytes
Desc: not available
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20210716/0a07b2e6/attachment-0003.obj>
-------------- next part --------------

Ian Jackson <ijackson at chiark.greenend.org.uk>   These opinions are my own.  

Pronouns: they/he.  If I emailed you from @fyvzl.net or @evade.org.uk,
that is a private address which bypasses my fierce spamfilter.

More information about the Debian-init-diversity mailing list