/run/usr/<id> is too small

The systemd user temp area /run/user/<id> is by default 10% of the machine RAM. So something like this;

tmpfs 1618464 415764 1202700 26% /run/user/1000

It can be changed in logind.conf, which nixos controls like this;

services.logind.extraConfig = "RuntimeDirectorySize=4G";

alas, it doesn’t work.

I do get a file with the right config;

$ cat /nix/store/bh2bhgjwzgy8j6bjd2980ddkbccbfjhf-etc-logind.conf
[Login]
KillUserProcesses=no
HandleLidSwitch=suspend
HandleLidSwitchDocked=ignore
HandleLidSwitchExternalPower=suspend
RuntimeDirectorySize=4G

alas, that is not the file that gets used;

/etc/logind.conf -> /etc/static/systemd/logind.conf -> /nix/store/kyrcaw49b0zqym80c6gf49kb7rqncc4n-etc-logind.conf

$ cat /nix/store/kyrcaw49b0zqym80c6gf49kb7rqncc4n-etc-logind.conf
[Login]
KillUserProcesses=no
HandleLidSwitch=suspend
HandleLidSwitchDocked=ignore
HandleLidSwitchExternalPower=suspend

any ideas what I’m doing wrong?

services.logind.extraConfig = "RuntimeDirectorySize=4G";

I believe this is exactly the same as what I do:

  services.logind.extraConfig = ''
    RuntimeDirectorySize=2G
  '';

Here’s the links:

$ ls -lah /etc/systemd/logind.conf 
lrwxrwxrwx 1 root root 31 Nov  7 08:32 /etc/systemd/logind.conf -> /etc/static/systemd/logind.conf
$ ls -lah /etc/static/systemd/logind.conf
lrwxrwxrwx 1 root root 59 Jan  1  1970 /etc/static/systemd/logind.conf -> /nix/store/y7lfy9z839nxlnnwdd861dsvshsg3s5f-etc-logind.conf
$ cat /nix/store/y7lfy9z839nxlnnwdd861dsvshsg3s5f-etc-logind.conf
[Login]
KillUserProcesses=no
HandleLidSwitch=suspend
HandleLidSwitchDocked=ignore
HandleLidSwitchExternalPower=suspend
RuntimeDirectorySize=2G

However, if I remember correctly, just doing nixos-rebuild switch doesn’t trigger the /run/user directory to change size. I have to actually reboot my system.

1 Like