Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 461838 - sys-fs/udev-init-scripts-24 - rc_coldplug="NO" makes USB keyboard and USB mouse unuseable in X
Summary: sys-fs/udev-init-scripts-24 - rc_coldplug="NO" makes USB keyboard and USB mou...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-15 17:43 UTC by Lars Wendler (Polynomial-C) (RETIRED)
Modified: 2013-03-19 16:42 UTC (History)
1 user (show)

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


Attachments
udev-init-scripts-24-fix_no_coldplug.patch (udev-init-scripts-24-fix_no_coldplug.patch,274 bytes, patch)
2013-03-15 17:43 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff
udev-init-scripts-24-fix_no_coldplug.patch (udev-init-scripts-24-fix_no_coldplug.patch,287 bytes, patch)
2013-03-18 06:44 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-03-15 17:43:52 UTC
Created attachment 342152 [details, diff]
udev-init-scripts-24-fix_no_coldplug.patch

When booting with rc_coldplug="NO" into X, USB keyboard and USB mouse are not working leaving the user with an unuseable system. The attached patch fixes this problem.
Comment 1 William Hubbs gentoo-dev 2013-03-15 18:48:01 UTC
Hello,

can you please test the patch above for udev-init-scripts-24 and see if
it triggers the issue in bug #424189 again?

Thanks,

