Zygo / bees

Best-Effort Extent-Same, a btrfs dedupe agent
GNU General Public License v3.0
692 stars 56 forks source link

cancelling with CTRL+C need to be followed by umount /run/bees/mnt/$UUID #281

Open tlaurion opened 7 months ago

tlaurion commented 7 months ago

btw. I just tried the current beesd script and starting like beesd ..: After cancelling with CTRL+C I always need to umount /run/bees/mnt/bab5... for the next run. Is that intended?

Originally posted by @Massimo-B in https://github.com/Zygo/bees/issues/54#issuecomment-2014991225

Confirmed on https://github.com/Zygo/bees/commit/124507232fe5682c8b6ebe80632c33eccefa8e29 from 9 months ago

tlaurion commented 5 months ago

@Zygo would be nice if bees was fixing itself on die

Zygo commented 5 months ago

Putting this at the beginning of beesd should work:

#!/bin/sh

if [ -z "$UNSHARE_DONE" ]; then
        UNSHARE_DONE=true
        export UNSHARE_DONE
        exec unshare -m --propagation private -- "$0" "$@"
fi

The drawback is that this duplicates the systemd namespacing, and requires the namespace privilege in the script to work. Maybe some additional checks to see if it's running under systemd and skip the extra unshare call?

Massimo-B commented 5 months ago

Hi, is this going to be fixed in the release?