Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 205685 - sys-fs/udev init script should create /dev/.static/dev and provide a wrapper script
Summary: sys-fs/udev init script should create /dev/.static/dev and provide a wrapper ...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Lowest enhancement (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-13 18:38 UTC by ObNox
Modified: 2012-03-22 00:59 UTC (History)
1 user (show)

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 ObNox 2008-01-13 18:38:34 UTC
Debian/Ubuntu provides a very nice feature in /etc/init.d/udev script which allow to access the original /dev files (before /dev is mounted by udev) through /dev/.static/dev and it would be nice to have the same feature available on Gentoo.

The init script in Debian/Ubuntu does this way :

 - mount -n --bind /dev /etc/udev
 - mount -n -t tmpfs -o mode=0755 udev /dev
 - mkdir -m 0700 -p /dev/.static/dev
 - mount -n --move /etc/udev /dev/.static/dev

Also, some kind of wrapper script such a "doudev" for ebuilds would be useful to  create device nodes if needed. "doudev" would detect udev presence and mknod in /dev/.static/dev instead of /dev directly.


Reproducible: Always

Steps to Reproduce:
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2008-01-13 22:08:12 UTC
(In reply to comment #0)
> Debian/Ubuntu provides a very nice feature in /etc/init.d/udev script which
> allow to access the original /dev files (before /dev is mounted by udev)
> through /dev/.static/dev and it would be nice to have the same feature
> available on Gentoo.

Yeah, and this is useful for exactly what?

> Also, some kind of wrapper script such a "doudev" for ebuilds would be useful
> to  create device nodes if needed. "doudev" would detect udev presence and
> mknod in /dev/.static/dev instead of /dev directly.

Either you want to use static /dev or udev, you should make your choice. Ebuilds shouldn't create any nodes in /dev whatsover because it's completely useless on udev-based systems.
Comment 2 ObNox 2008-01-13 22:59:26 UTC
(In reply to comment #1)

> Yeah, and this is useful for exactly what?

Accessing the original /dev when udev is active.

- I sometimes needed to do it to check the minor/major of some devices udev does not support (yet)

- When migrating the whole system to a new disk or a new machine and having the new disk/machine fail at boot because (initramfs stage) because /dev is empty. All other machines also using udev makes it very hard to get a default /dev correctly populated.

Having a /dev/.static/dev allow all this, issues I've been facing.

The suggestion costs absolutely nothing in terms of resources so I don't see why it shouldn't be done, especially if it can be useful in some situations.

> Either you want to use static /dev or udev, you should make your choice.

There's no choice to be made. udev is the right direction but having access to original /dev tree is sometimes useful.

> Ebuilds shouldn't create any nodes in /dev whatsover because it's completely
> useless on udev-based systems.

This is speculation and pure assumption from your part, there are still some devices not supported by udev.

As of Ebuilds, your comment is really funny...

find /usr/portage/ -name "*.ebuild" -print0 | xargs -0 -r grep -Ei "mknod.*/dev"
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2008-01-13 23:06:30 UTC
(In reply to comment #2)
> - I sometimes needed to do it to check the minor/major of some devices udev
> does not support (yet)

Yeah so bind-mount it if you need it? The question was how's it useful in general, well it isn't in any way.

> 
> - When migrating the whole system to a new disk or a new machine and having the
> new disk/machine fail at boot because (initramfs stage) because /dev is empty.

Erm... Gentoo boots perfectly fine with an empty /dev.

> All other machines also using udev makes it very hard to get a default /dev
> correctly populated.

There's no such thing as default /dev. It even doesn't make any sense. The only stuff that's supposed to exist everywhere is /dev/{zero

> > Either you want to use static /dev or udev, you should make your choice.
> 
> There's no choice to be made. udev is the right direction but having access to
> original /dev tree is sometimes useful.

Once again, for what is this exactly useful that you are requesting this to clutter /dev on every single Gentoo install?

> > Ebuilds shouldn't create any nodes in /dev whatsover because it's completely
> > useless on udev-based systems.
> 
> This is speculation and pure assumption from your part, there are still some
> devices not supported by udev.

This is no speculation, everything created in /dev on an udev-based system will vanish on next reboot, sticking such stuff into ebuilds is totally useless.

> As of Ebuilds, your comment is really funny...
> 
> find /usr/portage/ -name "*.ebuild" -print0 | xargs -0 -r grep -Ei
> "mknod.*/dev"

Yeah, file bugs about those, they are doing a retarded thing.
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2008-01-13 23:29:52 UTC
(In reply to comment #3)
> stuff that's supposed to exist everywhere is /dev/{zero

Eh... should have been /dev/{null,console}
Comment 5 ObNox 2008-01-13 23:53:27 UTC
(In reply to comment #3)

> Yeah so bind-mount it if you need it? The question was how's it useful in
> general, well it isn't in any way.

I'll maintain my own /etc/init.d/udev patches then... If I need it, I may be not alone but you decided that way.

> Erm... Gentoo boots perfectly fine with an empty /dev.

Sure about that? Did you really tried? None of my Gentoo was able to boot with a empty /dev, totally empty, neither using initramfs or without it.

When you migrate an OS to a new disk/machine using rsync -avHx / /NEWDISK, the /dev contents are NOT copied (option -x of rsync) so if you don't mknod few devices, you're screwed up.

> There's no such thing as default /dev. It even doesn't make any sense. The only
> stuff that's supposed to exist everywhere is /dev/{zero

/dev/null, /dev/console, /dev/tty, etc..

> Once again, for what is this exactly useful that you are requesting this to
> clutter /dev on every single Gentoo install?

Well, if you find that a single mount-bind is so cluttering, what can I say?
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2008-01-14 00:01:51 UTC
(In reply to comment #5)
> > Erm... Gentoo boots perfectly fine with an empty /dev.
> 
> Sure about that? Did you really tried? None of my Gentoo was able to boot with
> a empty /dev, totally empty, neither using initramfs or without it.

Yeah, I did, multiple times... If it doesn't work for you, then file a bug about baselayout. /dev/.static/dev won't help here in any way at all regardless.

> Well, if you find that a single mount-bind is so cluttering, what can I say?

Well because it won't be used by anything at all, what's the point in providing this beyond confusing users?
Comment 7 Matthias Schwarzott gentoo-dev 2008-01-14 13:36:55 UTC
(In reply to comment #5)
> (In reply to comment #3)
> 
> > Yeah so bind-mount it if you need it? The question was how's it useful in
> > general, well it isn't in any way.
> 
> I'll maintain my own /etc/init.d/udev patches then... If I need it, I may be
> not alone but you decided that way.

Well, with some other order it should be possible to do this later.
Like mount --bind / /mnt/orig-root
and then accessing /mnt/orig-root/dev


> 
> > Erm... Gentoo boots perfectly fine with an empty /dev.
> 
> Sure about that? Did you really tried? None of my Gentoo was able to boot with
> a empty /dev, totally empty, neither using initramfs or without it.
> 
> When you migrate an OS to a new disk/machine using rsync -avHx / /NEWDISK, the
> /dev contents are NOT copied (option -x of rsync) so if you don't mknod few
> devices, you're screwed up.
> 
This will produce a working system with /dev copied? I doubt it.
You still need to do an extra copy of /dev or /dev/.static/....
So you also can copy the content of /dev/ created by udev.
Btw. My system also DOES boot fine with completely empty directory /dev.
Just the directory should exist (I guess / is read-only at udev start time).

Comment 8 ObNox 2008-01-15 21:10:35 UTC
(In reply to comment #7)

> Well, with some other order it should be possible to do this later.
> Like mount --bind / /mnt/orig-root
> and then accessing /mnt/orig-root/dev

Yes, that's what I do now. I know /dev/.static/dev isn't needed at all for everyday use and is merely useful for the purpose of migration or to examine the minor/major number for some nodes/devices.

Debian/Ubuntu provide this nice idea for a resource cost of zero and it's convenient for people who want to boot a udev-less system (whatever could be the motivation of doing so). Furthermore, post-install scripts in *.debs use a wrapper to detect udev presence and create the needed nodes in /dev/.static/dev, again, in case the user needs to boot a udev-less system.

Lots of ebuilds currently mknod entries in /dev which is totally useless in a udev environment, these entries will vanish on next reboot. That's why I suggested some kind of "doudev" command for ebuilds.

> This will produce a working system with /dev copied? I doubt it.
> You still need to do an extra copy of /dev or /dev/.static/....

Of course, but at least it's accessible to anyone. Not everyone knows how to manipulate mount bind.

Jakub Moc states that it would only confuse users. Well, it doesn't confuse anyone running Debian/Ubuntu boxes (not to start a Nth distro war of course)

Again, he states this is of no use. Perhaps for him because he uses udev but for a server system where devices barely change, having a udevd process is a waste of resources. There could be any reason we don't know.

This is not critical stuff and I only suggested 4 lines of script text which envolves no resource usage at all and got a very harsh feedback.

> So you also can copy the content of /dev/ created by udev.

This would also bring a lot of useless stuff such as /dev/disks/by-* as well as a really confusing /dev/.udev dir in a udev-less environment. A lot of tools test the existence of this dir to check udev presence instead of search for udevd process eventhough it's wrong.

> Btw. My system also DOES boot fine with completely empty directory /dev.
> Just the directory should exist (I guess / is read-only at udev start time).

Well, my system doesn't like this at all... at least /dev/console, /dev/tty and /dev/null must be present. Jakub is right, this is a problem of baselayout which  uses them before testing they exist.
Comment 9 William Hubbs gentoo-dev 2012-03-22 00:59:00 UTC
This bug has been open for four years with no activity.
There is nothing for us to do here since you can bind-mount the original
root somewhere else and see the original /dev that way.