rhboot / fwupdate

System firmware update support for UEFI machines
99 stars 47 forks source link

Discussion: Automatic ESP discovery/management of boot assets #97

Closed ikeydoherty closed 6 years ago

ikeydoherty commented 6 years ago

Following up on Richard's request to bring the G+ discussion to the tracker.

I would like to start a discussion around the packaging of assets in /boot, as well as dynamic discovery of where /boot really is.

Specifically, in Solus packaging, it is illegal for any package to ship files in /boot. For UEFI systems we automatically mount the ESP to /boot using the freedesktop bootloader specification (as we use systemd-boot), perform any updates, sync, and unmount again. With that said we'll automatically discover if /boot is actually mounted (i.e. getmntent) and leave it mounted if this is how the users system is configured.

In an ideal world, fwupdate would automatically discover the ESP, and as appropriate push the blobs (safely + sanely) into the ESP, respecting the various plagues of issues known to FAT on Linux (case ignorance, atomic writes, dangers of overwriting, requirement to sync) to facilitate integration with standard update procedures.

For an example of interacting with the freedesktop bootloader specification, please see the clr-boot-manager work. Note even in clr-boot-manager we still looked to see if the ESP was mounted at /boot (simple example) to locate a valid boot mount before falling back to var probing (because as we all know, firmware can and will suck.)

So in short, if approved, I'd like to implement:

Before I go gung-ho on writing code, I'd like to see a conversation around this so its either rejected/approved, but either way, everyone would at least be on the same page. Cheers!

coling commented 6 years ago

I've been pushing to adopt the freedesktop bootloader spec too. It's just... well, sensible! So I'd want ESP on /boot to be supported as a first class citizen too. It's certainly how I use and configure my system (although yet to push it as a distro default)

ArchangeGabriel commented 6 years ago

/boot as ESP is widely used on ArchLinux too (because systemd-boot notably), and this has been (and is still) causing issue with fwupdate. The 10 release changed things a bit here by allowing an ESP path to be specified at runtime (though not for the cleanup script), but ideally a correct detection of the ESP would be better. Note that they also are systems without ESP since without (U)EFI.

ArchangeGabriel commented 6 years ago

And indeed, /boot and the ESP might not be mounted at all, so we do not allow packages to ship files under /boot or in the ESP, so that currently people are required to manually move the fwupdate efi binary to its correct location.

superm1 commented 6 years ago

Thanks for the proposal and the offer to produce a patch series.

I'd be open to a patch like proposed by @ikeydoherty. This discussion has come up in the past and it's just looking for an implementer. Like @ArchangeGabriel mentioned there are distros that choose not to mount the ESP, so runtime is a better time to install the bootloader than packaging.

A few thoughts I would like to make sure are incorporated into this patch:

superm1 commented 6 years ago

@ikeydoherty any progress on this? If you don't think it's going to be for a while you'll get to it, I'd like to reassign this to fwupdate-12 milestone.

superm1 commented 6 years ago

fwupd master has merged fwupdate into itself and now will manage installation of fwupx64.efi on it's own. I'm going to close this issue for the fwupdate project. Please test the implementation on fwupd master and provide comments there if any problems.

joakim-tjernlund commented 6 years ago

As fwupd master has problems to upgrade Lenovo ThinkPad it would nice if fwupdate could support ESP mounted under /boot

ArchangeGabriel commented 6 years ago

@joakim-tjernlund It does. Any arbitrary path actually. Just read the doc.

joakim-tjernlund commented 6 years ago

hmm, then maybe sys-apps/fwupd-1.0.8 that bugs? I get some strange fault(cannot rember now) when trying to use 1.0.8

hughsie commented 6 years ago

@ikeydoherty fwupd > 1.1.0 copies things into the ESP at runtime rather than relying on the package manager to do it. I think that makes fwupd suitable for use in Solus now.