Skip to content
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

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

Closed
tlaurion opened this issue Apr 15, 2024 · 10 comments
Closed

Comments

@tlaurion
Copy link

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 #54 (comment)

Confirmed on 1245072 from 9 months ago

@tlaurion
Copy link
Author

tlaurion commented Jun 14, 2024

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

@Zygo
Copy link
Owner

Zygo commented Jun 14, 2024

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
Copy link

Massimo-B commented Jun 27, 2024

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

@tlaurion
Copy link
Author

tlaurion commented Dec 16, 2024

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

@kakra
Copy link
Contributor

kakra commented Dec 16, 2024

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

@tlaurion
Copy link
Author

@kakra please do!

@Zygo
Copy link
Owner

Zygo commented Jan 19, 2025

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!

kakra added a commit to kakra/bees that referenced this issue Jan 19, 2025
If starting the beesd script without systemd, the mount point won't
automatically unmount if the script is cancelled with ctrl+c.

Fixes: Zygo#281
Signed-off-by: Kai Krakow <[email protected]>
@kakra
Copy link
Contributor

kakra commented Jan 19, 2025

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

@Zygo
Copy link
Owner

Zygo commented Jan 20, 2025

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 Zygo closed this as completed in 360ce7e Jan 20, 2025
@Zygo
Copy link
Owner

Zygo commented Jan 20, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants