beesd@.service: add shutdown ordering to prevent EBUSY on unmount - #350
Open
linm-at wants to merge 1 commit into
Open
beesd@.service: add shutdown ordering to prevent EBUSY on unmount#350linm-at wants to merge 1 commit into
linm-at wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the beesd@.service systemd unit template to improve shutdown ordering and reduce unmount failures (EBUSY) by ensuring beesd is stopped in time, and to allow longer graceful shutdown.
Changes:
- Add ordering directives (
After=local-fs.target,Before=umount.target) to better coordinate startup/shutdown with filesystem availability and unmounting. - Increase shutdown grace period via
TimeoutStopSec=300. - Fix a typo in a security-hardening comment and change the unit’s
WantedBytarget.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Description=Bees (%i) | ||
| Documentation=https://github.com/Zygo/bees | ||
| After=sysinit.target | ||
| # Prevents bees from still running while scanned FS is being unmounted |
|
|
||
| [Install] | ||
| WantedBy=basic.target | ||
| WantedBy=multi-user.target |
Author
There was a problem hiding this comment.
Bees should not run in rescue mode anyway
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without Before=umount.target, systemd has no ordering guarantee between
stopping beesd and unmounting the filesystems it holds open, causing
unmount failures with EBUSY during shutdown.
On my system, with beesd running against a filesystem mounted at
/mnt/games, systemd would attempt to unmount the filesystem while beesd
still held open file descriptors, resulting in:
umount: /mnt/games: target is busy.
Add Before=umount.target so beesd is stopped before systemd begins
deactivating mount units. Also add After=local-fs.target so beesd does
not start before local filesystems are ready, and TimeoutStopSec=300 to
allow sufficient time for the hash table to flush before escalating to
SIGKILL.
Change WantedBy from basic.target to multi-user.target so beesd starts only after the system is fully up.