systemdntpsystemctl

Debugging systemctl "inactive (dead)"


I wanted to determine why systemd-timesyncd refused to start at bootup without logging anything or offering useful information in systemctl status.

# systemctl status systemd-timesyncd
* systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-timesyncd.service(8)

What steps can be done to determine what the issue is in the general case?


Solution

  • After doing a lot of reading of the excellent man files and bisecting a duplicated version of the service (which always "mysteriously worked", non-mysteriously in retrospect).

    I discovered there was an unmentioned Conficts=... systemd-timesyncd.service with vboxadd-service.service.

    There was no hint in the logs (presumably systemd.log_level=debug would have helped here based upon https://github.com/systemd/systemd/issues/7104).

    I was able to notice the conflict only by examining the output of

    systemd-analyze dot systemd-timesyncd.service
    

    which provided the hint of a conflict.

    In general you can list all conflicting services using

    # systemd-analyze dot systemd-timesyncd.service 2>/dev/null | grep red
        "systemd-timesyncd.service"->"shutdown.target" [color="red"];
        "vboxadd-service.service"->"systemd-timesyncd.service" [color="red"];
    

    or a command like

    # systemctl show '*' -p Id,Conflicts | grep -B1 '^Conflicts=.*systemd-timesyncd' | sed -n 's/^Id=//p'
    vboxadd-service.service