bees icon indicating copy to clipboard operation
bees copied to clipboard

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

Open tlaurion opened this issue 1 year ago • 3 comments

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 avatar Apr 15 '24 16:04 tlaurion

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

tlaurion avatar Jun 14 '24 13:06 tlaurion

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?

Zygo avatar Jun 14 '24 15:06 Zygo

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

Massimo-B avatar Jun 27 '24 13:06 Massimo-B

@Zygo I still think this should be managed by code in testing version, prior of next release.

tlaurion avatar Dec 16 '24 04:12 tlaurion

Detecting if a service is running under systemd is easy by looking at the environment variables. I can create a PR for that.

kakra avatar Dec 16 '24 09:12 kakra

@kakra please do!

tlaurion avatar Dec 29 '24 15:12 tlaurion

Detecting if a service is running under systemd is easy by looking at the environment variables. I can create a PR for that.

Please do!

Zygo avatar Jan 19 '25 06:01 Zygo

I've added an untested PR using @Zygo's idea, please check if it works properly.

kakra avatar Jan 19 '25 13:01 kakra

It looks good, but it needs testing on the weird distros. It'll fail outright if you don't have unshare, but that's more than 5 years old now.

I'm also looking at adding nodev to the mount flags to reduce attack surface. We don't need nosymfollow any more, assuming we can get openat2 support to build.

Zygo avatar Jan 20 '25 17:01 Zygo

I cherry-picked kakra's PR and accidentally closed this (but not the PR). Yay github surprise UI.

At this point the original issue should be solved. If there are new issues, please reopen.

Zygo avatar Jan 20 '25 22:01 Zygo