Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 240984 - [OpenRC] openrc git no longer starts udev automatically
Summary: [OpenRC] openrc git no longer starts udev automatically
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 250552
  Show dependency tree
 
Reported: 2008-10-10 09:21 UTC by Roy Marples
Modified: 2008-12-11 18:42 UTC (History)
8 users (show)

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


Attachments
udev init script (udev,726 bytes, text/plain)
2008-10-10 09:22 UTC, Roy Marples
Details
udev-cosmetics.patch (udev-cosmetics.patch,719 bytes, patch)
2008-10-14 22:43 UTC, Davide Pesavento
Details | Diff
openrc-9999.ebuild.patch (openrc-9999.ebuild.patch,831 bytes, patch)
2008-10-14 22:48 UTC, Davide Pesavento
Details | Diff
udev init script - update2 (udev.initd,1006 bytes, text/plain)
2008-10-16 18:34 UTC, Matthias Schwarzott
Details
Let openrc-9999 install new runlevels sysinit and shutdown (openrc-9999-runlevel-changes.patch,1.16 KB, patch)
2008-12-06 15:54 UTC, Matthias Schwarzott
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roy Marples 2008-10-10 09:21:17 UTC
OpenRC now has a proper sysinit runlevel with full dependencies.
This now requires an init script for udevd, devfsd and mdevd.
New init scripts have been created to mount the other knobs - sysfs, devfs and procfs has been modified.

The cold/hotplugging has now been moved into one variable - rc_hotplug which is now a list of services to pass to fnmatch(3) using ! to negate as usual. If udev wants to have coldplugging separately ... well that's now up to udev.

The upside is that the Linux init.sh now just mounts enough to get /lib/rc/init.d/ mounted as a ramdisk, which is just mounting /proc. So any changes in Linux like say new dev managers or bits they use can now be added without affecting OpenRC in the slightest.
Comment 1 Roy Marples 2008-10-10 09:22:29 UTC
Created attachment 167852 [details]
udev init script

Proposed udev init script. It provides dev so things can depend on it, like say lvm.
Comment 2 Davide Pesavento gentoo-dev 2008-10-14 22:43:32 UTC
Created attachment 168486 [details, diff]
udev-cosmetics.patch

I propose this additional patch (only cosmetics), to be applied on top of Roy's script.
Comment 3 Davide Pesavento gentoo-dev 2008-10-14 22:48:29 UTC
Created attachment 168490 [details, diff]
openrc-9999.ebuild.patch

