| 24 Mar 2022 |
flokli | Download 0001-systemd-initrd-systemd-lib-drop-initrdServiceToUnit.patch | 17:58:29 |
flokli | This did it for me. Test still succeeds | 17:58:37 |
@janne.hess:helsinki-systems.de | In reply to @elvishjerricco:matrix.org
The service initrd-parse-etc.service scans /sysroot/etc/fstab for a possible /usr/ mount point and additional entries marked with the x-initrd.mount option. All entries found are mounted below /sysroot, and initrd-fs.target is reached hmmm not sure if that's what I want | 17:59:17 |
@janne.hess:helsinki-systems.de | I'm currently doing:
${pkgs.busybox}/bin/mount --bind /run /sysroot/run
${pkgs.busybox}/bin/chroot /sysroot $closure/systemd-activation
${pkgs.busybox}/bin/umount /sysroot/run
| 17:59:46 |
@janne.hess:helsinki-systems.de | (which doesn't work) | 17:59:50 |
@janne.hess:helsinki-systems.de | (probably because systemd mounts a new /run fs) | 18:00:11 |
@elvishjerricco:matrix.org | flokli: Oh wait | 18:00:47 |
@elvishjerricco:matrix.org | No there is a difference | 18:00:51 |
@elvishjerricco:matrix.org | hold on | 18:00:56 |
flokli | holding | 18:01:13 |
@elvishjerricco:matrix.org | flokli: The main difference is that it only uses def.environment, not globalEnvironment | 18:04:30 |
@elvishjerricco:matrix.org | Though I guess that shouldn't matter much? Just adds a TZ thing and a LOCALE_ARCHIVE thing. As long as we aren't copying those closures in we're good, they'll just be broken env variables | 18:05:17 |
flokli | TZDIR is just set to /etc/zoneinfo, which I think we don't populate | 18:07:51 |
flokli | LOCALE_ARCHIVE… we might /want/ to eventually provide some UTF-8 locales in initrd, even if it's just C.UTF-8 | 18:09:00 |
flokli | Mostly thinking around fancy escape sequences in interactive prompts, not garbling when entering cryptsetup passwords with funky characters, … | 18:09:41 |
flokli | But yeah, this is something we might want to test anyways | 18:11:33 |
@elvishjerricco:matrix.org | Just make sure the initrd size doesn't increase I guess :P | 18:12:45 |
flokli | I don't think it'll cause harm to have it point into the void. We might eventually later realize we need to provide these files, but I don't think right now it matters much if these env vars are set or not | 18:12:45 |
flokli | How do I do that? | 18:13:04 |
@elvishjerricco:matrix.org | Just build config.system.build.initialRamdisk before and after the change and compare sizes | 18:15:36 |
flokli | Like
❯ nix-build nixos/tests/systemd-initrd-simple.nix -A nodes.machine.config.system.build.initialRamdisk
error: the expression selected by the selection path 'nodes.machine.config.system.build.initialRamdisk' should be a set but is a function
?
| 18:17:13 |
@elvishjerricco:matrix.org | I dunno if there's a smarter way to do it, but I've just been testing with this file:
import ./nixos { configuration = { lib, config, pkgs, ... }: {
imports = [./nixos/modules/virtualisation/qemu-vm.nix];
boot.initrd.systemd = {
enable = true;
emergencyHashedPassword = "";
# additionalUpstreamUnits = ["cryptsetup.target"];
# package = pkgs.systemdMinimal.override { withCryptsetup = true; };
# services.foo = {
# wantedBy = ["initrd.target"];
# after = ["local-fs.target"];
# before = ["initrd.target" "initrd-cleanup.service"];
# serviceConfig.ExecStart = "/bin/systemctl emergency";
# serviceConfig.Type = "oneshot";
# };
};
virtualisation = {
graphics = false;
memorySize = 8192;
cores = 4;
};
documentation.enable = false;
services.getty.autologinUser = "root";
}; }
| 18:18:33 |
@elvishjerricco:matrix.org | * I dunno if there's a smarter way to do it, but I've just been testing with this file:
import ./nixos { configuration = { lib, config, pkgs, ... }: {
imports = [./nixos/modules/virtualisation/qemu-vm.nix];
boot.initrd.systemd = {
enable = true;
emergencyHashedPassword = "";
# services.foo = {
# wantedBy = ["initrd.target"];
# after = ["local-fs.target"];
# before = ["initrd.target" "initrd-cleanup.service"];
# serviceConfig.ExecStart = "/bin/systemctl emergency";
# serviceConfig.Type = "oneshot";
# };
};
virtualisation = {
graphics = false;
memorySize = 8192;
cores = 4;
};
documentation.enable = false;
services.getty.autologinUser = "root";
}; }
| 18:18:45 |
@elvishjerricco:matrix.org | And doing stuff like nix-build test.nix -A config.system.build.initialRamdisk | 18:18:59 |
flokli | 5bfe21331548db28279776debc073b02de71e2e3…HEAD
10338356 -> 10338951 bytes | 18:22:17 |
flokli | ls -lah says 9.9M for both. | 18:22:40 |
flokli | I'll head out for dinner | 18:31:57 |
flokli | There's some other open conversation about refactoring some of the stuff into a function | 18:32:13 |
flokli | Janne Heß: wanna tackle that? | 18:32:25 |
@janne.hess:helsinki-systems.de | I want but I don't think I'll find time right now :/ | 18:32:51 |