[Buildroot] bash: /dev/fd/62: No such file or directory

Jörg Krause joerg.krause at embedded.rocks
Wed Apr 4 20:39:21 UTC 2018


On Wed, 2018-04-04 at 22:23 +0200, Peter Korsgaard wrote:
> > > > > > "Peter" == Peter Korsgaard <peter at korsgaard.com> writes:
> 
> Hi,
> 
>  >> It turned out that nothing needs to be done for static /dev as the
>  >> symlinks are created now by the init system.
> 
>  > But how can that work? static /dev normally means readonly /dev.
> 
> That didn't come out very clear. What I wanted to say is that static
> /dev should also work on a readonly fs, so these symlinks should be made
> at build time, not at runtime.

I see!

I've rebuild the system with BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=n.

Snippet of the inittab file:

   # Startup the system
   ::sysinit:/bin/mount -t proc proc /proc
   #::sysinit:/bin/mount -o remount,rw /
   ::sysinit:/bin/mkdir -p /dev/pts
   ::sysinit:/bin/mkdir -p /dev/shm
   ::sysinit:/bin/mount -a
   ::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
   ::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
   ::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
   ::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
   ::sysinit:/bin/hostname -F /etc/hostname

On the system /dev is still writable:

   # echo 1 > /dev/1.txt
   # echo 1 > /root/1.txt
   -sh: /root/1.txt: Read-only file system

   # ls -l /dev/fd/*
   ls: /dev/fd/255: No such file or directory
   ls: /dev/fd/3: No such file or directory
   lrwx------    1 root     root            64 Jan  1 00:09 /dev/fd/0 -> /dev/ttyS0
   lrwx------    1 root     root            64 Jan  1 00:09 /dev/fd/1 -> /dev/ttyS0
   lrwx------    1 root     root            64 Jan  1 00:09 /dev/fd/2 -> /dev/ttyS0

   # bash -c "cat <(date)"
   Thu Jan  1 00:10:07 UTC 1970

Jörg



More information about the buildroot mailing list