This patch is also probably needed, otherwise OpenRC will complain about a non-existent 'sysinit' runlevel after rebooting (at least it did on my box). Should be applied on current sys-apps/openrc-9999 ebuild.
Comment 4 Matthias Schwarzott gentoo-dev 2008-10-15 06:12:48 UTC
(In reply to comment #3)
> Created an attachment (id=168490) [edit]
> openrc-9999.ebuild.patch
> 
> This patch is also probably needed, otherwise OpenRC will complain about a
> non-existent 'sysinit' runlevel after rebooting (at least it did on my box).
> Should be applied on current sys-apps/openrc-9999 ebuild.
> 
I also proposed something similar to Cardoe, but this seems better. Should the ebuild also create a "shutdown" runlevel?
Comment 5 Roy Marples 2008-10-15 13:32:51 UTC
(In reply to comment #4)
> Should the ebuild also create a "shutdown" runlevel?

Not yet.
We may have a runlevel in the future depending on the outcome of bug #224537
Comment 6 Matthias Schwarzott gentoo-dev 2008-10-16 18:34:15 UTC
Created attachment 168694 [details]
udev init script - update2

This init-script should be able to show the cold/hotplugged services, as the coldplug concept got deleted from openrc.

Next todo-point: The udev-ebuild needs to add the udev-init-script to sysinit runlevel. This needs to be done, even if openrc is not new enough, else it will make sys unbootable after openrc update.

Annoying issue: just copying this init-script into /etc/init.d, openrc whines about the needed sysfs service not existing. This could be solved by changing the if-condition of the depend to something like if [ -f /etc/init.d/sysfs ];
Comment 7 Davide Pesavento gentoo-dev 2008-10-16 19:17:32 UTC
> [...]
> local svc= services= bname
> [...]

bname seems unused...
Comment 8 Roy Marples 2008-10-17 08:34:32 UTC
(In reply to comment #6)
> Annoying issue: just copying this init-script into /etc/init.d, openrc whines
> about the needed sysfs service not existing. This could be solved by changing
> the if-condition of the depend to something like if [ -f /etc/init.d/sysfs ];

udev does need sysfs - it should have been installed by OpenRC for you.
Obviously it's not there for older versions, so it would need to be if-blocked then.
Comment 9 Matthias Schwarzott gentoo-dev 2008-10-17 10:04:22 UTC
(In reply to comment #8)
> 
> udev does need sysfs - it should have been installed by OpenRC for you.
> Obviously it's not there for older versions, so it would need to be if-blocked
> then.
> 

Yes, this is what I wanted to add to the init-script:

depend()
{
        if [ -e /lib/librc.so -a -f /etc/init.d/sysfs ]; then
                # on baselayout-1 this causes
                # dependency-cycles with checkroot (before *)
                # require new enough baselayout-2
                provide dev
                need sysfs
                before checkfs fsck
        fi
}

Second point:
How should the openrc-ebuild know it need to add the sysinit-runlevel (which it does not yet do).

The udev-ebuild also need to check if udev is currently enabled in openrc-config (the old one) and add udev init-script to sysinit runlevel in this case. (Using code like the magic add_boot_init from openrc.ebuild.

BUT: This will make the propsed change to openrc-9999.ebuild/newer to be created openrc-ebuilds (0.4?) invalid.

The check:
if [ ! -d /etc/runlevels/sysinit ]; then
  cp -r sysinit /etc/runlevels/sysinit
fi

will not work if udev-ebuild does add services to this runlevel before.

Don't tell me this wont happen, as it will definitly if I add the init-script to udev NOW, and users update before they get new openrc release.

So openrc-ebuild may need more exact checking like this:
if [ ! -e /etc/runlevels/sysinit/sysfs ]; then
  cp -r sysinit /etc/runlevels/sysinit
fi

Getting openrc-update before udev-update should be stopped by blockers to not allow reboot with too old udev (without init-script).
Comment 10 Roy Marples 2008-10-17 11:15:51 UTC
(In reply to comment #9)
> Second point:
> How should the openrc-ebuild know it need to add the sysinit-runlevel (which it
> does not yet do).

Why should it? As it's a need it gets pulled in by udev.
If nothing needs it then nothing pulls it in, so it's not used by default.
If the user wants it, he/she adds it to the desired runlevel.

> The udev-ebuild also need to check if udev is currently enabled in
> openrc-config (the old one) and add udev init-script to sysinit runlevel in
> this case. (Using code like the magic add_boot_init from openrc.ebuild.

I dislike this.
No ebuild should automagically add an init script to the runlevel.
Why should udev be an exception? All Gentoo stage tarballs ship with a static dev with enough nodes to get nearly everything running if the user doesn't add udev to the sysinit runlevel.
Comment 11 Matthias Schwarzott gentoo-dev 2008-10-20 10:01:23 UTC
@vapier:
Maybe you want to adjust the openrc-9999.ebuild for the new sysinit runlevel.

If no other ebuild touches sysinit runlevel it is enough to add code like:
if [[ ! -d ${ROOT}/etc/runlevels/sysinit ]]; then
  cp /usr/share/openrc/runlevels/sysinit ${ROOT}/etc/runlevels/sysinit
fi

If others touch the runlevel too, the condition may need to be changed to
[[ ! -e ${ROOT}/etc/runlevels/sysinit/sysfs ]]

Comment 12 Roy Marples 2008-10-20 10:23:06 UTC
(In reply to comment #11)
> If others touch the runlevel too, the condition may need to be changed to
> [[ ! -e ${ROOT}/etc/runlevels/sysinit/sysfs ]]

Make the condition check for Linux-2.6 kernels as it's only valid for that platform.
sysfs won't work on say Linux-2.4 or FreeBSD.
Comment 13 Matthias Schwarzott gentoo-dev 2008-10-28 22:06:29 UTC
I added almost this script to (for now masked) udev-130-r2 ebuild.
Comment 14 Roy Marples 2008-10-29 21:12:32 UTC
OK sweet :)

Now nothing in OpenRC itself uses the *addon functions so I'm *very* tempted to remove them or at least get them to ewarn when they are used.

Extending OpenRC should now be done via init scripts OR C plugins.
Comment 15 Doug Goldstein gentoo-dev 2008-10-29 21:27:57 UTC
This won't happen in an ~arch version of OpenRC until there's a new release of OpenRC.
Comment 16 Davide Pesavento gentoo-dev 2008-11-13 15:44:56 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Should the ebuild also create a "shutdown" runlevel?
> 
> Not yet.
> We may have a runlevel in the future depending on the outcome of bug #224537
> 

Since openrc from git now has a "shutdown" runlevel, too, I think someone should commit a patch similar to the one I proposed to copy the new runlevels (sysinit and shutdown) to /etc/runlevels/, at least for openrc-9999.ebuild.

Please note that there's a typo in my patch:
cp -RPp "${runlevel}" "${ROOT}"/etc

should be:
cp -RPp "${runlevel}" "${ROOT}"/etc/runlevels
Comment 17 Xake 2008-11-15 12:24:34 UTC
What is the changes between the init-scripts in 130-r2 and 132?
Afaiks they where the same, but is there any reason behind keeping 130-r2 and keeping it masked?
Comment 18 Matthias Schwarzott gentoo-dev 2008-11-15 12:59:04 UTC
(In reply to comment #17)
> What is the changes between the init-scripts in 130-r2 and 132?
> Afaiks they where the same, but is there any reason behind keeping 130-r2 and
> keeping it masked?
> 
The init-scripts are identical and work (ignoring the thrown warnings with newest openrc).
There is no reason to keep this masked, besides I have not done it yet due to time constraints.
There will be more init-script changes in either udev-133 (when it is around, else some 132-rX version).
Comment 19 Matthias Schwarzott gentoo-dev 2008-11-26 11:15:56 UTC
udev-133.ebuild now parses the config-files of baselayout or openrc and adds udev to runlevel sysinit if it was enabled in the parsed config-files.

Please test if this works.
Comment 20 Matthias Schwarzott gentoo-dev 2008-11-29 15:57:13 UTC
As udev-133 has an init-script and the ebuilds tries to add it to to sysinit runlevel this no longer is a blocker.

So newer openrc ebuilds just need to add
RDEPEND="!<sys-fs/udev-133"
Comment 21 Matthias Schwarzott gentoo-dev 2008-12-06 15:54:08 UTC
Created attachment 174416 [details, diff]
Let openrc-9999 install new runlevels sysinit and shutdown

This patch lets openrc-9999 install the new runlevels sysinit and shutdown.
Additionally it adds blocks against too old udev and sysvinit.

@Vapier:
Is it ok if I commit this?
Comment 22 Davide Pesavento gentoo-dev 2008-12-11 15:47:37 UTC
(In reply to comment #21)
> Created an attachment (id=174416) [edit]
> Let openrc-9999 install new runlevels sysinit and shutdown
> 
> This patch lets openrc-9999 install the new runlevels sysinit and shutdown.
> Additionally it adds blocks against too old udev and sysvinit.
> 
> @Vapier:
> Is it ok if I commit this?
> 

This patch has been committed. Anything else to be done here?
Comment 23 Doug Goldstein gentoo-dev 2008-12-11 18:42:11 UTC
I've committed it but I haven't gone around closing bugs yet.