Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 256979

Summary: sys-fs/openrc-0.4.2 - /sbin/rc segfaults on empty /dev
Product: Gentoo Linux Reporter: Dennis Schridde <dschridde+gentoobugs>
Component: [OLD] baselayoutAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED NEEDINFO    
Severity: normal CC: jer, roy
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: /init script

Description Dennis Schridde 2009-01-30 19:54:37 UTC
I wiped my /dev directory, and am populating it on bootup using (busybox) "mdev -s" (using the attached /init script). Apparently some device nodes are missing for /sbin/rc, which makes it segfault.

The output is:
rc[729] segfault at 0 ip 400b65a sp 7fff8dc68430 error 4 in rc[400000+19000]
(I guess most of this line is quite useless to you, but maybe one of those numbers contains a hint for you, which I may not spot.)

While I admit that having /dev nearly empty is quite a crazy action, I would like openrc to output an error message like "unable to open /dev/important, aborting boot".

Reproducible: Always
Comment 1 Dennis Schridde 2009-01-30 19:55:33 UTC
Created attachment 180313 [details]
/init script
Comment 2 Dennis Schridde 2009-01-30 19:58:43 UTC
PS: I just tested: Even when /dev is not unmounted before switching root, I assume that the /dev directory is not accessible by /sbin/rc after switching root. So openrc is probably always left with an entirely empty /dev when using my script.
I now wonder why it is not populated using udev, or similar.
Comment 3 Matthias Schwarzott gentoo-dev 2009-01-31 09:36:55 UTC
What you have is a shell-script part of an initramfs. It does switch root at the end. So /dev will be empty in this root, as you do not copy over /dev from the tmpfs.

So your final system should call any dev manager (e.g. udev or mdev) or will have no device nodes.
So you should make sure you have udev added to sysfs runlevel.

About that segfault you should create a backtrace, but no idea how to easily do it. But I guess you should at least compile openrc with debug information.
Maybe someone can at least tell you how to find out the source line from the ip value.
Or if $root is rw, maybe you can force the kernel to write a core-dump.
Comment 4 Roy Marples 2009-04-23 20:48:31 UTC
I'll need a backtrace to fix this
Comment 5 SpanKY gentoo-dev 2009-10-11 09:35:21 UTC
or just create a qemu vhost ...