Skip to content

systemd timers can result in changed services not being restarted reliably #49415

Closed

Description

@nh2

The original title of this issue was

systemd services are not restarted reliably when package is upgraded

It was renamed after the root cause was identified to be systemd timers in #49415 (comment) and after.

Issue description

I just deployed the upgrade from Consul 0.9.3 -> 1.3.0 (#49165) to my 18.03 server cluster (in my case, I upgraded from 1.0.6).

The machines run identical configurations deployed by nixops, and deploying should have stopped all old consul processes and launched the new version.

Yet I found that on 2 out of 7 machines, the old consul version was still running.

On a node where the deployment worked, the journalctl looks like this:

Oct 29 14:44:42 node-1 nixos[22687]: switching to system configuration /nix/store/fxfk4mfi5b90h1vl0hj99gy57zzpl9hy-nixos-system-node-1-18.03pre-git
Oct 29 14:44:42 node-1 systemd[1]: Stopping rsync CDN files to CDN nodes...
Oct 29 14:44:42 node-1 systemd[1]: Stopping ceph-mount.service...
Oct 29 14:44:42 node-1 systemd[1]: Stopping cephfsRunningCheckWatchdog.service...
Oct 29 14:44:42 node-1 systemd[1]: Stopping Nginx Web Server...
Oct 29 14:44:42 node-1 systemd[1]: Stopping consul-alerts.service...
Oct 29 14:44:42 node-1 systemd[1]: Stopped target Local File Systems.
Oct 29 14:44:42 node-1 systemd[1]: Stopped target All Network Interfaces (deprecated).
Oct 29 14:44:42 node-1 systemd[1]: Stopped target Remote File Systems.
Oct 29 14:44:42 node-1 systemd[1]: Stopped server.service.
Oct 29 14:44:42 node-1 systemd[1]: Stopped consul-alerts.service.
Oct 29 14:44:42 node-1 systemd[1]: Stopping consul.service...
Oct 29 14:44:42 node-1 consul[22232]:     2018/10/29 14:44:42 [INFO] Caught signal:  terminated
Oct 29 14:44:42 node-1 systemd[1]: Stopped cephfsRunningCheckWatchdog.service.
Oct 29 14:44:42 node-1 systemd[1]: Stopped Nginx Web Server.
Oct 29 14:44:43 node-1 systemd[1]: Stopped rsync CDN files to CDN nodes.
Oct 29 14:44:43 node-1 systemd[1]: Reloading.
Oct 29 14:44:43 node-1 systemd[1]: consul.service: Current command vanished from the unit file, execution of the command list won't be resumed.
Oct 29 14:44:43 node-1 systemd[1]: Started Create or wait for ceph..
Oct 29 14:44:43 node-1 systemd[1]: Starting ceph-mount.service...
Oct 29 14:44:43 node-1 systemd[1]: Reloading D-Bus System Message Bus.
Oct 29 14:44:43 node-1 systemd[1]: Reloaded D-Bus System Message Bus.
Oct 29 14:44:43 node-1 systemd[1]: Started ceph-mount.service.
Oct 29 14:44:43 node-1 systemd[1]: Starting ceph-mounted.service...
Oct 29 14:44:43 node-1 consul[22232]:     2018/10/29 14:44:43 [INFO] Exit code: 1
Oct 29 14:44:43 node-1 systemd[1]: consul.service: Main process exited, code=exited, status=1/FAILURE
Oct 29 14:44:43 node-1 systemd[1]: consul.service: Failed with result 'exit-code'.
Oct 29 14:44:43 node-1 systemd[1]: Starting consul.service...
Oct 29 14:44:43 node-1 systemd[1]: Started consul.service.
Oct 29 14:44:43 node-1 systemd[1]: Starting consulReady.service...
Oct 29 14:44:43 node-1 systemd[1]: Started ceph-mounted.service.
Oct 29 14:44:43 node-1 systemd[1]: Starting Nginx Web Server...
Oct 29 14:44:43 node-1 systemd[1]: Started Nginx Web Server.
Oct 29 14:44:43 node-1 systemd[1]: Starting ceph-mounted.service...
Oct 29 14:44:43 node-1 systemd[1]: Starting camPostgresRole.service...
Oct 29 14:44:43 node-1 systemd[1]: Reached target Local File Systems.
Oct 29 14:44:43 node-1 systemd[1]: Reached target All Network Interfaces (deprecated).
Oct 29 14:44:43 node-1 systemd[1]: Reached target Remote File Systems.
Oct 29 14:44:43 node-1 systemd[1]: Started ceph-mounted.service.
Oct 29 14:44:43 node-1 systemd[1]: Started camPostgresRole.service.
Oct 29 14:44:43 node-1 systemd[1]: Starting server.service...
Oct 29 14:44:44 node-1 systemd[1]: Started consulReady.service.
Oct 29 14:44:44 node-1 systemd[1]: Started rsync CDN files to CDN nodes.
Oct 29 14:44:44 node-1 systemd[1]: Starting consul-alerts.service...
Oct 29 14:44:44 node-1 systemd[1]: Started server.service.
Oct 29 14:44:44 node-1 systemd[1]: Started consul-alerts.service.
Oct 29 14:44:44 node-1 nixos[22687]: finished switching to system configuration /nix/store/fxfk4mfi5b90h1vl0hj99gy57zzpl9hy-nixos-system-node-1-18.03pre-git

Note the presence of Stopping consul.service....

On a node where it didn't work, it looks like this:

Oct 29 13:52:38 node-2 nixos[27726]: switching to system configuration /nix/store/1x475px1qyk9f9gcdk0pvpbfhip0v1rs-nixos-system-node-2-18.03pre-git
Oct 29 13:52:38 node-2 systemd[1]: Stopping rsync CDN files to CDN nodes...
Oct 29 13:52:38 node-2 systemd[1]: Stopped target Multi-User System.
Oct 29 13:52:38 node-2 systemd[1]: Stopping server.service...
Oct 29 13:52:38 node-2 systemd[1]: Stopping consul-alerts.service...
Oct 29 13:52:38 node-2 systemd[1]: Stopped target Local File Systems.
Oct 29 13:52:38 node-2 systemd[1]: Stopped target All Network Interfaces (deprecated).
Oct 29 13:52:38 node-2 systemd[1]: Stopped target Remote File Systems.
Oct 29 13:52:38 node-2 systemd[1]: Stopped server.service.
Oct 29 13:52:38 node-2 systemd[1]: Stopped rsync CDN files to CDN nodes.
Oct 29 13:52:38 node-2 systemd[1]: Starting ceph-mounted.service...
Oct 29 13:52:38 node-2 systemd[1]: Started ceph-mounted.service.
Oct 29 13:52:51 node-2 systemd[1]: Stopped consul-alerts.service.
Oct 29 13:52:51 node-2 systemd[1]: Starting consulReady.service...
Oct 29 13:52:51 node-2 systemd[1]: Started consulReady.service.
Oct 29 13:52:51 node-2 systemd[1]: Started rsync CDN files to CDN nodes.
Oct 29 13:52:51 node-2 systemd[1]: Reloading.
Oct 29 13:52:51 node-2 systemd[1]: consul.service: Current command vanished from the unit file, execution of the command list won't be resumed.
Oct 29 13:52:51 node-2 systemd[1]: cdn-rsync.service: Current command vanished from the unit file, execution of the command list won't be resumed.
Oct 29 13:52:51 node-2 systemd[1]: nginx.service: Current command vanished from the unit file, execution of the command list won't be resumed.
Oct 29 13:52:51 node-2 systemd[1]: Reloading D-Bus System Message Bus.
Oct 29 13:52:51 node-2 systemd[1]: Reloaded D-Bus System Message Bus.
Oct 29 13:52:51 node-2 systemd[1]: Stopping Nginx Web Server...
Oct 29 13:52:51 node-2 systemd[1]: Stopped Nginx Web Server.
Oct 29 13:52:51 node-2 systemd[1]: Starting ceph-mounted.service...
Oct 29 13:52:51 node-2 systemd[1]: Started ceph-mounted.service.
Oct 29 13:52:51 node-2 systemd[1]: Starting Nginx Web Server...
Oct 29 13:52:51 node-2 systemd[1]: Started Nginx Web Server.
Oct 29 13:52:51 node-2 systemd[1]: Starting ceph-mounted.service...
Oct 29 13:52:51 node-2 systemd[1]: Starting consulReady.service...
Oct 29 13:52:51 node-2 systemd[1]: Starting camPostgresRole.service...
Oct 29 13:52:51 node-2 systemd[1]: Reached target Local File Systems.
Oct 29 13:52:51 node-2 systemd[1]: Reached target Remote File Systems.
Oct 29 13:52:51 node-2 systemd[1]: Starting stolonCreatePostgresDataDir.service...
Oct 29 13:52:51 node-2 systemd[1]: Reached target All Network Interfaces (deprecated).
Oct 29 13:52:51 node-2 systemd[1]: Started ceph-mounted.service.
Oct 29 13:52:51 node-2 systemd[1]: Started stolonCreatePostgresDataDir.service.
Oct 29 13:52:51 node-2 systemd[1]: Started camPostgresRole.service.
Oct 29 13:52:51 node-2 systemd[1]: Starting server.service...
Oct 29 13:52:51 node-2 systemd[1]: Started consulReady.service.
Oct 29 13:52:51 node-2 systemd[1]: Starting stolonClusterDataReady.service...
Oct 29 13:52:51 node-2 systemd[1]: Starting consul-alerts.service...
Oct 29 13:52:51 node-2 systemd[1]: Started stolonClusterDataReady.service.
Oct 29 13:52:51 node-2 systemd[1]: Starting stolonConfigChange.service...
Oct 29 13:52:51 node-2 systemd[1]: Started stolonConfigChange.service.
Oct 29 13:52:52 node-2 systemd[1]: Started consul-alerts.service.
Oct 29 13:52:52 node-2 systemd[1]: Started server.service.
Oct 29 13:52:52 node-2 systemd[1]: Reached target Multi-User System.
Oct 29 13:52:52 node-2 nixos[27726]: finished switching to system configuration /nix/store/1x475px1qyk9f9gcdk0pvpbfhip0v1rs-nixos-system-node-2-18.03pre-git

Note the absence of Stopping consul.service...

This is despite nixops having the following output:

ceph-deployment> closures copied successfully
node-2..............> uploading key ‘secrets’...
node-2..............> uploading key ‘nginxSSLprivkey’...
node-2..............> uploading key ‘cdn-rsync-ssh-privkey’...
node-2..............> updating GRUB 2 menu...
node-2..............> stopping the following units: cdn-rsync.service, server.service, consul-alerts.service, consul.service
node-2..............> Job for consul.service canceled.
node-2..............> activating the configuration...
node-2..............> warning: user ‘postgres’ has unknown group ‘postgres’
node-2..............> setting up /etc...
node-2..............> setting up tmpfiles
node-2..............> reloading the following units: dbus.service
node-2..............> restarting the following units: nginx.service
node-2..............> starting the following units: cdn-rsync.service, server.service, consul-alerts.service, consul.service
node-2..............> activation finished successfully
ceph-deployment> deployment finished successfully

Observe how:

  • stopping the following units: ..., consul.service was printed
  • but on the machine, Stopping consul.service didn't occur.

Possibly related is the systemd warning consul.service: Current command vanished from the unit file.

Activity

  1. arianvp commented on Oct 31, 2018

    @arianvp
    Member

    Did you have

     } // (optionalAttrs (cfg.leaveOnStop) {
              ExecStop = "${cfg.package.bin}/bin/consul leave";
            });
    
    

    Enabled? Perhaps leaving took to long and systemd bailed out?

    If you can tell me whether you had this option enabled or not I can try to reproduce the issue

  2. arianvp commented on Oct 31, 2018

    @arianvp
    Member

    I actually think that that config is buggy!

    It should be ExecStopPre= consul leave

    ExecStop is responsible for killing the PID which consul leave doesn't do iirc

    edit: Nope consul leave does exit the unit gracefully

  3. arianvp commented on Oct 31, 2018

    @arianvp
    Member

    Related: #33172

    You also seem to have opened that issue :). I think the Current command vanished from the unit file part is very relevant

  4. nh2 commented on Oct 31, 2018

    @nh2
    ContributorAuthor

    @arianvp No, I have no ExecStop in systemctl cat consul.

    I have:

    ExecReload=/nix/store/kl0vlvk2bd6f1hls53xkvkixlz6vp72r-consul-1.3.0-bin/bin/consul reload
    ExecStart=@/nix/store/kl0vlvk2bd6f1hls53xkvkixlz6vp72r-consul-1.3.0-bin/bin/consul consul agent -config-dir /etc/consul.d -config-file /etc/consul.json -conf>
    ExecStartPre=/nix/store/453nm1q1r7rzqzh5arx6z04qh1klg7f0-unit-script/bin/consul-pre-start
    

    Also, I think that if systemd tried to stop consul at all, even via ExecStop, it would have printed Stopping consul.service... (which it didn't), wouldn't it?

  5. nh2 commented on Oct 31, 2018

    @nh2
    ContributorAuthor

    The difference to #33172 is that there it at least says Stopping Nginx Web Server....

  6. arianvp commented on Oct 31, 2018

    @arianvp
    Member

    I just noticed

    node-2..............> Job for consul.service canceled.
    

    This is a string that systemctl stop returns when it fails to stop the job (See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768208 for example)

  7. arianvp commented on Oct 31, 2018

    @arianvp
    Member

    Further research:

    What is certain, is that whatever caused the Job canceled for consul.service, caused the service to not stop

    edit: Scrap this part below. I just realised that in the logs that failed to have Stopping consul... consul
    didn't exit with a non-zero exit code

    Details `SIGTERM` causes a `consul server` to exit with exit code `1`, which (I think?) could trigger the `Restart` , and thus a race condition occurs between `systemctl stop` and `Restart`, causing the stop job to be canceled. Though I am a bit skeptical about this hypothesis, since you don't have `Stopping consul.service ...` in your logs.
    $ nix run nixpkgs.consul
    $ consul agent -data-dir /tmp/consul -server=true &
    $ pkill -TERM consul
        2018/10/31 16:54:40 [INFO] Exit code:  1
    

    Whilst non-servers gracefully exit on SIGTERM:

    $ consul agent -data-dir /tmp/consul -server=false &
    $ pkill -TERM consul
        2018/10/31 16:54:40 [INFO] Exit code:  0
    

    I think the fix here is to make the the systemd unit send SIGINT instead of SIGTERM, as advised here: https://www.consul.io/docs/agent/basics.html#stopping-an-agent

    This should fix the race condition occuring.

    I haven't been able to trigger the race condition though, so I might be wrong. on my local machine systemctl stop consul works fine ,even in -server mode.

  8. nh2 commented on Nov 1, 2018

    @nh2
    ContributorAuthor

    Job for consul.service canceled.

    This is a string that systemctl stop returns when it fails to stop the job

    I can actually reproduce this part.

    If I just type systemctl stop consul on my deployed system, I immediately get Job for consul.service canceled.

    Afterwards systemctl status consul shows the service as running.

    However, journalctl also shows that consul did get a stop command (agent: Caught signal: terminated) and exited 1. But then it restarted (with Starting consul.service... before it).

  9. nh2 commented on Nov 1, 2018

    @nh2
    ContributorAuthor
    [root@node-3:~]# systemctl cat consul
    # /nix/store/amy5ccykgajhc2q75mkbjv362z599xvr-unit-consul.service/consul.service
    [Unit]
    After=network.target
    X-Restart-Triggers=/nix/store/0aa2x43nwmid5vwcbqxq6a1m5hpck6jh-etc-consul.json /nix/store/fiawx2232c8z11jca84b1ibd7zfjjz9d-etc-server-service.json /nix/store/5pk>
    
    [Service]
    Environment="LOCALE_ARCHIVE=/nix/store/v2hvbpzhndgjm04djqql93bmb4w69gql-glibc-locales-2.26-131/lib/locale/locale-archive"
    Environment="PATH=/nix/store/2afkicxfldn57gp22l45xavbpi4sa57g-iproute2-4.15.0/bin:/nix/store/iywd02hbirf506q740z0v6zyrvsa9gcf-gnugrep-3.1/bin:/nix/store/crda0ambd6cjfgp>
    Environment="TZDIR=/nix/store/k8n4sf0yfas70yfv156knrpv9xfipjwm-tzdata-2017c/share/zoneinfo"
    
    
    
    ExecReload=/nix/store/kl0vlvk2bd6f1hls53xkvkixlz6vp72r-consul-1.3.0-bin/bin/consul reload
    ExecStart=@/nix/store/kl0vlvk2bd6f1hls53xkvkixlz6vp72r-consul-1.3.0-bin/bin/consul consul agent -config-dir /etc/consul.d -config-file /etc/consul.json -config-file /et>
    ExecStartPre=/nix/store/453nm1q1r7rzqzh5arx6z04qh1klg7f0-unit-script/bin/consul-pre-start
    PermissionsStartOnly=true
    Restart=on-failure
    TimeoutStartSec=0
    User=consul
    
  10. c0bw3b commented on Nov 1, 2018

    @c0bw3b
    Contributor

    From the doc regarding Restart= :

    Setting this to on-failure is the recommended choice for long-running services, in order to increase reliability by attempting automatic recovery from errors. For services that shall be able to terminate on their own choice (and avoid immediate restarting), on-abnormal is an alternative choice.

    I'm not sure but maybe setting Restart=on-abnormal in the service unit would allow you to stop the service manually? i.e. the stop job would not be canceled immediately

  11. nh2 commented on Nov 1, 2018

    @nh2
    ContributorAuthor

    Related:

    The NixOS consul systemd service sets TimeoutStartSec = "0";, which is likely wrong (at least neither me nor boucman from IRC #systemd can guess what that's for).

    I asked about that on 9ce0c1cb7113#r23138805 but never got an answer from @wkennington.

  12. added a commit that references this issue on Nov 1, 2018
  13. nh2 commented on Nov 1, 2018

    @nh2
    ContributorAuthor

    Another service that have a suspicious TimeoutStartSec=0:

    (I commented). (Update: Answer that it's still unclear. I filed #49700 for it.)

  14. nh2 commented on Nov 2, 2018

    @nh2
    ContributorAuthor

    I have filed one systemd issue that seems to be at least related: systemd/systemd#10626

    I don't think the timer issue explains the full situation, because of the

    2 out of 7 machines

    from the issue description where consul didn't get restarted, only 1 had a systemd timer installed.

  15. nh2 commented on Nov 2, 2018

    @nh2
    ContributorAuthor

    I am getting more and more convinced that the Job for ... canceled. issue and the problem of an old version running are totally separate.

    In particular, I suspect that the old-version problem has more to do with Current command vanished from the unit file, execution of the command list won't be resumed..

    I have done the following experiment, which supports this:

    I've started modifying

    ExecStart = "@${cfg.package.bin}/bin/consul consul agent -config-dir /etc/consul.d"

    adding more and more -ui switches and deploying with nixops in between. After the deploy is done, I run ps aux | grep consul | grep agent to see what command line is running.

    After a deploy with -ui -ui -ui -ui -ui (5 -ui), ps shows only 4 -ui:

    Nov 02 17:52:52 node-1 systemd[26291]: consul.service: Executing: consul agent -config-dir /etc/consul.d -ui -ui -ui -ui -config-file /etc/consul.json -config-file /etc/consul-addrs.json
    

    That is even though systemctl cat shows 5 -ui:

    # systemctl cat consul.service | grep ExecStart
    ExecStart=@/nix/store/kl0vlvk2bd6f1hls53xkvkixlz6vp72r-consul-1.3.0-bin/bin/consul consul agent -config-dir /etc/consul.d -ui -ui -ui -ui -ui   -config-file /etc/consul.json   -config-file /etc/consul-addrs.json
    

    I had systemd-analyze log-level debug on, and in journalctl -f could see that indeed systemd did start consul with the command line showing only 4 -ui:

    Nov 02 17:52:51 node-1 nixos[26199]: switching to system configuration /nix/store/z0c30mny9rmsywvisf318wafqxqcb8ck-nixos-system-node-1-18.03pre-git
    Nov 02 17:52:51 node-1 systemd[1]: Stopping consul.service...
    Nov 02 17:52:51 node-1 consul[14968]:     2018/11/02 17:52:51 [INFO] agent: Caught signal:  terminated
    Nov 02 17:52:52 node-1 consul[14968]:     2018/11/02 17:52:52 [INFO] agent: Exit code: 1
    Nov 02 17:52:52 node-1 systemd[1]: consul.service: Main process exited, code=exited, status=1/FAILURE
    Nov 02 17:52:52 node-1 systemd[1]: consul.service: Failed with result 'exit-code'.
    Nov 02 17:52:52 node-1 systemd[1]: Starting consul.service...
    Nov 02 17:52:52 node-1 systemd[26286]: cephfs-mounted.service: Executing: /nix/store/xwb1wk1vxjvq4vwxfbphggygfqcb15si-unit-script/bin/cephfs-mounted-pre-start
    Nov 02 17:52:52 node-1 systemd[26287]: consul.service: Executing: /nix/store/fqk7rpkdf9741blndfkrlxywdyl477j8-unit-script/bin/consul-pre-start
    Nov 02 17:52:52 node-1 systemd[1]: Started consul.service.
    Nov 02 17:52:52 node-1 systemd[26291]: consul.service: Executing: consul agent -config-dir /etc/consul.d -ui -ui -ui -ui -config-file /etc/consul.json -config-file /etc/consul-addrs.json
    Nov 02 17:52:52 node-1 consul[26291]: ==> Consul agent running!
    Nov 02 17:52:52 node-1 systemd[1]: Reloading.
    Nov 02 17:52:52 node-1 systemd[1]: consul.service: Current command vanished from the unit file, execution of the command list won't be resumed.
    Nov 02 17:52:52 node-1 nixos[26199]: finished switching to system configuration /nix/store/z0c30mny9rmsywvisf318wafqxqcb8ck-nixos-system-node-1-18.03pre-git
    

    And in this case, no Job for consul.service canceled was printed in nixops.


    Trying this experiment more times, I also observe deploys where Job for consul.service canceled is printed, but consul starts with the correct number of -uis nevertheless.

  16. 27 remaining items

  17. nh2 commented on Apr 28, 2024

    @nh2
    ContributorAuthor

    I keep encountering this; posting a concrete situation again, this time with the nebula VPN service (and a timer that starts a service that requires [email protected]):

    updating GRUB 2 menu...
    stopping the following units: my-server.service, [email protected]
    Job for [email protected] canceled.
    activating the configuration...
    warning: user ‘postgres’ has unknown group ‘postgres’
    setting up /etc...
    reloading user units for root...
    setting up tmpfiles
    reloading the following units: dbus.service
    starting the following units: my-server.service, [email protected]
    activation finished successfully
    

    Here we see again: Job for [email protected] canceled.

  18. nh2 commented on Apr 28, 2024

    @nh2
    ContributorAuthor

    @arianvp

    systemctl restart has the problem that it is less correct and can lead to subtle bugs. Hence we don't default to it.

    The current order is:

    1. stop
    2. activate configuration
    3. (restart if opted in with `stopIfChanged = false` ; intead of stop)
    4. daemon-reload
    5. start
    

    Cannot we just replace 5. start by restart?

    The service would still be stop in the earlier step.

    But restart would make sure that if a timer triggered a restart duing 1. stop,

    I believe that's what @Gabriella439 meant in #49415 (comment): To replace 1. stop + 5. start by 1. stop + 5. restart, not to replace the whole thing by a single restart.

    So, concretely, I propose:

    print STDERR "starting the following units: ", join(", ", @units_to_start_filtered), "\n"
    }
    system("$new_systemd/bin/systemctl", "start", "--", sort(keys(%units_to_start))) == 0 or $res = 4;

    -     print STDERR "starting the following units: ", join(", ", @units_to_start_filtered), "\n"
    +     print STDERR "starting (via restart, see #49415) the following units: ", join(", ", @units_to_start_filtered), "\n"
     }
    -system("$new_systemd/bin/systemctl", "start", "--", sort(keys(%units_to_start))) == 0 or $res = 4;
    +system("$new_systemd/bin/systemctl", "restart", "--", sort(keys(%units_to_start))) == 0 or $res = 4;

    Edit:

    This doesn't work trivially, it makes the system hang because it restarts the network. Why? Because in this commit the logic was introduced that what's started isn't actually what's printed:

    print STDERR "starting the following units: ", join(", ", @units_to_start_filtered), "\n"
                                                                              ^
                                                                              _filtered here
    
    system("$new_systemd/bin/systemctl", "start", "--", sort(keys(%units_to_start))) == 0 or $res = 4;
                                                                                ^
                                                                                NO _filtered here
  19. changed the title [-]systemd services are not restarted reliably when package is upgraded[/-] [+]systemd timers can result in changed services not being restarted reliably[/+] on Apr 28, 2024
  20. nh2 commented on Apr 28, 2024

    @nh2
    ContributorAuthor

    I am reopening this issue to

    The issue mentioned here is an instance of the "bug" mentioned [in #49528] (only reloading, even though a restart would be necessary).

    @flokli That isn't quite correct, at least not as written.

    In here, reloading isn't involved at all. This issue tracks the fact that even start + stop does not work, because the start can be replaced by a too-early restart in the presence of timers.

    I am re-opening this issue because I believe we can fix this issue -- stop not happening at all -- more easily than #49528 ("Interactions of restartIfChanged, reloadIfChanged, stopIfChanged").

  21. reopened this on Apr 28, 2024
  22. nh2 commented on Apr 28, 2024

    @nh2
    ContributorAuthor

    I have created a PR that implements stop + restart (instead of stop + start) of the stopped units:

    #307562

    Please help test!

  23. added a commit that references this issue on Apr 28, 2024
    3f896ed
  24. added
    0.kind: bug
    6.topic: systemd
    on May 13, 2024
  25. moved this to Done in systemdon Jun 22, 2024
  26. added
    2.status: stale
    on Jul 3, 2025
  27. nh2 commented on May 30, 2026

    @nh2
    ContributorAuthor

    Update: switch-to-configuration.pl was replaced by switch-to-configuration-ng, which became default in NixOS 24.11 and switch-to-configuration.pl was removed with NixOS 25.11.

    switch-to-configuration-ng still has the bug: #308801 (comment)

    PR to fix it for that:

  28. removed
    2.status: stale
    on May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug6.topic: systemd

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions