Systemd --user unit file is masked – why and how to unmask?

I’ve defined a timer unit as showed here but with systemd.user.timers.*. My NixOS configuration builds.

systemctl --user daemon-reload
systemctl --user status org-taskjuggler-make-reports.timer


○ org-taskjuggler-make-reports.timer
     Loaded: masked (Reason: Unit org-taskjuggler-make-reports.timer is masked.)
     Active: inactive (dead)
    Trigger: n/a

the log below that output is from 20 days ago.

systemctl --user unmask org-taskjuggler-make-reports.timer

exits with status 0 and no message. After that, systemctl status above still gives the same result.

To debug this I should probably have a look into the .timer file generated by nix – but how can I find that? Any other ideas on how to debug this?

This my nix timer config:

  systemd.user.timers."org-taskjuggler-make-reports" = {
    enable = false;
    wantedBy = [ "" ];
    partOf = [ "org-taskjuggler-make-reports.service" ];
    timerConfig = {
      OnCalendar = "05:00";
      Unit = "org-taskjuggler-make-reports.service";

Any help is appreciated!

It should be in /etc/systemd/user, or you could just systemctl --user cat timer-name.timer.

That partOf line looks sketchy to me. Why did you put it there?

1 Like

Thank you tejing! The PartOf should be OK. It makes that stopping the service also stops this timer.

Oohh, I got it!

The enable option for timers and services works differently than I expected:

Setting enable to true (the default) does not enable the unit in a systemd sense or in the sense of other services.*.enable. It only stands for not masked and masked systemd unit.

For reference, with enable = false I got links to /dev/null:

$ ls -l /etc/systemd/user/org-taskjuggler-make-reports.timer
lrwxrwxrwx 4 root root 127  1. Jan 1970  /etc/systemd/user/org-taskjuggler-make-reports.timer -> /nix/store/a0y3ph7d5a5zms6j73dw2wpc4fxcg7l3-unit-org-taskjuggler-make-reports.timer-disabled/org-taskjuggler-make-reports.timer
$ ls -l /nix/store/a0y3ph7d5a5zms6j73dw2wpc4fxcg7l3-unit-org-taskjuggler-make-reports.timer-disabled/org-taskjuggler-make-reports.timer
lrwxrwxrwx 156 root root 9  1. Jan 1970  /nix/store/a0y3ph7d5a5zms6j73dw2wpc4fxcg7l3-unit-org-taskjuggler-make-reports.timer-disabled/org-taskjuggler-make-reports.timer -> /dev/null