lanzaboote/rust/tool/systemd/tests
Alois Wohlschlager 4fd37670e2
tool: stop most overwriting in the ESP
Since most files (stubs, kernels and initrds) on the ESP are properly
input-addressed or content-addressed now, there is no point in
overwriting them any more. Hence we detect what generations are already
properly installed, and don't reinstall them any more.

This approach leads to two distinct improvements:
* Rollbacks are more reliable, because initrd secrets and stubs do not
  change any more for existing generations (with the necessary exception
  of stubs in case of signature key rotation). In particular, the risk
  of a newer stub breaking (for example, because of bad interactions
  with certain firmware) old and previously working generations is
  avoided.
* Kernels and initrds that are not going to be (re)installed anyway are
  not read and hashed any more. This significantly reduces the I/O and
  CPU time required for the installation process, particularly when
  there is a large number of generations.

The following drawbacks are noted:
* The first time installation is performed after these changes, most of
  the ESP is re-written at a different path; as a result, the disk usage
  increases to roughly the double until the GC is performed.
* If multiple generations share a bare initrd, but have different
  secrets scripts, the final initrds will now be separated, leading to
  increased disk usage. However, this situation should be rare, and the
  previous behavior was arguably incorrect anyway.
* If the files on the ESP are corrupted, running the installation again
  will not overwrite them with the correct versions. Since the files are
  written atomically, this situation should not happen except in case of
  file system corruption, and it is questionable whether overwriting
  really fixes the problem in this case.
2023-10-04 07:29:21 +02:00
..
common tool: make stubs input-addressed 2023-10-03 22:08:10 +02:00
fixtures/uefi-keys tool: split systemd into a new crate and make tool into a lib-only crate 2023-09-14 11:55:09 +02:00
gc.rs tool: make kernels and initrds content-addressed 2023-10-03 22:08:03 +02:00
install.rs tool: stop most overwriting in the ESP 2023-10-04 07:29:21 +02:00
os_release.rs tool: make stubs input-addressed 2023-10-03 22:08:10 +02:00
systemd_boot.rs test: clean up a few minor details 2023-09-14 16:35:53 +02:00