I have systemd running with a watchdog, and a service that uses a systemd watchdog to restart the service when it locks up. If the service locks up repeatedly then systemd reboots the machine.
How can I log when systemd restarts the service and when the machine is rebooted by systemd?
The OS is ARCH linux and the systemd version is 218.
Jounrnalctl is empty for that day after a watchdog reboot.
I don't know what the journal contains if only the service is restarted. Whats the most effective way of testing an service hanging?
/var/log/journal exists and will store information on a normal reboot, but doesn't have any logs for the day on a watchdog reboot.
Reading Debugging lock-up - systemd loses my logs which seems to be a similiar problem. Uncommenting #SyncIntervalSec=5m in my journald.conf gives me logs of the reboot, but no clue as to what triggers it.
In this case it was a forkbomb causing systemd to reboot the whole machine.
Apr 11 20:54:02 buspi systemd[1]: Stopping Sound Card. <--- restarting
Apr 11 20:54:01 buspi anacron[17809]: Job `cron.daily' started <--- seems ok
Unit File
[Unit]
Description= Alight
Wants=network.target
[Service]
Type=notify
ExecStart=/usr/bin/alight
ExecStop=/usr/bin/alight-stop
Restart=always
WatchdogSec=30s
StartLimitInterval=5min
StartLimitBurst=4
StartLimitAction=reboot-force
[Install]
WantedBy=multi-user.target
system.conf
[Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
#CrashShell=no
#ShowStatus=yes
#CrashChVT=1
#CPUAffinity=1 2
#JoinControllers=cpu,cpuacct net_cls,net_prio
RuntimeWatchdogSec=20
ShutdownWatchdogSec=3min
#CapabilityBoundingSet=
#SystemCallArchitectures=
#TimerSlackNSec=
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
#DefaultRestartSec=100ms
#DefaultStartLimitInterval=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=no
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=