-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set timeline.service as Type=oneshot to allow serial odering #392
base: master
Are you sure you want to change the base?
Conversation
Systemd starts units in parallel unless otherwise specified by the unit files. A `Type=simple` service has no such constraint, and as such any `WantedBy` service introduced to run after `snapper-timeline.service` will execute in parallel instead of waiting until snapper is finished. By changing `simple` to `oneshot`, other units can be added to the system that use `WantedBy=snapper-timeline.service` and they will actually run after `snapper-timeline.service` is finished. When `snapper-timeline.service` is installed by itself this has no effect, and the unit continues to operate as it did for anyone that doesn't have any dependent services.
- Infinity start time is default - Helps with serial execution - Also see openSUSE/snapper#392 In order for this to run properly after `snapper-timeline.service`, it too must be a `Type=oneshot` service to serially execute this service afterwards. Otherwise we run into a race condition where this service is not able to read the newly created lvm snapshots yet.
@aschnell Are you planning on merging this PR anytime soon? On Arch Linux I'm setting an override to set the snapper-timeline.service to be This also opens up the possibility of having a different cadence than hourly for creating snapshots, by modifying snapper-timeline.timer (or timeline.timer in this repository). Some of my backups reading the latest read-only snapshot take more than an hour to run. I'm running my backup every four hours, so I don't want snapper creating a new snapshot every hour since at least three of those four will be unused, and potentially claiming space in Btrfs unnecessarily. This all assumes that snapperd isn't actually running the schedule, the manual for snapperd is completely absent of implementation details. It just looks like it's the DBus daemon for snapper. |
@xenithorb Note that If you want to enforce a specific ordering between two units, you have to additionally specify The relevant section of the systemd manpages is in
|
@tblancher You can make the changes yourself on your system.
Systemd will add an Analogously for |
Systemd starts units in parallel unless otherwise specified by the unit files. A
Type=simple
service has no such constraint, and as such anyWantedBy
service introduced to run aftersnapper-timeline.service
will execute in parallel instead of waiting until snapper is finished. By changingsimple
tooneshot
, other units can be added to the system that useWantedBy=snapper-timeline.service
and they will actually run aftersnapper-timeline.service
is finished. Whensnapper-timeline.service
is installed by itself this has no effect, and the unit continues to operate as it did for anyone that doesn't have any dependent services.Example Before:
Note how the two units outputs are interleaved because in the beginning they are started in parallel. Also note the actual issue, which is that my script picks up two older-numbered snapshots because of a race condition caused by not ordering this properly.
Example After:
The unit that is running after: