PartOf= does not propagate restart to units in activating state
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 16.7k
- Forks
- 4.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 140
Description
systemd version the issue has been seen with
242-7
Used distribution
Debian Unstable
Expected behaviour you didn't see
When calling systemctl restart on a unit, units with a PartOf= dependency should be restarted, including those in activating (start) state.
Unexpected behaviour you saw
Units with a PartOf= dependency that are in activating (start) state are not restarted.
Steps to reproduce the problem
Create a dummy test-a.target unit.
Create a test-b.service unit with the following:
[Unit]
PartOf=test-a.target
[Service]
Type=oneshot
ExecStart=/bin/sleep 10
Run:
systemctl start --no-block test-b.service
sleep 3
# test-b.service is in activating (start) state
systemctl restart test-a.target
You will notice the third command does not restart test-b.service, despite the PartOf= dependency.
Additional information
This behaviour is surprising because systemctl stop test-a.target does propagate correctly, and systemctl restart test-b.service does work, even if test-b.service is in activating state.
Workaround
One workaround is systemctl stop test-a.target; systemctl start test-a.target, but that only works if test-a.target has a dependency on test-b.service.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the test-a.target and test-b.service units, then run the listed systemctl commands while test-b.service is activating. Trace how PartOf= restart propagation handles that state; done means restarting test-a.target also restarts the activating test-b.service, while existing stop behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100