!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

84 Members
systemd in NixOs's stage 1, replacing the current bash tooling https://github.com/NixOS/nixpkgs/projects/5128 Servers

Load older messages


SenderMessageTime
24 Mar 2022
@flokli:matrix.orgflokliDownload 0001-systemd-initrd-systemd-lib-drop-initrdServiceToUnit.patch17:58:29
@flokli:matrix.orgflokliThis did it for me. Test still succeeds17:58:37
@janne.hess:helsinki-systems.de@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@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@janne.hess:helsinki-systems.de(which doesn't work)17:59:50
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de(probably because systemd mounts a new /run fs)18:00:11
@elvishjerricco:matrix.org@elvishjerricco:matrix.org flokli: Oh wait 18:00:47
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgNo there is a difference18:00:51
@elvishjerricco:matrix.org@elvishjerricco:matrix.orghold on18:00:56
@flokli:matrix.orgflokliholding18:01:13
@elvishjerricco:matrix.org@elvishjerricco:matrix.org flokli: The main difference is that it only uses def.environment, not globalEnvironment 18:04:30
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgThough 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 variables18:05:17
@flokli:matrix.orgflokli TZDIR is just set to /etc/zoneinfo, which I think we don't populate 18:07:51
@flokli:matrix.orgflokli 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:matrix.orgflokliMostly thinking around fancy escape sequences in interactive prompts, not garbling when entering cryptsetup passwords with funky characters, …18:09:41
@flokli:matrix.orgflokliBut yeah, this is something we might want to test anyways18:11:33
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgJust make sure the initrd size doesn't increase I guess :P18:12:45
@flokli:matrix.orgflokliI 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 not18:12:45
@flokli:matrix.orgflokliHow do I do that?18:13:04
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Just build config.system.build.initialRamdisk before and after the change and compare sizes 18:15:36
@flokli:matrix.orgflokli

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@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@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@elvishjerricco:matrix.org And doing stuff like nix-build test.nix -A config.system.build.initialRamdisk 18:18:59
@flokli:matrix.orgflokli5bfe21331548db28279776debc073b02de71e2e3…HEAD 10338356 -> 10338951 bytes18:22:17
@flokli:matrix.orgfloklils -lah says 9.9M for both.18:22:40
@flokli:matrix.orgflokliI'll head out for dinner18:31:57
@flokli:matrix.orgflokliThere's some other open conversation about refactoring some of the stuff into a function18:32:13
@flokli:matrix.orgflokli Janne Heß: wanna tackle that? 18:32:25
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deI want but I don't think I'll find time right now :/18:32:51

There are no newer messages yet.


Back to Room ListRoom Version: 6