William
Comment 2 Samuli Suominen (RETIRED) gentoo-dev 2013-03-16 06:56:33 UTC
sounds bad, but isn't that the purpose of "no coldplug" that there will be no coldplug, like for drivers of input devices? that the user needs to add those into the loadable module list himself?
Comment 3 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-03-16 11:57:11 UTC
The affected drivers are compiled into the kernel. What still needs to be done is to create necessary symlinks and adjust permissions. That's what the patch tries to achieve.
When you look into older udev start scripts you will see that this command was executed when coldplug is disabled.
Comment 4 William Hubbs gentoo-dev 2013-03-16 13:48:07 UTC
(In reply to comment #2)
> sounds bad, but isn't that the purpose of "no coldplug" that there will be
> no coldplug, like for drivers of input devices? that the user needs to add
> those into the loadable module list himself?

I'm tending to agree with this interpretation. The purpose of rc_coldplug="no" or "nocoldplug" on the kernel command line is to skip the entire coldplug sequence.

(In reply to comment #3)
> The affected drivers are compiled into the kernel. What still needs to be
> done is to create necessary symlinks and adjust permissions. That's what the
> patch tries to achieve.
> When you look into older udev start scripts you will see that this command
> was executed when coldplug is disabled.

I know that, but the question is, given the bug in comment #1, should it have been? In other words, what does the patch do if things are not built into the kernel? Does it make the modules load?
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-03-16 14:26:11 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > sounds bad, but isn't that the purpose of "no coldplug" that there will be
> > no coldplug, like for drivers of input devices? that the user needs to add
> > those into the loadable module list himself?
> 
> I'm tending to agree with this interpretation. The purpose of
> rc_coldplug="no" or "nocoldplug" on the kernel command line is to skip the
> entire coldplug sequence.

Can you please stop making false assumptions? This bug is about rc_coldplug="NO" now being really broken because udev does not even take action for already existing devices which need adjustment through existing udev-rules.

> (In reply to comment #3)
> > The affected drivers are compiled into the kernel. What still needs to be
> > done is to create necessary symlinks and adjust permissions. That's what the
> > patch tries to achieve.
> > When you look into older udev start scripts you will see that this command
> > was executed when coldplug is disabled.
> 
> I know that, but the question is, given the bug in comment #1, should it
> have been? In other words, what does the patch do if things are not built
> into the kernel? Does it make the modules load?

l'm not at home right now and thus cannot test the module loading. Although I doubt the patch will lead to automatic module loading (like I said before, this command was executed in older udev start scripts when coldplug was disabled) I will test it as soon as I return to my Gentoo test machine.
Comment 6 William Hubbs gentoo-dev 2013-03-16 19:56:07 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #2)
> > > sounds bad, but isn't that the purpose of "no coldplug" that there will be
> > > no coldplug, like for drivers of input devices? that the user needs to add
> > > those into the loadable module list himself?
> > 
> > I'm tending to agree with this interpretation. The purpose of
> > rc_coldplug="no" or "nocoldplug" on the kernel command line is to skip the
> > entire coldplug sequence.
> 
> Can you please stop making false assumptions? This bug is about
> rc_coldplug="NO" now being really broken because udev does not even take
> action for already existing devices which need adjustment through existing
> udev-rules.

I am not making a false assumption. If you look at the definition of nohotplug (which will be another bug because there is no such option) on the livecd, it states that it disables the cold/hotplug "init scripts" at boot.

> > (In reply to comment #3)
> > > The affected drivers are compiled into the kernel. What still needs to be
> > > done is to create necessary symlinks and adjust permissions. That's what the
> > > patch tries to achieve.
> > > When you look into older udev start scripts you will see that this command
> > > was executed when coldplug is disabled.
> > 
> > I know that, but the question is, given the bug in comment #1, should it
> > have been? In other words, what does the patch do if things are not built
> > into the kernel? Does it make the modules load?
> 
> l'm not at home right now and thus cannot test the module loading. Although
> I doubt the patch will lead to automatic module loading (like I said before,
> this command was executed in older udev start scripts when coldplug was
> disabled) I will test it as soon as I return to my Gentoo test machine.

This is what we need to know. If it doesn't lead to automatic module loading, I don't have a problem with applying it.
Comment 7 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-03-16 21:18:17 UTC
Here are the results. Prerequisite is my attached patch being applied to the udev init script.

Booting with rc_coldplug="YES" I get the following:

root@shanghai:~ # lsmod
Module                  Size  Used by
snd_hda_codec_realtek    56258  1
snd_hda_intel          22963  0
snd_emu10k1           130001  0
snd_hwdep               5724  1 snd_emu10k1
snd_util_mem            2147  1 snd_emu10k1
snd_ac97_codec        104592  1 snd_emu10k1
ac97_bus                 901  1 snd_ac97_codec
snd_rawmidi            17295  1 snd_emu10k1
snd_hda_codec          69280  2 snd_hda_codec_realtek,snd_hda_intel
snd_seq_device          4756  2 snd_rawmidi,snd_emu10k1
snd_pcm                70489  4 snd_ac97_codec,snd_hda_codec,snd_hda_intel,snd_emu10k1
microcode               7790  0
pcspkr                  1835  0
snd_page_alloc          6754  3 snd_pcm,snd_hda_intel,snd_emu10k1
snd_timer              17591  2 snd_pcm,snd_emu10k1
snd                    51899  10 snd_hda_codec_realtek,snd_ac97_codec,snd_hwdep,snd_timer,snd_pcm,snd_rawmidi,snd_hda_codec,snd_hda_intel,snd_emu10k1,snd_seq_device
soundcore               4930  1 snd


Booting with rc_coldplug="NO" I get the following:

root@shanghai:~ # lsmod
Module                  Size  Used by
microcode               7790  0

The one module gets triggered by /etc/conf.d/modules:

root@shanghai:~ # grep -v "^[[:space:]]*\(#.*\|\)$" /etc/conf.d/modules
modules="microcode"
shanghai:~ #
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2013-03-17 01:26:27 UTC
I was reading IRC log from today:

<Poly-C_atwork> WilliamH: I already did. But I stumbled about another bug. Even with "udevadm trigger --attr-match=dev" the devices won't get processed properly. For example I get segfaults in r600g_dri.so because all devices in /dev/dri/ are only readable by root. So I suspect udev currently is buggy because it should still process already existing devices on startup to get permissions right.

How about adding both, first:

udevadm trigger --attr-match=dev

Then the remainining ones which make sense, like ensuring we get the input devices and graphics:

udevadm trigger --subsystem-match=drm --subsystem-match=input
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2013-03-17 12:42:33 UTC
Do we really want to maintain this type of hack at all? Since it is a hack at most:

14:19 < kay> you are skipping coldplug but expect /dev to be proper? :)

Then Kay suggested "udevadm trigger --attr-match=dev --action=add":

14:22 < kay> ssuominen: try: udevadm trigger --action=add --attr-match=dev
14:22 < kay> ssuominen: it might still load a few modules, but almost all of them should be skipped
Comment 10 William Hubbs gentoo-dev 2013-03-17 16:23:21 UTC
(In reply to comment #9)
> Do we really want to maintain this type of hack at all? Since it is a hack
> at most:
> 
> 14:19 < kay> you are skipping coldplug but expect /dev to be proper? :)
> 
> Then Kay suggested "udevadm trigger --attr-match=dev --action=add":
> 
> 14:22 < kay> ssuominen: try: udevadm trigger --action=add --attr-match=dev
> 14:22 < kay> ssuominen: it might still load a few modules, but almost all of
> them should be skipped

Honestly, I have kept this even though  I didn't know why we have it. I'm not sure any other distros offer an option to allow skipping the coldplug sequence, and I wouldn't have a problem dropping it if there isn't really a use case for it.

@poly-c:
Can you please elaborate on why you feel we should have this function?
Comment 11 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-03-18 06:42:48 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Do we really want to maintain this type of hack at all? Since it is a hack
> > at most:
> > 
> > 14:19 < kay> you are skipping coldplug but expect /dev to be proper? :)
> > 
> > Then Kay suggested "udevadm trigger --attr-match=dev --action=add":
> > 
> > 14:22 < kay> ssuominen: try: udevadm trigger --action=add --attr-match=dev
> > 14:22 < kay> ssuominen: it might still load a few modules, but almost all of
> > them should be skipped
> 
> Honestly, I have kept this even though  I didn't know why we have it. I'm
> not sure any other distros offer an option to allow skipping the coldplug
> sequence, and I wouldn't have a problem dropping it if there isn't really a
> use case for it.
> 
> @poly-c:
> Can you please elaborate on why you feel we should have this function?

I don't want to have udev loading kernel modules during the boot process. I just want udev to handle device nodes nothing else.
A couple of years ago udev's module loading could be prevented by disabling coldplugging. udev then simply processed all available devices, fixed permissions and ownership according to existing udev rules and all was fine.
When sys-fs/udev-init-scripts were introduced this no longer worked until recent change to udev-init-scripts-24. But now existing devices won't get processed anymore by udev.
Oh and before you come up with it, blacklisting all modules is no option for me.

Kay's suggestion works. So I gonna attach a "fixed" patch.
Comment 12 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-03-18 06:44:48 UTC
Created attachment 342460 [details, diff]
udev-init-scripts-24-fix_no_coldplug.patch

Patch with Kay's suggestion. 
This works for me and re-establishes the disabled coldplug functionality I know from older udev versions.
Comment 13 Samuli Suominen (RETIRED) gentoo-dev 2013-03-18 08:37:22 UTC
(In reply to comment #12)
> Created attachment 342460 [details, diff] [details, diff]
> udev-init-scripts-24-fix_no_coldplug.patch
> 
> Patch with Kay's suggestion. 
> This works for me and re-establishes the disabled coldplug functionality I
> know from older udev versions.

cool, I would like us of course to keep this functionality, but:

may I also suggest renaming this rc_coldplug= option to rc_trigger_only_with_attrs_dev= ?
would be more clear
Comment 14 Samuli Suominen (RETIRED) gentoo-dev 2013-03-18 08:52:58 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > Created attachment 342460 [details, diff] [details, diff] [details, diff]
> > udev-init-scripts-24-fix_no_coldplug.patch
> > 
> > Patch with Kay's suggestion. 
> > This works for me and re-establishes the disabled coldplug functionality I
> > know from older udev versions.
> 
> cool, I would like us of course to keep this functionality, but:
> 
> may I also suggest renaming this rc_coldplug= option to
> rc_trigger_only_with_attrs_dev= ?
> would be more clear

rather, rc_add_only_with_attrs_dev=, but whatever, it's just bikeshedding
Comment 15 William Hubbs gentoo-dev 2013-03-18 16:38:41 UTC
We would also have to rename the kernel command line option. We currently use nocoldplug to indicate that we do not want the coldplug sequence to be run (see the get_bootparam call).

Any ideas?
Comment 16 Samuli Suominen (RETIRED) gentoo-dev 2013-03-18 19:05:54 UTC
(In reply to comment #15)
> We would also have to rename the kernel command line option. We currently
> use nocoldplug to indicate that we do not want the coldplug sequence to be
> run (see the get_bootparam call).
> 
> Any ideas?

then leave it and just apply the patch, imho
Comment 17 William Hubbs gentoo-dev 2013-03-19 16:42:16 UTC
This is fixed in commit 5eed3ed.
I also added an einfo so that users will know that /dev permissions and
symbolic links are being set. This will be part of udev-init-scripts 25.
Thanks for the report.