nixpkgs/nixos/modules
Thomas Watson af25692214 nixos/stage-1: Examine binaries for libraries in a consistent order
To reduce size, stage 1 (the initrd) is populated by copying specific
binaries in, then copying the libraries specifically needed by those
binaries. `patchelf` is then used to make the binaries search in the
directory where these libraries are copied to instead of their original
store paths.

Some filesystems (e.g. ZFS) do not guarantee that copying the same files
in the same order into a given directory will result in `find` returning
them in any particular order (though the order appears consistent so
long as the directory is not modified).

Therefore, when the binaries are scanned for libraries to copy in, they
might be scanned in a different order each time the derivation is built.
If two binaries need two different libraries with the same name, then a
different instance of the library might be copied in first, changing the
derivation contents and breaking reproducibility.

This turns out to be the case with `libudev.so.1` from both `systemd`
(needed by e.g. `mdadm`) and `systemdMinimal` (needed by e.g.
`dmsetup`). This issue is fixed by sorting the list of binaries to be
scanned instead of relying on filesystem order so that the same instance
always gets seen and copied first.

Both before this change (at least on ext4) and after this change
(without any options that affect stage 1), this is the `libudev.so.1`
from `systemdMinimal` by way of `dmsetup`. Whether this is appropriate
and how much the two different systemd configurations and udev libraries
need to be involved is a topic left for future work.
2022-12-20 08:24:19 +01:00
..
config Merge pull request #206441 from SuperSandro2000/msmtp 2022-12-19 22:28:07 +01:00
hardware nixos: fix typos 2022-12-17 19:31:14 -05:00
i18n/input-method nixos/*: convert internal option descriptions to MD 2022-08-31 16:32:54 +02:00
installer nixos: fix typos 2022-12-17 19:31:14 -05:00
misc Merge pull request #206709 from SuperSandro2000/mandb-misc 2022-12-19 17:55:46 +02:00
profiles nixos/modules/profiles/base.nix: add nvme-cli 2022-12-13 15:35:05 +00:00
programs Merge pull request #206645 from Mic92/nix-ld 2022-12-19 16:26:02 +00:00
security nixos: fix typos 2022-12-17 19:31:14 -05:00
services Merge pull request #172084 from priegger/prometheus-statsd-exporter 2022-12-19 23:16:02 +01:00
system nixos/stage-1: Examine binaries for libraries in a consistent order 2022-12-20 08:24:19 +01:00
tasks lib.replaceChars: warn about being a deprecated alias 2022-12-15 22:25:51 +02:00
testing nixos/*: convert internal option descriptions to MD 2022-08-31 16:32:54 +02:00
virtualisation nixos: fix typos 2022-12-17 19:31:14 -05:00
module-list.nix nixos/mmsd: init 2022-12-17 17:36:43 +01:00
rename.nix dd-agent: remove 2022-09-14 14:11:14 +02:00