Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 208266 - Impossible mknod's in sys-kernel/genkernel linuxrc
Summary: Impossible mknod's in sys-kernel/genkernel linuxrc
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2008-01-31 05:05 UTC by John Klug
Modified: 2008-02-26 03:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Klug 2008-01-31 05:05:34 UTC
I just ran into this because of a mistake I made.  There are mknod's for /dev/tty1 and /dev/console that can never be successful in work/genkernel-3.4.9/generic/linuxrc.  Comments and the code require that CHROOT & NEWROOT always be read-only.  I would suggest that instead they should check for the existence of devices and if they don't exist, print an error.  Another possibility might be a mount of /dev from the ramfs to the mounted root file system.

3.4.9 line numbers:

302:	[ ! -e ${NEW_ROOT}/dev/null ] && mknod ${NEW_ROOT}/dev/null c 1 3
303:	[ ! -e ${NEW_ROOT}/dev/console ] && mknod ${NEW_ROOT}/dev/console c 5 1
308:		[ ! -e ${NEW_ROOT}/dev/sr0 ] && mknod ${NEW_ROOT}/dev/sr0 b 11 0
309:		[ ! -e ${NEW_ROOT}/dev/loop0 ] && mknod ${NEW_ROOT}/dev/loop0 b 7 0
316:		[ ! -e ${NEW_ROOT}/dev/tty1 ] && mknod ${NEW_ROOT}/dev/tty1 c 4 1
733:	[ ! -e ${CHROOT}/dev/console ] && mknod ${CHROOT}/dev/console c 5 1
784:	[ ! -e ${CHROOT}/dev/console ] && mknod ${CHROOT}/dev/console c 5 1
785:	[ ! -e ${CHROOT}/dev/tty1 ] && mknod ${CHROOT}/dev/tty1 c 4 1
Comment 1 Chris Gianelloni (RETIRED) gentoo-dev 2008-01-31 22:33:01 UTC
Are you seeing actual errors?  If so, what?
Comment 2 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-01 00:00:01 UTC
Looking at the code right before that, there is a tmpfs mounted at ${NEW_ROOT}. That is definitely not read-only. What exactly happened and what was your mistake?
Comment 3 John Klug 2008-02-02 03:06:09 UTC
(In reply to comment #2)
> That is definitely not read-only. What exactly happened and what was your
> mistake?
> 
My mistake was not having /dev populated with console & tty1 (mistakenly deleted stuff under /dev before booting, not realizing it had come from stage1).  It was several days before I could boot, because I tried to install root into a 2048 byte sector flash drive, which grub fails.  Anyway, I forgot what I had done.  I had to install into a flash drive because my system had AHCI/SATA hard drives, and fdisk refused to read them.

I missed the CDROM case in the init script that mounted root with tmpfs.  Otherwise if it is not a CD, root is mounted read-only.  When root is mounted read-only mknod fails, so you better have nodes present under /dev for that case.

In the read-only case would be better to just check for the presence of /dev/console and /dev/tty1 and print a message, rather than doing a mknod and leading one to believe that somehow root was mounted read-only by mistake.  After I read the script and realized that mknod was conditional, and I had no /dev devices, my error became clear.

Relevant output:

root block device() :: /dev/sdb2
>> Mounting root
mknod: /newroot/dev/console: Read-only file system
mknod: /newroot/dev/tty1: Read-only file system
>> Booting (initramfs)
switch_root: Bad Console '/dev/console'
Kernel panic ...
Comment 4 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-02 18:27:55 UTC
Ok, it looks like you're triggering the mknod statements at line 783 and 784, which should only happen if the linuxrc is named /init. Why is your linuxrc named /init? What kind of crazy things are you doing?
Comment 5 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-02 18:29:42 UTC
Okay, nevermind. It's been pointed out to me that in an initramfs (as opposed to an initrd), the linuxrc is named /init to let the linuxrc know which it was booted from.
Comment 6 Chris Gianelloni (RETIRED) gentoo-dev 2008-02-14 04:35:42 UTC
OK, I've fixed this in SVN.  It'll be in the next genkernel (3.4.10_pre2)...
Comment 7 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-26 03:16:03 UTC
This was released in 3.4.10_pre2.