Skip to content

beesd@.service: add shutdown ordering to prevent EBUSY on unmount - #1

Merged
linm-at merged 1 commit into
masterfrom
fix/systemd-shutdown-ordering
Jun 21, 2026
Merged

beesd@.service: add shutdown ordering to prevent EBUSY on unmount#1
linm-at merged 1 commit into
masterfrom
fix/systemd-shutdown-ordering

Conversation

@linm-at

@linm-at linm-at commented Jun 18, 2026

Copy link
Copy Markdown
Owner

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.

@linm-at
linm-at requested a review from Copilot June 18, 2026 17:11
@linm-at linm-at self-assigned this Jun 18, 2026
@linm-at linm-at added bug Something isn't working help wanted Extra attention is needed labels Jun 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Not ready to approve

The WantedBy=multi-user.target change is an unmentioned behavioral change that should be justified/documented or reverted before approval.

Pull request overview

Updates the systemd template unit for beesd@ to improve shutdown ordering and stop behavior so filesystems managed/held open by beesd are less likely to fail unmount with EBUSY during shutdown.

Changes:

  • Add After=local-fs.target and Before=umount.target to improve ordering between beesd and shutdown unmounting.
  • Increase shutdown grace period via TimeoutStopSec=300.
  • Minor unit-file adjustments (comment typo fix; change WantedBy target).
File summaries
File Description
scripts/beesd@.service.in Adjusts systemd unit ordering and stop timeout to reduce shutdown-time unmount failures.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/beesd@.service.in
Description=Bees (%i)
Documentation=https://github.com/Zygo/bees
After=sysinit.target
# Prevents bees from still running while scanned FS is being unmounted
Comment thread scripts/beesd@.service.in

[Install]
WantedBy=basic.target
WantedBy=multi-user.target
@linm-at
linm-at merged commit 03ef83a into master Jun 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants