U̶s̶e̶r̶ ̶l̶o̶g̶i̶n̶ ̶u̶n̶i̶t̶ ̶f̶a̶i̶l̶s̶.̶ When can I expect systemd to be updated?

#1

[This issue may be related to the current systemd version please read the update section below.]

Hello everyone,
because I’m using the same NixOS configuration on a variety of machines I finally wanted to dehardcode my user configuration.

It currently looks like that:

{ config, lib, pkgs, ... }:

with lib;

let
  administrators = user: {
      isNormalUser = true;
      name = user.name;
      uid  = user.id;
      home = builtins.toPath "/home/${user.name}";
      createHome = true;
      description = "Administrative user: ${user.name}.";
      group = user.name;
      extraGroups = [ "audio" "wheel" "network" ]
        ++ (if config.services.xserver.enable then [ "input" ] else [])
        ++ (if config.services.printing.enable then [ "cups" "lp" ] else [])
        ++ (if config.virtualisation.docker.enable then [ "docker"] else []);
      shell = "${pkgs.zsh}/bin/zsh";
      passwordFile = "/secret/${user.name}";
      openssh.authorizedKeys.keyFiles = if config.services.openssh.enable then [ "/secret/${user.name}.pub" ] else [];
    };

    mkusergroup = user: {
      name = user.name;
      gid = user.id;
      members = [ user.name ];
    };

in {
  users = {
    mutableUsers = false;
    users = (map administrators config.machine.administrators);
    groups = (map mkusergroup config.machine.administrators);
    extraUsers.debug = { name = "debug";  isNormalUser = true; password = "debug";  extraGroups = [ "wheel" ];};
  };
}

Users are specified in the following manner:
administrators = [ { name = "derped"; id = 1337; } { name = "test"; id = 1338; } ];

The derivation is built properly, home directories are created, the shadow file looks alright, it only complains about the ?home path? during rebuild with:
No directory, logging in with HOME=/

When I try to login the systemd unit fails:

-- Logs begin at Fri 2018-07-06 14:00:32 CEST, end at Fri 2019-04-12 19:45:28 CEST. --
Apr 12 19:45:27 Lilim systemd[1]: Starting User Manager for UID 1337...
-- Subject: Unit user@1337.service has begun start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user@1337.service has begun starting up.
Apr 12 19:45:27 Lilim systemd[1286]: pam_unix(systemd-user:session): session opened for user derped by (uid=0)
Apr 12 19:45:27 Lilim systemd[1286]: Failed to allocate manager object: Invalid argument
Apr 12 19:45:27 Lilim systemd[1]: user@1337.service: Failed with result 'protocol'.
Apr 12 19:45:27 Lilim systemd[1]: Failed to start User Manager for UID 1337.
-- Subject: Unit user@1337.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user@1337.service has failed.
-- 
-- The result is RESULT.

Does anybody have a clue why it doesn’t work?


[UPDATE]
It seems like this may be an issue with systemd 239. (though I don’t really see why it works perfectly fine for other/normally declared users)
Seems like NixOS has it’s own repo for that.

Can somebody tell me when I can expect a switch to 240/241 on unstable?

0 Likes