Skip to content

chrootenv: breaks when root contains broken symlink #33106

Open

Description

@srhb

Issue description

Steam no longer launches.
Reverting the changes introduced in #31182 and #32899 fixes the issue.

Steps to reproduce

❯ $(nix-build '<nixpkgs>' -A steam)/bin/steam
/nix/store/iqh6if4haz9x510q0166mz0k55z26k8l-chrootenv:chrootenv.c:59: stat(/result): No such file or directory
/nix/store/iqh6if4haz9x510q0166mz0k55z26k8l-chrootenv:chrootenv.c:132: nftw(/tmp/chrootenvKFDgfE): Directory not empty

Technical details

 - system: `"x86_64-linux"`
 - host os: `Linux 4.9.71, NixOS, 18.03.git.ade98dc (Impala)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 1.12pre5810_5d5b931f`
 - channels(root): `""`
 - channels(sarah): `""`
 - nixpkgs: `/home/sarah/src/nixpkgs`

Activity

  1. pbogdan commented on Dec 27, 2017

    @pbogdan
    Member

    stat(/result): No such file or directory

    It would seem strange but to double check - you wouldn't happen to have a broken result symlink sitting in your root folder? Otherwise I'm not sure what else could trigger this error.

  2. srhb commented on Dec 27, 2017

    @srhb
    ContributorAuthor

    I just reached the same conclusion after adding result to the blacklist also removed the issue! That's some nice psychic debugging, thanks!

  3. lukateras commented on Dec 27, 2017

    @lukateras
    Member

    It fails because now it links everything to chrootenv, not just whitelisted dirs. Perhaps we should check for broken symlinks.

  4. lukateras commented on Dec 27, 2017

    @lukateras
    Member

    After thinking about this, chrootenv should just replicate whatever is in user's root, and if includes a broken symlink, so be it. It also fails to clean up, which should never happen.

  5. changed the title [-]Steam fails to launch after chroot changes[/-] [+]chrootenv: breaks when root contains broken symlink[/+] on Dec 27, 2017
  6. self-assigned this
    on Dec 27, 2017
  7. pbogdan commented on Dec 27, 2017

    @pbogdan
    Member

    I observe strange behaviour in the clean up callback. I see it firing and working for a brief period of time before the bind mounts are cleared and trying to clear out contents of those recursively.

    I'm not that great with C code and semantics of various syscalls but so far with various experiments I've seen it try to remove a file from within read-only bind mounted /nix/store, and from bind mounted /root. Upon changing permissions on /root to grant read/write/execute access to the user running steam the contents of /root (outside of chroot) were deleted.

    I'm not sure what determines the directory traversal order - does it seem plausible it may traverse first through directories owned by the user invoking steam? I have not tried invoking steam as root.

  8. lukateras commented on Dec 27, 2017

    @lukateras
    Member

    @pbogdan: This is really bad. Can you drop by IRC?

  9. lukateras commented on Dec 27, 2017

    @lukateras
    Member

    This should never happen because FTW_MOUNT flag is set. If you are right, this is Bumblebee 2.0.

  10. lukateras commented on Dec 27, 2017

    @lukateras
    Member

    I can't reproduce this, even with world-writable /root. Relevant part of strace (cleanup):

    lstat("/tmp/chrootenvbGvyAF", {st_mode=S_IFDIR|0755, st_size=76, ...}) = 0
    open("/tmp/chrootenvbGvyAF", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
    fstat(3, {st_mode=S_IFDIR|0755, st_size=76, ...}) = 0
    getdents(3, /* 13 entries */, 32768)    = 312
    newfstatat(3, "boot", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "boot", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/boot")     = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/boot")      = 0
    newfstatat(3, "home", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "home", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/home")     = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/home")      = 0
    newfstatat(3, "dev", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "dev", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/dev")      = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/dev")       = 0
    newfstatat(3, "proc", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "proc", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/proc")     = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/proc")      = 0
    newfstatat(3, "sys", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "sys", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/sys")      = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/sys")       = 0
    newfstatat(3, "run", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "run", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/run")      = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/run")       = 0
    newfstatat(3, "tmp", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "tmp", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/tmp")      = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/tmp")       = 0
    newfstatat(3, "var", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "var", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/var")      = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/var")       = 0
    newfstatat(3, "root", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "root", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/root")     = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/root")      = 0
    newfstatat(3, "nix", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "nix", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/nix")      = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/nix")       = 0
    newfstatat(3, "host", {st_mode=S_IFDIR|0755, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
    openat(3, "host", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 4
    fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl(4, F_GETFL)                       = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
    fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
    getdents(4, /* 2 entries */, 32768)     = 48
    getdents(4, /* 0 entries */, 32768)     = 0
    close(4)                                = 0
    unlink("/tmp/chrootenvbGvyAF/host")     = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF/host")      = 0
    getdents(3, /* 0 entries */, 32768)     = 0
    close(3)                                = 0
    unlink("/tmp/chrootenvbGvyAF")          = -1 EISDIR (Is a directory)
    rmdir("/tmp/chrootenvbGvyAF")           = 0
    exit_group(0)                           = ?
    +++ exited with 0 +++
    

    Which shows that it doesn't remove any files, only bind mount points.

  11. lukateras commented on Dec 27, 2017

    @lukateras
    Member

    I can't trigger this, no matter what I do. I have an invalid symlink in /, and in (world-writable) /root, and I've tried plain chrootenv, steam-run and proper steam. I only get the strace that I've posted above.

    You have something strange going on with your root dir:

    rmdir("/tmp/chrootenvyyX5RA/root") = -1 EBUSY (Device or resource busy)
    5592  write(2, "/nix/store/iqh6if4haz9x510q0166mz0k55z26k8l-chrootenv:", 54) = 54
    5592  write(2, "chrootenv.c:132: ", 17) = 17
    5592  write(2, "nftw(/tmp/chrootenvyyX5RA)", 26) = 26
    5592  write(2, ": Device or resource busy", 25) = 25
    

    What could that mean? Also, please post your nix-info -m.

  12. pbogdan commented on Dec 28, 2017

    @pbogdan
    Member

    I'm still unclear why this seems to be only reproducible on my system but just to confirm - this looks to be fixed after the change that was applied in master.

    Also it seems like part of the issue could have been FTW_MOUNT not preventing descending into the folders bind mounted into the chroot, for the bind mounts that reside on the same filesystem / device. Looking at https://sourceware.org/git/?p=glibc.git;a=blob;f=io/ftw.c;h=6cca0e4cbc30835f5f298be0cd9e350c80791085;hb=HEAD the check is performed on st_dev of the folder to be traversed, and st_dev of the initial directory, and I believe those would be the same for bind mounts originating from the same filesystem (unless I misunderstood the code).

  13. 19 remaining items

  14. pbogdan commented on Jan 1, 2018

    @pbogdan
    Member

    According to https://linux.die.net/man/3/nftw:

    FTW_MOUNT
    If set, stay within the same file system (i.e., do not cross mount points).

    (emphasis mine) IIUC bind mounts may break the assumption of "same filesystem == same mount point"? So would any filesystem mounted multiple times under different locations.

  15. lukateras commented on Jan 1, 2018

    @lukateras
    Member

    Try to apply the following patch on top of master:

    diff --git a/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c b/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c
    index c03a1710f45..e4ee66dbd16 100644
    --- a/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c
    +++ b/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c
    @@ -70,7 +70,7 @@ void spit(const char *path, char *fmt, ...) {
     
     int nftw_remove(const char *path, const struct stat *sb, int type,
                     struct FTW *ftw) {
    -  return remove(path);
    +  g_message("%s: %lu", path, sb->st_dev);
     }
     
     int main(gint argc, gchar **argv) {
    @@ -125,8 +125,7 @@ int main(gint argc, gchar **argv) {
         int status;
     
         fail_if(waitpid(cpid, &status, 0) != cpid);
    -    fail_if(nftw(prefix, nftw_remove, getdtablesize(),
    -                 FTW_DEPTH | FTW_MOUNT | FTW_PHYS));
    +    fail_if(nftw(prefix, nftw_remove, getdtablesize(), 0));
     
         if (WIFEXITED(status))
           return WEXITSTATUS(status);
    
    

    Build with:

    nix-build -E "with import <nixpkgs> {}; callPackage ./pkgs/build-support/build-fhs-userenv/chrootenv { }"
    

    Output:

    ** Message: /tmp/chrootenvP79BCZ: 27
    ** Message: /tmp/chrootenvP79BCZ/boot: 27
    ** Message: /tmp/chrootenvP79BCZ/home: 27
    ** Message: /tmp/chrootenvP79BCZ/dev: 27
    ** Message: /tmp/chrootenvP79BCZ/proc: 27
    ** Message: /tmp/chrootenvP79BCZ/sys: 27
    ** Message: /tmp/chrootenvP79BCZ/run: 27
    ** Message: /tmp/chrootenvP79BCZ/tmp: 27
    ** Message: /tmp/chrootenvP79BCZ/var: 27
    ** Message: /tmp/chrootenvP79BCZ/root: 27
    ** Message: /tmp/chrootenvP79BCZ/nix: 27
    ** Message: /tmp/chrootenvP79BCZ/host: 27
    

    This seems to be done at kernel level. It seems to me that directories are iterated through only inside the mount namespace (i.e. in the child process), and not outside of it, although that doesn't explain why I can't reproduce it anyway.

  16. pbogdan commented on Jan 1, 2018

    @pbogdan
    Member

    Oh yes - I don't think this is reproducible on master at all. I only remain curious why this would occur at all in the first place. It seems FTW_MOUNT is not doing what its name implies, and atexit firing in the child as well as the parent caused the issue (the child may inherit the callbacks if it doesn't reach successful http://man7.org/linux/man-pages/man3/exec.3.html invocation AFAICT?).

    In any case - thank you for your patience, fixing this and all your work on steam (and all other nixpkgs work) :-) It's very much appreciated!

  17. lukateras commented on Jan 1, 2018

    @lukateras
    Member

    It seems FTW_MOUNT is not doing what its name implies [...]

    Patch above removes FTW_MOUNT, so it goes beyond this flag. Also I don't see any logic that would handle that in glibc nftw implementation. It seems that some syscalls work differently in mount namespace, or more probably, rather, outside of it: i.e. maybe namespaced mounts are not listable outside of the namespace. That seems to be most logical to me of all explanations so far.

    atexit firing in the child as well as the parent caused the issue [...]

    Perhaps: but nftw won't return until it recursively removes all files, and parent blocks until child exits, so parent should have nothing to clean up after child. It seems that some syscalls work differently inside child (which is in a mount namespace) and outside in parent (which hasn't called unshare and thus doesn't have a mount namespace).

    In any case - thank you for your patience, fixing this and all your work on steam (and all other nixpkgs work) :-) It's very much appreciated!

    No problem! ^_^

  18. illegalprime commented on Feb 16, 2019

    @illegalprime
    Member

    @yegortimoshenko I've been seeing this occasionally (like once every couple of hundred runs) and I've been trying to track it down, just got some nice log output. Here's my modified chrootenv.c:

    int nftw_remove(const char *path, const struct stat *sb, int type,
                    struct FTW *ftw) {
      g_message("%s: %lu [%d]", path, sb->st_dev, type);
      if (type == FTW_DP) {
        GError* error;
        GDir* dir = g_dir_open(path, 0, &error);
        const gchar* filename;
        while ((filename = g_dir_read_name(dir))) {
          printf("%s - %s\n", path, filename);
        }
      }
      return remove(path);
    }

    (so the above prints the path and then anything inside of it if it's a directory)
    Here's my log output:

    ** Message: 13:04:29.710: /tmp/chrootenv2QXFXZ/usr: 44 [4]
    ** Message: 13:04:29.712: /tmp/chrootenv2QXFXZ/sbin: 44 [4]
    ** Message: 13:04:29.712: /tmp/chrootenv2QXFXZ/lib64: 44 [4]
    ** Message: 13:04:29.712: /tmp/chrootenv2QXFXZ/lib32: 44 [4]
    ** Message: 13:04:29.712: /tmp/chrootenv2QXFXZ/lib: 44 [4]
    ** Message: 13:04:29.712: /tmp/chrootenv2QXFXZ/etc: 44 [4]
    ** Message: 13:04:29.712: /tmp/chrootenv2QXFXZ/bin: 44 [4]
    ** Message: 13:04:29.712: /tmp/chrootenv2QXFXZ/host: 44 [5]
    ** Message: 13:04:29.756: /tmp/chrootenv2QXFXZ/tmp: 44 [5]
    ** Message: 13:04:29.780: /tmp/chrootenv2QXFXZ/home: 44 [5]
    ** Message: 13:04:29.799: /tmp/chrootenv2QXFXZ/proc: 44 [5]
    ** Message: 13:04:29.826: /tmp/chrootenv2QXFXZ/var: 44 [5]
    ** Message: 13:04:29.849: /tmp/chrootenv2QXFXZ/dev: 44 [5]
    ** Message: 13:04:29.877: /tmp/chrootenv2QXFXZ/sys: 44 [5]
    ** Message: 13:04:29.906: /tmp/chrootenv2QXFXZ/root: 44 [5]
    ** Message: 13:04:29.936: /tmp/chrootenv2QXFXZ/opt: 44 [5]
    ** Message: 13:04:29.959: /tmp/chrootenv2QXFXZ/boot: 44 [5]
    ** Message: 13:04:29.992: /tmp/chrootenv2QXFXZ/open-data: 44 [5]
    ** Message: 13:04:30.022: /tmp/chrootenv2QXFXZ/keybase: 44 [5]
    ** Message: 13:04:30.049: /tmp/chrootenv2QXFXZ/lost+found: 44 [5]
    ** Message: 13:04:30.069: /tmp/chrootenv2QXFXZ/run: 44 [5]
    ** Message: 13:04:30.099: /tmp/chrootenv2QXFXZ/srv: 44 [5]
    ** Message: 13:04:30.140: /tmp/chrootenv2QXFXZ/nix: 44 [5]
    ** Message: 13:04:30.176: /tmp/chrootenv2QXFXZ/mnt: 44 [5]
    ** Message: 13:04:30.195: /tmp/chrootenv2QXFXZ: 44 [5]
    /tmp/chrootenv2QXFXZ - open-data
    
    ** (process:2537): ERROR **: 13:04:30.196: main: nftw(prefix, nftw_remove, getdtablesize(), FTW_DEPTH | FTW_MOUNT | FTW_PHYS): Directory not empty
    Trace/breakpoint trap (core dumped)
    

    It looks like remove was being called on the root of the chroot but the directory open-data was still inside of it! (this is a directory that sits at my root directory /open-data, it's just a mounted 4TB ext4 HDD).

    But from the logs remove was already called on open-data! And it returned successfully since we return and check the error code (I assume).

    So is this just an issue about calling sync after a remove?
    hmm...

  19. illegalprime commented on Feb 16, 2019

    @illegalprime
    Member

    UPDATE: I just realized since things aren't being cleaned up I still have those files around in /tmp:

    $ tree -a /tmp/chrootenv2QXFXZ
    /tmp/chrootenv2QXFXZ
    └── open-data
        └── michael
            └── fresh-cache
    
    3 directories, 0 files
    

    this path is significant because this is where I was running my FHSEnv-ed app from.
    my test setup was basically:

    $ cd /open-data/michael/fresh-cache
    $ nix-build ../test-fhs/test.nix
    $ while :; do result/bin/test; done
    

    EDIT: but why wasn't this path visited by nftw? something with open-data being a bind mount?

  20. illegalprime commented on Feb 16, 2019

    @illegalprime
    Member

    another update, I also seem to have a lot of chroots which aren't getting cleaned up:

    $ tree -a /tmp/chrootenvSH7LXZ 
    /tmp/chrootenvSH7LXZ
    ├── bin -> /nix/store/i86sk8q465m290nz6qrnwp7r7c5flgw6-test-fhs/bin
    ├── boot
    ├── dev
    ├── etc -> /nix/store/i86sk8q465m290nz6qrnwp7r7c5flgw6-test-fhs/etc
    ├── home
    ├── host
    ├── keybase
    ├── lib -> /nix/store/i86sk8q465m290nz6qrnwp7r7c5flgw6-test-fhs/lib
    ├── lib32 -> /nix/store/i86sk8q465m290nz6qrnwp7r7c5flgw6-test-fhs/lib32
    ├── lib64 -> /nix/store/i86sk8q465m290nz6qrnwp7r7c5flgw6-test-fhs/lib64
    ├── lost+found
    ├── mnt
    ├── nix
    ├── open-data
    ├── opt
    ├── proc
    ├── root
    ├── run
    ├── sbin -> /nix/store/i86sk8q465m290nz6qrnwp7r7c5flgw6-test-fhs/sbin
    ├── srv
    ├── sys
    ├── tmp
    ├── usr -> /nix/store/i86sk8q465m290nz6qrnwp7r7c5flgw6-test-fhs/usr
    └── var
    

    specifically:

    $ find /tmp -maxdepth 1 -type d -name 'chrootenv*' | wc -l
    13
    

    only 2 are in the error state described in my previous comment while the rest are 'full' as above.

    but i've been running this chroot app hundreds of times to try to hit this bug, so 13 not cleaned up is a small number.

  21. lukateras commented on Feb 17, 2019

    @lukateras
    Member

    Thinking we should drop chrootenv in favor of bwrap (@jtojnar suggested that a long time ago, and was right all along).

  22. illegalprime commented on Feb 17, 2019

    @illegalprime
    Member

    i'll try to make a bwrap version and post my progress, seems promising.

  23. illegalprime commented on Feb 17, 2019

    @illegalprime
    Member

    @yegortimoshenko this is what i have so far, seems to work OK:
    master...illegalprime:chrootenv-2-bwrap

    I'd like to add a feature here that let's users add custom bind mounts during runtime (like docker's -v /host:/target), should this just be an environment variable to pass extra opts to bwrap? That feels a bit hacky to me.
    UPDATE: implemented this with build-time options, not the same but enough for my use case

  24. removed their assignment
    on Dec 16, 2019
  25. stale commented on Jun 13, 2020

    @stale

    Thank you for your contributions.

    This has been automatically marked as stale because it has had no activity for 180 days.

    If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

    Here are suggestions that might help resolve this more quickly:

    1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
    2. Ask on the NixOS Discourse.
    3. Ask on the #nixos channel on irc.freenode.net.
  26. added
    2.status: stale
    on Jun 13, 2020
  27. siraben commented on Apr 10, 2021

    @siraben
    Member

    Still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions