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

Gracefully handle failure to create hard links in chroot setup #2324

Open
aszlig opened this issue Aug 2, 2018 · 2 comments
Open

Gracefully handle failure to create hard links in chroot setup #2324

aszlig opened this issue Aug 2, 2018 · 2 comments
Labels

Comments

@aszlig
Copy link
Member

aszlig commented Aug 2, 2018

When hard-linking files into the chroot files, the builder aborts with an error.

However when the file system setup is to some extent similar to what we do in NixOS VM tests, which is using an 9p share from the host as the lower dir for an overlay file system, the hard link will cross filesystem boundaries and thus will fail with EPERM (not EXDEV though, because it's still the same overlayfs).

Maybe it makes sense to fall back to copying here, like it's done when errno is EMLINK but for all errors.

aszlig added a commit to NixOS/nixpkgs that referenced this issue Aug 2, 2018
Since 4f6df27, nix.useSandbox defaults
to true which causes the Nix build within the containers-imperative test
to fail while trying to hardlink files into the chroot:

link("/nix/store/foo", "/nix/store/bar.drv.chroot/nix/store/foo")
   = -1 EPERM (Operation not permitted)

The reason this happens is that the hosts store is mounted using 9p and
an overlayfs is mounted on top, so even if we would disable the tmpfs
for the upper directory the hardlink would still cross filesystem
boundaries, which then fails with the above error code.

I haven't yet seen any other test which fails in a similar way, which
might be because building within VM tests is not very common and the
installer tests build in a separate store, so they're not affected.

Signed-off-by: aszlig <aszlig@nix.build>
Issue: NixOS/nix#2324
Cc: @aristidb, @edolstra, @chaoflow, @kampfschlaefer
@stale
Copy link

stale bot commented Feb 23, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 23, 2021
@stale
Copy link

stale bot commented Apr 28, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this as completed Apr 28, 2022
@thufschmitt thufschmitt reopened this Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants