Here is a minimal example, courtesy of bl33pbl0p from the github issue.
I've double-checked it and it is valid test case for this issue:
$ systemctl cat foo
# /etc/systemd/system/foo.service
[Unit]
PartOf=bar.service
[Service]
ExecStart=/bin/sleep infinity
RestartSec=0s
Restart=always
$ systemctl cat bar
# /etc/systemd/system/bar.service
[Unit]
BindsTo=foo.service
#Same with or without After=, the window is very small to make a difference.
After=foo.service
[Service]
ExecStart=/bin/sleep infinity
$ sudo systemctl status foo bar
● foo.service
Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset:
enabled)
Active: active (running) since Wed 2020-02-12 11:38:30 MSK; 36s ago
Main PID: 1614 (sleep)
Tasks: 1
Memory: 172.0K
CPU: 1ms
CGroup: /system.slice/foo.service
└─1614 /bin/sleep infinity
Feb 12 11:38:30 pono-mac systemd[1]: Started foo.service.
● bar.service
Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset:
enabled)
Active: active (running) since Wed 2020-02-12 11:38:30 MSK; 36s ago
Main PID: 1625 (sleep)
Tasks: 1
Memory: 188.0K
CPU: 972us
CGroup: /system.slice/bar.service
└─1625 /bin/sleep infinity
Feb 12 11:38:30 pono-mac systemd[1]: Started bar.service.
$ sudo kill -6 1614
$ sudo systemctl status foo bar
● foo.service
Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset:
enabled)
Active: failed (Result: resources) since Wed 2020-02-12 11:39:24 MSK; 2s ago
Process: 1614 ExecStart=/bin/sleep infinity (code=killed, signal=ABRT)
Main PID: 1614 (code=killed, signal=ABRT)
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Unit entered failed state.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Failed with result 'signal'.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Service has no hold-off time,
scheduling restart.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Failed to schedule restart
job: Transaction is destructive.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Unit entered failed state.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Failed with result
'resources'.
● bar.service
Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset:
enabled)
Active: inactive (dead) since Wed 2020-02-12 11:39:24 MSK; 2s ago
Process: 1625 ExecStart=/bin/sleep infinity (code=killed, signal=TERM)
Main PID: 1625 (code=killed, signal=TERM)
Feb 12 11:38:30 pono-mac systemd[1]: Started bar.service.
Feb 12 11:39:24 pono-mac systemd[1]: Stopping bar.service...
Feb 12 11:39:24 pono-mac systemd[1]: Stopped bar.service.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1839290
Title:
systemd doesn't restart a service after crashes
To manage notifications about this bug go to:
https://bugs.launchpad.net/systemd/+bug/1839290/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs