1

My goal is to standup a chroot with the basic Unix tool-set (bash, cp, touch, cat, etc) and any necessary dependencies need to run apt get inside a codespace. Using debootstrap gets me close. The basic tools are installed and I can run apt get. The problem is subprocess do not work. I expect the last line to print "test" but actually I get an error saying that the subprocess' file handle is no good. I would have thought the vanilla debootstrap environment would be sufficiently cooked so that subprocess work, but that does not seem to be the case. Is there a switch I can pass?

$ sudo apt-get install -y binutils debootstrap
$ cd /home/codespace
$ CHROOT=/home/codespace/chroot
$ mkdir -p "${CHROOT}"
$ sudo debootstrap stable "${CHROOT}" http://deb.debian.org/debian/
$ sudo chroot "${CHROOT}"
$ cat < <(echo test)
bash: /dev/fd/63: No such file or directory

To reproduce,

  • sign up for codespaces beta here.
  • fire up a codespace for this project, open a bash shell (ctrl+`).
  • run the above.

This also reproduces outside of codespace so any Ubuntu environment will probably yield similar results.

  • See also discussion here: https://github.com/orgs/github-community/discussions/19714#discussioncomment-3056844 – Christopher King Jul 01 '22 at 22:24
  • https://askubuntu.com/questions/1086617/dev-fd-63-no-such-file-or-directory. The post implies the after the last colon is emanating from the subproc. In my case the subproc is simply and echo statement so I don't see how that could generated "No such file or directory." I could replace the echo statement with a null statement -- just a colon and see if that changes anything. – Christopher King Jul 01 '22 at 22:41
  • The directory /proc/$$ is not resolving. This SO post answer discusses what /proc/self is and is not. Whatever it is, it isn't work in my chroot! – Christopher King Jul 01 '22 at 23:13

1 Answers1

0

Found the answer here. Turns out /proc was not mounted. To mount proc I ran

$ cd "${CHROOT}"
$ sudo mount --types proc /proc proc/

Now things work!

$ cat < <(echo test)
test