You are not logged in.
When I boot into OpenWrt, and I want to chroot into my Arch partition on that box, I find that package updates therein cannot trigger mkinitcpio due to OpenWrt lacking /dev/fd/63. Will this eventually be a problem if I go to boot Arch on that box?
Example updating via chrooting into the Arch partition:
# pacman -Syu
:: Synchronizing package databases...
core 131.8 KiB 206 KiB/s 00:01 [############################################] 100%
extra 8.3 MiB 9.41 MiB/s 00:01 [############################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
Packages (5) fakeroot-1.32.1-1 libnghttp2-1.55.1-1 linux-6.4.3.arch1-1 pacman-contrib-1.9.1-1 sudo-1.9.14.p1-1
Total Download Size: 83.55 MiB
Total Installed Size: 133.49 MiB
Net Upgrade Size: 0.22 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
libnghttp2-1.55.1-1-x86_64 95.6 KiB 165 KiB/s 00:01 [############################################] 100%
fakeroot-1.32.1-1-x86_64 69.7 KiB 118 KiB/s 00:01 [############################################] 100%
pacman-contrib-1.9.1-1-x86_64 48.5 KiB 30.5 KiB/s 00:02 [############################################] 100%
linux-6.4.3.arch1-1-x86_64 81.6 MiB 35.9 MiB/s 00:02 [############################################] 100%
sudo-1.9.14.p1-1-x86_64 1828.0 KiB 759 KiB/s 00:02 [############################################] 100%
Total (5/5) 83.5 MiB 34.2 MiB/s 00:02 [############################################] 100%
(5/5) checking keys in keyring [############################################] 100%
(5/5) checking package integrity [############################################] 100%
(5/5) loading package files [############################################] 100%
(5/5) checking for file conflicts [############################################] 100%
:: Running pre-transaction hooks...
(1/1) Removing linux initcpios...
/usr/share/libalpm/scripts/mkinitcpio: line 23: /dev/fd/63: No such file or directory
/usr/share/libalpm/scripts/mkinitcpio: line 23: /dev/fd/63: No such file or directory
:: Processing package changes...
(1/5) upgrading fakeroot [############################################] 100%
(2/5) upgrading libnghttp2 [############################################] 100%
(3/5) upgrading linux [############################################] 100%
(4/5) upgrading pacman-contrib [############################################] 100%
(5/5) upgrading sudo [############################################] 100%
warning: /etc/sudoers installed as /etc/sudoers.pacnew
:: Running post-transaction hooks...
(1/5) Reloading system manager configuration...
Skipped: Running in chroot.
(2/5) Creating temporary files...
(3/5) Arming ConditionNeedsUpdate...
(4/5) Updating module dependencies...
(5/5) Updating linux initcpios...
/usr/share/libalpm/scripts/mkinitcpio: line 23: /dev/fd/63: No such file or directoryEDIT: Allowing the liinux package to update without regenerating the images allowed booting but no USB keyboard access was present.
Last edited by graysky (2023-07-16 11:40:23)
Offline
You (bash) can't "bar <(foo)"
Unless you forgot some important chrooting steps the problem is that there's probably no devtmpfs, check the output of "mount" on openwrt and what it mounts at /dev (probably just tmpfs)
Bash scripts during the init will not have executed properly, so your initramfs is probably trash.
That could become a problem, yes.
Apparently devtmpfs defaults to NO on openwrt?
https://openwrt.org/docs/guide-develope … aries#udev
Offline
FWIW, "without /dev/fd/63" is meaningless (my current shell in arch linux is without this as well). /dev/fd is just a symlink to the active process's own open file descriptor list, and 63 is just an arbitrary number that the process active at that time (likely a bash subshell) had assigned to some file descriptor it opened (in this case, for a pipe from a process-substitution subshell).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
You (bash) can't "bar <(foo)"
Unless you forgot some important chrooting steps the problem is that there's probably no devtmpfs, check the output of "mount" on openwrt and what it mounts at /dev (probably just tmpfs)Bash scripts during the init will not have executed properly, so your initramfs is probably trash.
That could become a problem, yes.Apparently devtmpfs defaults to NO on openwrt?
https://openwrt.org/docs/guide-develope … aries#udev
Here is the script I use to chroot into the Arch partition:
# cat /root/bin/archchroot.sh
#!/bin/sh
if ! mountpoint -q /mnt/arch; then
mount LABEL=arch /mnt/arch
fi
cd /mnt/arch || exit
mount -t proc /proc proc/
mount -t sysfs /sys sys/
mount -o bind /dev dev/
chroot /mnt/arch /bin/zsh
echo
echo "when done run: umount --recursive /mnt/arch"I built my image of OpenWrt with devtmpfs enabled. Here is how OW is mounting:
# mount|grep tmpfs
devtmpfs on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=7900332k,nr_inodes=1975083,mode=755)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,nosuid,noexec,noatime,size=512k,mode=755)FWIW, "without /dev/fd/63" is meaningless (my current shell in arch linux is without this as well). /dev/fd is just a symlink to the active process's own open file descriptor list,
Even with build OW with devtmpfs enabled, there is no /dev/fd created... I can manually do it (and add this to /etc/rc.local). That allowed mkinitcpio to run in the chroot without error.
# ln -s /proc/self/fd /dev/fdOffline
/dev/fd has been around since 1985. I find it hard to believe that OpenWrt is not supposed to have it. Does it have /dev/{stdin,stdout,stderr} links?
I'd also be curious - if openWrt truly doesn't have /dev/fd, then does it simply not support any shells that would use it, or does openwrt patch all the shells to access /proc/self/fd instead? Frankly none of this really adds up.
Last edited by Trilby (2023-07-17 12:23:17)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Here is on an embedded device compiled without CONFIG_KERNEL_DEVTMPFS=y and CONFIG_KERNEL_DEVTMPFS_MOUNT=y we can use as a control.
# ls -l /dev
drwxr-xr-x 2 root root 0 Dec 31 1969 pts
crw------- 1 root root 5, 1 Dec 31 1969 console
crw-rw-rw- 1 root root 1, 7 Dec 31 1969 full
crw------- 1 root root 254, 0 Dec 31 1969 gpiochip0
crw------- 1 root root 10, 183 Dec 31 1969 hwrng
crw------- 1 root root 1, 11 Dec 31 1969 kmsg
srw-rw-rw- 1 root root 0 Jul 6 08:37 log
crw------- 1 root root 10, 237 Dec 31 1969 loop-control
brw------- 1 root root 7, 0 Dec 31 1969 loop0
brw------- 1 root root 7, 1 Dec 31 1969 loop1
brw------- 1 root root 7, 2 Dec 31 1969 loop2
brw------- 1 root root 7, 3 Dec 31 1969 loop3
brw------- 1 root root 7, 4 Dec 31 1969 loop4
brw------- 1 root root 7, 5 Dec 31 1969 loop5
brw------- 1 root root 7, 6 Dec 31 1969 loop6
brw------- 1 root root 7, 7 Dec 31 1969 loop7
crw------- 1 root root 90, 0 Dec 31 1969 mtd0
crw------- 1 root root 90, 1 Dec 31 1969 mtd0ro
crw------- 1 root root 90, 2 Dec 31 1969 mtd1
crw------- 1 root root 90, 3 Dec 31 1969 mtd1ro
crw------- 1 root root 90, 4 Dec 31 1969 mtd2
crw------- 1 root root 90, 5 Dec 31 1969 mtd2ro
crw------- 1 root root 90, 6 Dec 31 1969 mtd3
crw------- 1 root root 90, 7 Dec 31 1969 mtd3ro
crw------- 1 root root 90, 8 Dec 31 1969 mtd4
crw------- 1 root root 90, 9 Dec 31 1969 mtd4ro
crw------- 1 root root 90, 10 Dec 31 1969 mtd5
crw------- 1 root root 90, 11 Dec 31 1969 mtd5ro
brw------- 1 root root 31, 0 Dec 31 1969 mtdblock0
brw------- 1 root root 31, 1 Dec 31 1969 mtdblock1
brw------- 1 root root 31, 2 Dec 31 1969 mtdblock2
brw------- 1 root root 31, 3 Dec 31 1969 mtdblock3
brw------- 1 root root 31, 4 Dec 31 1969 mtdblock4
brw------- 1 root root 31, 5 Dec 31 1969 mtdblock5
crw-rw-rw- 1 root root 1, 3 Dec 31 1969 null
crw------- 1 root root 1, 4 Dec 31 1969 port
crw------- 1 root root 108, 0 Jul 6 08:37 ppp
crw-rw-rw- 1 root root 5, 2 Jul 17 08:02 ptmx
crw-rw-rw- 1 root root 1, 8 Dec 31 1969 random
lrwxrwxrwx 1 root root 8 Dec 31 1969 shm -> /tmp/shm
lrwxrwxrwx 1 root root 15 Dec 31 1969 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Dec 31 1969 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Dec 31 1969 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Dec 31 1969 tty
crw-rw---- 1 root dialout 4, 64 Dec 31 1969 ttyS0
crw-rw---- 1 root dialout 4, 65 Dec 31 1969 ttyS1
crw-rw---- 1 root dialout 4, 66 Dec 31 1969 ttyS2
crw------- 1 root root 250, 0 Dec 31 1969 ubi0
crw------- 1 root root 250, 1 Dec 31 1969 ubi0_0
crw------- 1 root root 250, 2 Dec 31 1969 ubi0_1
crw------- 1 root root 250, 3 Dec 31 1969 ubi0_2
crw------- 1 root root 250, 4 Dec 31 1969 ubi0_3
crw------- 1 root root 250, 5 Dec 31 1969 ubi0_4
crw------- 1 root root 10, 127 Dec 31 1969 ubi_ctrl
brw------- 1 root root 254, 0 Dec 31 1969 ubiblock0_3
brw------- 1 root root 259, 0 Dec 31 1969 ubiblock0_3p1
crw-rw-rw- 1 root root 1, 9 Dec 31 1969 urandom
crw------- 1 root root 10, 130 Dec 31 1969 watchdog
crw------- 1 root root 252, 0 Dec 31 1969 watchdog0
crw-rw-rw- 1 root root 1, 5 Dec 31 1969 zeroHere is on the x86/64 hardware where I built the image with those two options enabled. Again, I manually created the symlink fd:
# ls -l /dev
total 0
drwxr-xr-x 3 root root 60 Jul 17 07:08 bus
drwxr-xr-x 18 root root 360 Jul 17 07:08 cpu
drwxr-xr-x 2 root root 80 Jul 17 07:08 dri
lrwxrwxrwx 1 root root 13 Jul 17 07:08 fd -> /proc/self/fd
drwxr-xr-x 2 root root 0 Jul 17 07:08 pts
lrwxrwxrwx 1 root root 8 Jul 17 07:08 shm -> /tmp/shm
crw------- 1 root root 5, 1 Jul 17 07:08 console
crw------- 1 root root 10, 125 Jul 17 07:08 cpu_dma_latency
crw------- 1 root root 10, 124 Jul 17 07:08 crypto
crw-rw-rw- 1 root root 1, 7 Jul 17 07:08 full
crw------- 1 root root 10, 228 Jul 17 07:08 hpet
crw------- 1 root root 10, 183 Jul 17 07:08 hwrng
crw------- 1 root root 89, 0 Jul 17 07:08 i2c-0
crw------- 1 root root 89, 1 Jul 17 07:08 i2c-1
crw------- 1 root root 89, 2 Jul 17 07:08 i2c-2
crw------- 1 root root 89, 3 Jul 17 07:08 i2c-3
crw------- 1 root root 89, 4 Jul 17 07:08 i2c-4
crw------- 1 root root 89, 5 Jul 17 07:08 i2c-5
crw------- 1 root root 89, 6 Jul 17 07:08 i2c-6
crw------- 1 root root 89, 7 Jul 17 07:08 i2c-7
crw------- 1 root root 89, 8 Jul 17 07:08 i2c-8
crw------- 1 root root 89, 9 Jul 17 07:08 i2c-9
crw------- 1 root root 1, 11 Jul 17 07:08 kmsg
srw-rw-rw- 1 root root 0 Jul 17 07:08 log
crw------- 1 root root 10, 237 Jul 17 07:08 loop-control
brw------- 1 root root 7, 0 Jul 17 07:08 loop0
brw------- 1 root root 7, 1 Jul 17 07:08 loop1
brw------- 1 root root 7, 2 Jul 17 07:08 loop2
brw------- 1 root root 7, 3 Jul 17 07:08 loop3
brw------- 1 root root 7, 4 Jul 17 07:08 loop4
brw------- 1 root root 7, 5 Jul 17 07:08 loop5
brw------- 1 root root 7, 6 Jul 17 07:08 loop6
brw------- 1 root root 7, 7 Jul 17 07:08 loop7
crw------- 1 root root 247, 0 Jul 17 07:08 ng0n1
crw-rw-rw- 1 root root 1, 3 Jul 17 07:08 null
crw------- 1 root root 248, 0 Jul 17 07:08 nvme0
brw------- 1 root root 259, 0 Jul 17 07:08 nvme0n1
brw------- 1 root root 259, 1 Jul 17 07:08 nvme0n1p1
brw------- 1 root root 259, 5 Jul 17 07:08 nvme0n1p128
brw------- 1 root root 259, 2 Jul 17 07:08 nvme0n1p2
brw------- 1 root root 259, 3 Jul 17 07:08 nvme0n1p3
brw------- 1 root root 259, 4 Jul 17 07:08 nvme0n1p4
crw------- 1 root root 10, 144 Jul 17 07:08 nvram
crw------- 1 root root 1, 4 Jul 17 07:08 port
crw------- 1 root root 108, 0 Jul 17 07:08 ppp
crw------- 1 root root 245, 0 Jul 17 07:08 pps0
crw-rw-rw- 1 root root 5, 2 Jul 17 08:26 ptmx
crw------- 1 root root 244, 0 Jul 17 07:08 ptp0
crw-rw-rw- 1 root root 1, 8 Jul 17 07:08 random
crw------- 1 root root 251, 0 Jul 17 07:08 rtc0
lrwxrwxrwx 1 root root 15 Jul 17 07:08 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Jul 17 07:08 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Jul 17 07:08 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Jul 17 07:08 tty
crw-rw---- 1 root dialout 4, 0 Jul 17 07:08 tty0
crw-rw---- 1 root dialout 4, 1 Jul 17 07:08 tty1
crw-rw---- 1 root dialout 4, 10 Jul 17 07:08 tty10
crw-rw---- 1 root dialout 4, 11 Jul 17 07:08 tty11
crw-rw---- 1 root dialout 4, 12 Jul 17 07:08 tty12
crw-rw---- 1 root dialout 4, 13 Jul 17 07:08 tty13
crw-rw---- 1 root dialout 4, 14 Jul 17 07:08 tty14
crw-rw---- 1 root dialout 4, 15 Jul 17 07:08 tty15
crw-rw---- 1 root dialout 4, 16 Jul 17 07:08 tty16
crw-rw---- 1 root dialout 4, 17 Jul 17 07:08 tty17
crw-rw---- 1 root dialout 4, 18 Jul 17 07:08 tty18
crw-rw---- 1 root dialout 4, 19 Jul 17 07:08 tty19
crw-rw---- 1 root dialout 4, 2 Jul 17 07:08 tty2
crw-rw---- 1 root dialout 4, 20 Jul 17 07:08 tty20
crw-rw---- 1 root dialout 4, 21 Jul 17 07:08 tty21
crw-rw---- 1 root dialout 4, 22 Jul 17 07:08 tty22
crw-rw---- 1 root dialout 4, 23 Jul 17 07:08 tty23
crw-rw---- 1 root dialout 4, 24 Jul 17 07:08 tty24
crw-rw---- 1 root dialout 4, 25 Jul 17 07:08 tty25
crw-rw---- 1 root dialout 4, 26 Jul 17 07:08 tty26
crw-rw---- 1 root dialout 4, 27 Jul 17 07:08 tty27
crw-rw---- 1 root dialout 4, 28 Jul 17 07:08 tty28
crw-rw---- 1 root dialout 4, 29 Jul 17 07:08 tty29
crw-rw---- 1 root dialout 4, 3 Jul 17 07:08 tty3
crw-rw---- 1 root dialout 4, 30 Jul 17 07:08 tty30
crw-rw---- 1 root dialout 4, 31 Jul 17 07:08 tty31
crw-rw---- 1 root dialout 4, 32 Jul 17 07:08 tty32
crw-rw---- 1 root dialout 4, 33 Jul 17 07:08 tty33
crw-rw---- 1 root dialout 4, 34 Jul 17 07:08 tty34
crw-rw---- 1 root dialout 4, 35 Jul 17 07:08 tty35
crw-rw---- 1 root dialout 4, 36 Jul 17 07:08 tty36
crw-rw---- 1 root dialout 4, 37 Jul 17 07:08 tty37
crw-rw---- 1 root dialout 4, 38 Jul 17 07:08 tty38
crw-rw---- 1 root dialout 4, 39 Jul 17 07:08 tty39
crw-rw---- 1 root dialout 4, 4 Jul 17 07:08 tty4
crw-rw---- 1 root dialout 4, 40 Jul 17 07:08 tty40
crw-rw---- 1 root dialout 4, 41 Jul 17 07:08 tty41
crw-rw---- 1 root dialout 4, 42 Jul 17 07:08 tty42
crw-rw---- 1 root dialout 4, 43 Jul 17 07:08 tty43
crw-rw---- 1 root dialout 4, 44 Jul 17 07:08 tty44
crw-rw---- 1 root dialout 4, 45 Jul 17 07:08 tty45
crw-rw---- 1 root dialout 4, 46 Jul 17 07:08 tty46
crw-rw---- 1 root dialout 4, 47 Jul 17 07:08 tty47
crw-rw---- 1 root dialout 4, 48 Jul 17 07:08 tty48
crw-rw---- 1 root dialout 4, 49 Jul 17 07:08 tty49
crw-rw---- 1 root dialout 4, 5 Jul 17 07:08 tty5
crw-rw---- 1 root dialout 4, 50 Jul 17 07:08 tty50
crw-rw---- 1 root dialout 4, 51 Jul 17 07:08 tty51
crw-rw---- 1 root dialout 4, 52 Jul 17 07:08 tty52
crw-rw---- 1 root dialout 4, 53 Jul 17 07:08 tty53
crw-rw---- 1 root dialout 4, 54 Jul 17 07:08 tty54
crw-rw---- 1 root dialout 4, 55 Jul 17 07:08 tty55
crw-rw---- 1 root dialout 4, 56 Jul 17 07:08 tty56
crw-rw---- 1 root dialout 4, 57 Jul 17 07:08 tty57
crw-rw---- 1 root dialout 4, 58 Jul 17 07:08 tty58
crw-rw---- 1 root dialout 4, 59 Jul 17 07:08 tty59
crw-rw---- 1 root dialout 4, 6 Jul 17 07:08 tty6
crw-rw---- 1 root dialout 4, 60 Jul 17 07:08 tty60
crw-rw---- 1 root dialout 4, 61 Jul 17 07:08 tty61
crw-rw---- 1 root dialout 4, 62 Jul 17 07:08 tty62
crw-rw---- 1 root dialout 4, 63 Jul 17 07:08 tty63
crw-rw---- 1 root dialout 4, 7 Jul 17 07:08 tty7
crw-rw---- 1 root dialout 4, 8 Jul 17 07:08 tty8
crw-rw---- 1 root dialout 4, 9 Jul 17 07:08 tty9
crw-rw---- 1 root dialout 4, 64 Jul 17 07:08 ttyS0
crw-rw---- 1 root dialout 4, 65 Jul 17 07:08 ttyS1
crw-rw-rw- 1 root root 1, 9 Jul 17 07:08 urandom
crw------- 1 root root 7, 0 Jul 17 07:08 vcs
crw------- 1 root root 7, 1 Jul 17 07:08 vcs1
crw------- 1 root root 7, 128 Jul 17 07:08 vcsa
crw------- 1 root root 7, 129 Jul 17 07:08 vcsa1
crw------- 1 root root 7, 64 Jul 17 07:08 vcsu
crw------- 1 root root 7, 65 Jul 17 07:08 vcsu1
crw------- 1 root root 10, 127 Jul 17 07:08 vmci
crw------- 1 root root 10, 126 Jul 17 07:08 vsock
crw------- 1 root root 10, 130 Jul 17 07:08 watchdog
crw------- 1 root root 250, 0 Jul 17 07:08 watchdog0
crw-rw-rw- 1 root root 1, 5 Jul 17 07:08 zeroOffline
https://dev.archive.openwrt.org/ticket/14848
Edit, can't find a migrated bug on github, but that definitly was a thing.
Last edited by seth (2023-07-17 12:33:58)
Offline
I believe their bug tracker has been deprecated and all active tasks transitioned to github. I didn't find that on the github, but using the test case provided on my embedded device that does not have the /dev/fd symlink, works.
# wc < <(echo hello world)
1 2 12
# ls /dev/fd
ls: /dev/fd: No such file or directoryLast edited by graysky (2023-07-17 12:36:39)
Offline
So they've likey adapted the shell, you ran mkinitcpio from the chroot, ie. the vanilla gnu bash - does the above example work
* on the other system on openwrt
* on the other system chrooting into arch
?
Offline
I have quite a few OpenWrt devices and the above command works on all of them including the x86_64 box which has the Arch partition on it even after removing the symlink I manually created.
I think for now the hacky solution is for me to just have this in the OpenWrt /etc/rc.local:
[ ! -h /dev/fd ] && ln -s /proc/self/fd /dev/fdOffline
That seems like an acceptable workaround. But out of curiosity what was the shell used in post #8?
EDIT: given that process substitution is a "bashism" (though also implemented by other large/modern/featureful shells like zsh) perhaps this isn't so suprising as openwrt likely uses a more basic shell (once upon a time I'm pretty sure it was dash).
Last edited by Trilby (2023-07-17 14:16:55)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I used zsh for all tests
Offline
FWIW, I just checked and zsh seems to implement process substitution without relying on /dev/fd by default - though it can optionally use /dev/fd for some operations with `stat` calls if it is available.
Bash relies directly on /dev/fd for process substitution in arch, but bash source code has conditional compilation blocks depending on the preprocessor defintion of HAVE_DEV_FD, so it can be built to not require it (so bash could be available for openwrt without /dev/fd).
But using a bash shell compiled for arch under an openwrt devfs will require the symlink workaround.
Last edited by Trilby (2023-07-17 14:26:13)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
The default shell of openwrt is /bin/ash and the command does not work on that without the symlink consistent with your thoughts:
# which $SHELL
/bin/ash
# wc < <(echo hello world)
-ash: can't open /dev/fd/64: no such fileOffline
That's an interesting configuration / patchset to ash, as ash isn't even expected to support process substitution. Process substitution is not defined by POSIX, but really is just a z/bashism (and apparently it's an option in some versions of ksh).
It seems even more odd to have a patch/configuration for ash to give it a feature it wouldn't typically have when that feature depends on another feature that the distro doesn't provide.
Last edited by Trilby (2023-07-17 22:25:19)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline