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

unshare plugin fails in a chroot #3187

Open
pmatilai opened this issue Jun 26, 2024 · 3 comments
Open

unshare plugin fails in a chroot #3187

pmatilai opened this issue Jun 26, 2024 · 3 comments
Assignees
Labels

Comments

@pmatilai
Copy link
Member

pmatilai commented Jun 26, 2024

Describe the bug
unshare plugin fails in various ways when installing to a chroot.

To Reproduce
Steps to reproduce the behavior:

  1. Install F41, install rpm-plugin-unshare
  2. dnf --installroot=/srv/test --disablerepo="*" --enablerepo="rawhide" install rpm

Expected behavior
No errors encountered.

Output
Errors like this repeated for various scriptlets:

[...]
Running scriptlet: p11-kit-trust-0.25.3-4.fc40.x86_64 52/77
error: failed to mount private /: Invalid argument
error: Plugin unshare: hook scriplet_fork_post failed
warning: %post(p11-kit-trust-0.25.3-4.fc40.x86_64) scriptlet failed, exit status 126
[...]

Environment

  • OS / Distribution: Fedora 41
  • Version: rpm >= 4.20
@pmatilai pmatilai added the bug label Jun 26, 2024
@pmatilai pmatilai added this to the 4.20.0 milestone Jun 26, 2024
@pmatilai pmatilai changed the title unshare plugin fails in an empty chroot unshare plugin fails in a chroot Aug 1, 2024
pmatilai added a commit to pmatilai/rpm that referenced this issue Aug 1, 2024
mount("/", "/", NULL, MS_REC | MS_PRIVATE, NULL) inside a chroot
fails with EINVAL. Maybe there's some magic ritual that makes it
possible, but until somebody figures it out, just disable the
private mounts inside a chroot.

Fixes: rpm-software-management#3187
@pmatilai pmatilai self-assigned this Aug 22, 2024
@pmatilai
Copy link
Member Author

pmatilai commented Aug 26, 2024

https://unix.stackexchange.com/questions/554240/unshare-mount-inside-a-jenkins-chroot-environment seems to be right on the money... or at least relevant: / inside the chroot is not an actual mount-point.

pmatilai added a commit to pmatilai/rpm that referenced this issue Aug 26, 2024
mount("/", "/", NULL, MS_REC | MS_PRIVATE, NULL) inside a chroot
fails with EINVAL. Apparently this is because "/" inside the chroot
is not (necessarily) an actual mount point and ... then it starts
getting more complicated. It should be possible to handle but
not something we want to attempt just before a release candidate.

Related: rpm-software-management#3187
@pmatilai
Copy link
Member Author

Moving the / remount to the rpm parent process makes it work, but then that has other side-effects and causes one test to fail. That rabbit hole may be deep, and it's not something we can afford to dive into just before an rc.

pmatilai added a commit to pmatilai/rpm that referenced this issue Aug 26, 2024
mount("/", "/", NULL, MS_REC | MS_PRIVATE, NULL) inside a chroot
fails with EINVAL. Apparently this is because "/" inside the chroot
is not (necessarily) an actual mount point and ... then it starts
getting more complicated. It should be possible to handle but
not something we want to attempt just before a release candidate.

Related: rpm-software-management#3187
@pmatilai pmatilai removed this from the 4.20.0 milestone Sep 18, 2024
@pmatilai
Copy link
Member Author

Dropping 4.20 milestone, that ship sailed already. There's always the next update.

pmatilai added a commit to pmatilai/rpm that referenced this issue Sep 20, 2024
mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL) inside a chroot
fails with EINVAL if the "/" inside the chroot is not an actual
mount point on the system - as it often isn't. For now, just disable
that functionality on chroot operation.

Related: rpm-software-management#3187
dmnks pushed a commit that referenced this issue Sep 20, 2024
mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL) inside a chroot
fails with EINVAL if the "/" inside the chroot is not an actual
mount point on the system - as it often isn't. For now, just disable
that functionality on chroot operation.

Related: #3187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Review
Development

No branches or pull requests

1 participant