"/dev/fd/63 No such file or directory"
Solution 1
TL;DR: copy the /root
folder outside chroot into the chroot directory
The <(...)
operator is known as process substitution and is a way to run command, output of which goes into anonymous pipe. That's what /dev/fd/63 is. The idea is to allow external command ( here it's bash
) to treat another commands output as if it was a file. Generally the form would be to use <
to redirect that pseudo-file object into bash
's input stream.
bash < <(wget -q0 https://raw.githubusercontent.com/ubports/unity8-desktop-install-tools/master/install.sh)
This is generally no different from wget https://stuff.com/blah | bash
. In both cases, it's generally not recommended to use such commands unless you're hundred percent sure the script you're downloading isn't from sketchy source and isn't malware.
However, since you've mentioned running command in chroot
and the script outputs No such file or directory root
, and because bash allows running scripts as bash script.sh
here your script is being executed, but there's no directory named root
in your chroot. You could just fix it via sudo cp -R /root chrootdir
. For better results I'd suggest just reading the script first, see what it needs, and copy that to the chroot folder, and only then run the script locally within the folder. No need to run wget multiple times
So the script works. Errors in shell scripting generally in form <shell>: <command user typed>: error message
so the script being temporarily stored as /dev/fd/63 and runs, it just doesn't find what it needs.
See also,
Solution 2
Error message
/dev/fd/63 No such file or directory
Problem source
Indeed the directory /dev/fd/
did not exist on that machine.
Solution
The solution was to create a symbolic link from /proc/self/fd
to /dev/fd
like so:
ln -s /proc/self/fd /dev/fd
Process substitution <(..)
wouldn't work on QNAP without this.
Radu
Updated on September 18, 2022Comments
-
Radu over 1 year
I've been trying to run a command in chroot (pretty new to this), and I get the following output.
root@hostname:~ # bash <(wget -q0 https://raw.githubusercontent.com/ubports/unity8-desktop-install-tools/master/install.sh) bash: /dev/fd/63: No such file or directory root
-
Radu over 5 yearsSeems to have worked. Thanks. Also, the script is legitimate, and is just to try some stuff in a VM, anyhow, so no security risk.
-
jmary almost 4 yearsPlease provide answers in the context ... Why do you mention "if you are coming from search engine" ?
-
fredericrous almost 4 yearsI updated my answer. why did you minus 1 my answer? I think this addition will help people in the future
-
jmary almost 4 yearsBecause "the mention if you are coming from search engine" doesn't make sense in context. Also you provide a "magic" command which is writting into a system directory without explaining why it is safe to do this. Sorry I don't mean to be rude. Please edit your reply so that newbies can use what you explain with confidence.
-
fredericrous almost 4 yearsYou are being rude but at least your second message was constructive. Is my answer better now? I believe a newbie doesn't mess with process substitution.
-
fredericrous almost 4 yearsto add more on my previous comment, I believe the mention "if you are coming from a search engine" does put things in context. My message applies in a different context than the original question. no chroot here