diff options
| author | Will Fancher <elvishjerricco@gmail.com> | 2024-08-12 23:33:59 -0400 |
|---|---|---|
| committer | Will Fancher <elvishjerricco@gmail.com> | 2024-08-12 23:35:01 -0400 |
| commit | 208e953381d3677962af934bdae2014236f60f01 (patch) | |
| tree | 5bbdda7e4eff4a0997b7e219b5919810cd302a7a /pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch | |
| parent | d74d1829916fa421faee82fe7d46922cc5617f5a (diff) | |
systemd-stage-1: Fully merge `/bin` and `/sbin`
In #327506, we stopped using `/sbin` in the `pathsToLink` of `initrdBinEnv`. This inadvertantly stopped including the `sbin` directory of the `initrdBin` packages, which meant that things like `mdadm`'s udev rules, which referred to binaries by their `sbin` paths, stopped working.
The purpose of #327506 was to fix the fact that `mount` was not calling mount helpers like `mount.ext4` unless they happened to be in `/sbin`. But this raised some questions for me, because I thought we set `managerEnvironment.PATH` to help util-linux find helpers for both `mount` and `fsck`. So I decided to look at how this works in stage 2 to figure it out, and it's a little cursed.
---
What I already knew is that we have [this](https://github.com/NixOS/nixpkgs/blob/696a4e3758e9892cd784a185b7e5f03e5637ecbd/nixos/modules/system/boot/systemd.nix#L624-L625)
```
# util-linux is needed for the main fsck utility wrapping the fs-specific ones
PATH = lib.makeBinPath (config.system.fsPackages ++ [cfg.package.util-linux]);
```
And I thought this was how `mount` finds the mount helpers. But if that were true, then `mount` should be finding helpers in stage 1 because of [this](https://github.com/NixOS/nixpkgs/blob/696a4e3758e9892cd784a185b7e5f03e5637ecbd/nixos/modules/system/boot/systemd/initrd.nix#L411)
```
managerEnvironment.PATH = "/bin";
```
Turns out, `mount` _actually_ finds helpers with [this configure flag](https://github.com/NixOS/nixpkgs/blob/696a4e3758e9892cd784a185b7e5f03e5637ecbd/pkgs/os-specific/linux/util-linux/default.nix#L59)
```
"--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin"
```
Ok... so then why do we need the PATH? Because `fsck` has [this](https://github.com/util-linux/util-linux/blob/a75c7a102e5dc3408ce8603a8722ba24f589971c/disk-utils/fsck.c#L1659)
```
fsck_path = xstrdup(path && *path ? path : FSCK_DEFAULT_PATH);
```
(`path` is `getenv("PATH")`)
So, tl;dr, `mount` and `fsck` have completely unrelated search paths for their helper programs
For `mount`, we have to use a configure flag to point to `/run/current-system`, and for `fsck` we can just set PATH
---
So, for systemd stage 1, we *do* want to include packages' `sbin` paths, because of the `mdadm` problem. But for `mount`, we need helpers to be on the search path, and right now that means putting it somewhere in `/run/wrappers/bin:/run/current-system/sw/bin:/sbin`.
Diffstat (limited to 'pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch')
0 files changed, 0 insertions, 0 deletions
