/newroot is mounted read-only hence by default nothing can be created
below it unless /newroot/dev is mounted to something else.
unfortunately `test -w /newroot/dev` in initrd does not check whether
containing filesystem is mounted read-only
kmsg "geninitrd/$VERSION switching root"
umount_all
- busybox_applet switch_root usleep
+ busybox_applet switch_root usleep mountpoint
add_linuxrc <<-'EOF'
- [ ! -e /newroot/dev/console ] && mknod -m 660 /newroot/dev/console c 5 1
+ [ ! -e /newroot/dev/console ] && mountpoint -q /newroot/dev && mknod -m 660 /newroot/dev/console c 5 1
# switch root to empty dir will make kernel panic, so sleep 10s before it
# switch_root needs to be pid 1, so there's no other way to recover from here