Unwritable device nodes on ro nfs

Denis Vlasenko
2004-09-13T12:52:08Z

Hi,

I am moving away from devfs. I have a problem
booting with ro nfs root fs.

I initialize network and mount nfs using an
initrd, then pivot_root into nfs mountpoint:

...
mount -n -t devfs none /new_root/dev
cd /new_root
# making sure we dont keep /dev busy
exec <dev/console >dev/console 2>&1
pivot_root . old_root
...
exec \
chroot . \
sh -c \
'umount -n /old_root; exec /bin/env - $INIT'

I removed "mount -n -t devfs" line and
now "exec >dev/console" fails because
/new_root is ro-mounted nfs. ro-mounted
local fs (reiser3) works fine.

Shall I jump thru the hoops, mount a ramfs
on top of new_root/dev, populate it with
device nodes, etc?

I don't want to do this, I want to hand a
'clean' state to secondary $INIT.

I can close all descriptors (exec <&- >&- 2>&-)
before I exec $INIT, and have $INIT deal with
that. This avoid the problem of >/dev/console.

But I lose the ability to boot with INIT=/bin/sh then.
sh doesn't expect to have stdio closed at startup.
Not good.

What is a 'right thing' to do in this situation?
--
vda