| 20 Mar 2022 |
@elvishjerricco:matrix.org | Janne Heß: Mainly because it doesn't matter, unlike in actual NixOS | 20:16:38 |
@elvishjerricco:matrix.org | Before I had a lot of things working, it was way easier to just have /bin rather than having to go spelunking through /nix | 20:18:01 |
@elvishjerricco:matrix.org | when something gets wildly borked it's nice to have there | 20:18:15 |
@janne.hess:helsinki-systems.de | hmm, does the test work for you? | 20:18:16 |
@elvishjerricco:matrix.org | yes | 20:18:20 |
@janne.hess:helsinki-systems.de | interesting, so some local modification must be breaking it… | 20:18:32 |
@elvishjerricco:matrix.org | what's the breakage? | 20:18:41 |
@janne.hess:helsinki-systems.de | [FAILED] Failed to start Make File System on /dev/vda. | 20:18:56 |
@elvishjerricco:matrix.org | Uh oh | 20:19:17 |
@janne.hess:helsinki-systems.de | ummmm interesting | 20:19:33 |
@janne.hess:helsinki-systems.de | the modification that broke it was my Environment= stuff | 20:19:41 |
@elvishjerricco:matrix.org | Systemd needs to find mke2fs on PATH | 20:20:20 |
@elvishjerricco:matrix.org | Does setting Environment= override PATH even if you don't use it to set PATH? | 20:22:04 |
@elvishjerricco:matrix.org | Er, no, emergency.service uses it to set HOME=/root, and that doesn't break PATH in my emergency shell | 20:22:27 |
@janne.hess:helsinki-systems.de | ah yeah for some reason it sets PATH=:. I'll take a look at this later because it turns out the argument passing doesn't work :/ | 20:24:33 |
@elvishjerricco:matrix.org | Oh | 20:24:42 |
@elvishjerricco:matrix.org | I bet I know what's up with that | 20:24:47 |
@elvishjerricco:matrix.org | The code that converts services.foo.path to services.foo.environment.PATH | 20:25:16 |
@elvishjerricco:matrix.org | It's not conditional, so it'll always set it to empty | 20:25:29 |
@elvishjerricco:matrix.org | (and apparently incorrectly, as it does : :P) | 20:25:42 |
@janne.hess:helsinki-systems.de | ah because there is a default path in stage 2? | 20:25:47 |
@elvishjerricco:matrix.org | right | 20:25:54 |
@elvishjerricco:matrix.org | Yea so that's a bug | 20:26:05 |
@elvishjerricco:matrix.org | So we probably want to add the paths from DefaultEnvironment to the path -> PATH conversion | 20:28:09 |
@elvishjerricco:matrix.org | Or, hah, this probably works:
diff --git a/nixos/lib/systemd-lib.nix b/nixos/lib/systemd-lib.nix
index 3129fbe7bdb..4ee40f2fa08 100644
--- a/nixos/lib/systemd-lib.nix
+++ b/nixos/lib/systemd-lib.nix
@@ -332,7 +332,7 @@ in rec {
systemd
];
- initrdServiceConfig = mkServiceConfig [];
+ initrdServiceConfig = mkServiceConfig ["/"];
mountConfig = { config, ... }: {
config = {
| 20:29:27 |
@elvishjerricco:matrix.org | highly jank | 20:29:39 |
@janne.hess:helsinki-systems.de | oof | 20:30:05 |
@elvishjerricco:matrix.org | I'm going to take off again for a while. Let me know if you figure anything out | 20:30:39 |
@janne.hess:helsinki-systems.de | okay so about the PATH stuff: I came up with this:
diff --git a/nixos/lib/systemd-lib.nix b/nixos/lib/systemd-lib.nix
index 3129fbe7bdb..7850d5f4524 100644
--- a/nixos/lib/systemd-lib.nix
+++ b/nixos/lib/systemd-lib.nix
@@ -396,6 +396,12 @@ in rec {
text = commonUnitText def +
''
[Service]
+ ${concatMapStrings (n:
+ let s = optionalString (def.environment.${n} != null && n == "PATH" -> def.environment.${n} != ":")
+ (lib.traceValSeq "Environment=${builtins.toJSON "${n}=${def.environment.${n}}"}\n");
+ # systemd max line length is now 1MiB
+ # https://github.com/systemd/systemd/commit/e6dde451a51dc5aaa7f4d98d39b8fe735f73d2af
+ in if stringLength s >= 1048576 then throw "The value of the environment variable ‘${n}’ in systemd service ‘${name}.service’ is too long." else s) (attrNames def.environment)}
${attrsToSection def.serviceConfig}
'';
};
| 23:17:31 |
@janne.hess:helsinki-systems.de | about the serialization stuff: I spent some hours patching systemd and it works in theory now. This does however not work when we run stage-2-init.sh in between the systemd executions because there is a short time where the shell script is running and no systemd which causes systemd to miss signals, causing it to hang forever in bootup (sounds strange but makes sense when going into details I'm too tired to write down) | 23:19:11 |