Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

--bind-try fails when the source is a bind mounted deleted file

Open
#811 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c, linux

Research direction

Start by reproducing the two shell examples with bwrap --bind-try and compare the successful first mount with the failed mount after deleting the source. Read the trimmed strace around openat2, file descriptors 5 and 4, and mount; done means the deleted bind-mounted file follows the expected ok1, ok2 behavior or the failure policy is clearly established.

Written by the indexing model from the issue text.

Description

touch a b
mount --bind a b
bwrap --bind-try b /x --ro-bind / / echo ok1
rm a
bwrap --bind-try b /x --ro-bind / / echo ok2

alternate example, without root:

touch a b; bwrap --bind / / --ro-bind $PWD/a $PWD/b sh -c 'bwrap --bind-try b /x --ro-bind / / echo ok1; rm a && bwrap --bind-try b /x --ro-bind / / echo ok2'

expected behavior: ok1, ok2
actual behavior: ok1, bwrap: Can't bind mount /tmp/x/b on /x: Unable to mount source on destination: No such file or directory

trimmed example strace output:

[pid 30523] openat(AT_FDCWD</>, "/oldroot", O_RDONLY|O_NOCTTY|O_CLOEXEC|O_PATH) = 4</oldroot>
[pid 30523] openat2(4</oldroot>, "/tmp/x/b", {flags=O_RDONLY|O_PATH, resolve=RESOLVE_NO_MAGICLINKS|RESOLVE_IN_ROOT}, 24) = 5</oldroot/tmp/x/b>(deleted)
[pid 30523] close(4</oldroot>)          = 0
[pid 30523] fstat(5</oldroot/tmp/x/b>(deleted), {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
[pid 30523] openat(AT_FDCWD</>, "/newroot", O_RDONLY|O_NOCTTY|O_CLOEXEC|O_PATH) = 4</newroot>
[pid 30523] openat2(4</newroot>, "/", {flags=O_RDONLY|O_DIRECTORY, resolve=RESOLVE_NO_MAGICLINKS|RESOLVE_IN_ROOT}, 24) = 6</newroot>
[pid 30523] close(4</newroot>)          = 0
[pid 30523] openat(6</newroot>, "x", O_WRONLY|O_CREAT|O_EXCL|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC, 0444) = 4</newroot/x>
[pid 30523] close(4</newroot/x>)        = 0
[pid 30523] openat(6</newroot>, "x", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_PATH) = 4</newroot/x>
[pid 30523] fstat(4</newroot/x>, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid 30523] readlink("/proc/self/fd/4", "/newroot/x", 99) = 10
[pid 30523] mount("/proc/self/fd/5", "/proc/self/fd/4", NULL, MS_BIND|MS_REC|MS_SILENT, NULL) = -1 ENOENT (No such file or directory)

basically, the file exists in the sense that it can be opened and I/O performed, but cannot be bind-mounted from. unfortunately, it doesn't seem to be possible to work around with new mount API. I'm not sure whether it makes more sense to argue the case to kernel maintainers, or silently ignore this error in bubblewrap.

Dominant language
C
Stars
8.9k
Forks
391
Avg merge
17h 45m
Merged PRs (30d)
10

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from containers/bubblewrap

All issues in containers/bubblewrap

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.