[systemd-devel] howto switch from grub2-bios to systemd-boot

Lennart Poettering lennart at poettering.net
Mon Sep 7 15:47:08 UTC 2020


On So, 06.09.20 23:28, Alexander E. Patrakov (patrakov at gmail.com) wrote:

> > > But surely a boot loader of all things should never try to write to the
> > > place it is loading from? Booting should be idempotent (as long as it
> > > works, for sure). The only sane policy would seem to be that the loader
> > > had another path to a separate writable area?
> >
> > UEFI provides file system access. Both read and write. Typically for
> > VFAT. Yeah, a boot loader should not modify the files it is itself
> > loaded from and also keep writes generally at a minimum, but counting
> > boots is generally the absolute minimum necessary, and can be
> > implemented by single sector updates in file systems such as VFAT. So
> > that's what sd-boot for example does.
>
> May I know why this design has been chosen over keeping the boot
> counts in UEFI variables?

Quality of memory chips that back persistent UEFI variables is known
to be questionable sometimes, as is the implementation of the
allocation logic for it in many firmwares. OTOH disk storage is
assumed to be of higher quality than those NVRAMs backing UEFI
variables, and the fs drivers tend to be a bit better (since usually
copied from a reference implementation rather than written by OEMs for
the hw they build).

I think writing to persistent UEFI variables is probably OK if done at
install time, during reconfiguration and such, i.e. at exception,
singular times. But doing so regularly on every single boot is
probably something to avoid, but boot counting would require that.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list