Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 424189 - sys-fs/udev-171-r6: all modules are loaded even with rc_coldplug="NO"
Summary: sys-fs/udev-171-r6: all modules are loaded even with rc_coldplug="NO"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-06-30 02:49 UTC by Matthew Stapleton
Modified: 2013-02-27 21:31 UTC (History)
3 users (show)

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


Attachments
udev_coldplug_fix.patch (udev_coldplug_fix.patch,729 bytes, patch)
2012-06-30 02:50 UTC, Matthew Stapleton
Details | Diff
udev_coldplug_fix.patch (udev_coldplug_fix.patch,729 bytes, patch)
2013-02-08 17:46 UTC, William Hubbs
Details | Diff
/lib/udev/rules.d/80-drivers.rules patch (udev-dont-load-module-with-coldplug-off.diff,644 bytes, patch)
2013-02-25 20:13 UTC, Maciej S. Szmigiero
Details | Diff
udev coldplug fix (udev-coldplug-fix.patch,842 bytes, patch)
2013-02-25 23:49 UTC, Maciej S. Szmigiero
Details | Diff
udev-coldplug.patch (udev-coldplug.patch,927 bytes, patch)
2013-02-26 04:13 UTC, William Hubbs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Stapleton 2012-06-30 02:49:05 UTC
in /etc/conf.d/udev I have rc_coldplug set to "NO" because I prefer to control what modules get loaded on my server, but all modules are still loaded by udev.  This causes problems for modules that need a special parameter in /etc/conf.d/modules.  To fix the problem, I have patched the udev init script based on the init script from udev-164-r2 which doesn't have the problem.

Reproducible: Always

Steps to Reproduce:
1. Reboot
2. See in /var/log/dmesg that the modules were loaded without the custom parameters even though /etc/init.d/modules didn't complain.



My emerge info output:

Portage 2.1.10.44 (hardened/linux/amd64, gcc-4.5.3, glibc-2.11.2, 3.2.20-hardened-r1 x86_64)
=================================================================
System uname: Linux-3.2.20-hardened-r1-x86_64-AMD_FX-tm-4100_Quad-Core_Processor-with-gentoo-2.1
Timestamp of tree: Thu, 28 Jun 2012 13:45:01 +0000
app-shells/bash:          3.2_p17-r1
dev-java/java-config:     1.3.7-r1, 2.1.10
dev-lang/python:          2.4.4-r13, 2.5.2-r7, 2.6.6-r2
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13::<unknown repository>, 2.68
sys-devel/automake:       1.4_p6::<unknown repository>, 1.5::<unknown repository>, 1.6.3::<unknown repository>, 1.7.9-r1::<unknown repository>, 1.8.5-r3::<unknown repository>, 1.9.6-r2::<unknown repository>, 1.10.1, 1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            3.4.6-r2::<unknown repository>, 4.1.2::<unknown repository>, 4.3.6-r1, 4.5.3-r2
sys-devel/gcc-config:     1.4.0-r4
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.81::<unknown repository>
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.11.2
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=athlon64 -fomit-frame-pointer -ftree-vectorize -fpredictive-commoning -fno-tree-vect-loop-version"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=athlon64 -fomit-frame-pointer -ftree-vectorize -fpredictive-commoning -fno-tree-vect-loop-version"
DISTDIR="/usr/portage.local/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.internode.on.net/pub/gentoo http://distfiles.gentoo.org http://www..ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_AU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
PKGDIR="/usr/portage.local/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync/gentoo-portage"
USE="3dnow 3dnowext acl acpi alsa amd64 apache2 berkdb bzip2 caps cjk cli cracklib crypt cups cxx dlloader dri fam gdbm gpm hardened iconv ipv6 jpeg justify kerberos logrotate mmx mmxext mng modules mudflap multilib ncurses nls nptl openmp pam pax_kernel pcre png pppd qt readline session sse sse2 ssl tcpd threads tiff unicode urandom vhosts xattr xinerama xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" MISDN_CARDS="netjetpci" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Matthew Stapleton 2012-06-30 02:50:05 UTC
Created attachment 316715 [details, diff]
udev_coldplug_fix.patch
Comment 2 William Hubbs gentoo-dev 2012-08-05 22:53:35 UTC
Can you please upgrade to udev-187-r1 and udev-init-scripts-14 and let
me know if this is still an issue?

Thanks,

William
Comment 3 Giacomo Perale 2012-09-21 20:14:20 UTC
I've got the same problem with sys-fs/udev-189 and sys-fs/udev-init-scripts-16.

Matthew's patch fixes it here too. The only difference from sys-fs/udev-171-r6 is that snd-emu10k1 doesn't get loaded anymore if I don't put it in conf.d/modules but I suppose that's expected.
Comment 4 William Hubbs gentoo-dev 2013-02-08 17:01:43 UTC
Hi Matthew,

Is this still an issue with udev-197-r4 and udev-init-scripts-22?

I'm asking because your patch runs commands for udev that I don't think
apply any more if rc_coldplug is no.

I'll include your patch inline here and point out what I mean.

Your comments would be greatly appreciated.


--- /etc/init.d_orig/udev	2012-06-24 18:33:16.000000000 +1000
+++ /etc/init.d/udev	2012-06-30 11:50:58.000000000 +1000
@@ -171,9 +171,16 @@
 	if ! yesno "${rc_coldplug}"; then
 		# Do not run any init-scripts, Bug #206518
 		udevadm control --property=do_not_run_plug_service=1
+
+		# only create device nodes
+		udevadm trigger --action="add" --attr-match=dev

Since we require devtmpfs now, you shouldn't have to create device nodes.

+
+		# run persistent-net stuff, bug 191466
+		udevadm trigger --action="add" --subsystem-match=net

Does this still apply?
Comment 5 William Hubbs gentoo-dev 2013-02-08 17:46:29 UTC
Created attachment 338338 [details, diff]
udev_coldplug_fix.patch

I am thinking that this patch would be more appropriate with modern udev
-- if rc_coldplug is not yes, do not run the coldplug sequence at all.

Thoghts?

William
Comment 6 Maciej S. Szmigiero 2013-02-25 20:13:02 UTC
I can confirm this is a problem with sys-fs/udev-197-r9 and sys-fs/udev-init-scripts-23.

However, I use a different patch, using a variable that's already set by init script when cold plugging is disabled.
Tested with coldplug setting both on and off.
Comment 7 Maciej S. Szmigiero 2013-02-25 20:13:58 UTC
Created attachment 340108 [details, diff]
/lib/udev/rules.d/80-drivers.rules patch
Comment 8 William Hubbs gentoo-dev 2013-02-25 21:48:15 UTC
(In reply to comment #7)
> Created attachment 340108 [details, diff] [details, diff]
> /lib/udev/rules.d/80-drivers.rules patch

I'm not interested in a patch to the rules that we would never get pushed upstream if we can avoid it.

So, again, what do you think of the patch in comment #5?

Thanks,

William
Comment 9 Maciej S. Szmigiero 2013-02-25 23:49:49 UTC
Created attachment 340120 [details, diff]
udev coldplug fix

I've used your patch from comment #5, but added back subsystems trigger
(it looks like it just adds the subsystems themselves and already loaded kernel modules as "devices" - should be harmless).

Also added explicit "--type=devices" to non-coldplug branch (it's a default setting, but the coldplug branch uses it explicitly, so use it here to not break the code pattern).

I've tested it and after this patch no extra modules are loaded on boot by udev on my system (of course, I've reverted the rule change first).
Comment 10 William Hubbs gentoo-dev 2013-02-26 04:13:29 UTC
Created attachment 340132 [details, diff]
udev-coldplug.patch

Sorry, I pointed you to the wrong patch. I thought I had attached this
one, but I hadn't.

Since modern udev uses devtmpfs, I believe we can completely avoid
calling "udevadm trigger" when nocoldplug is specified on the kernel
command line.

So, can you please test this patch? This should be the last one.

Thanks,

William
Comment 11 Maciej S. Szmigiero 2013-02-26 23:59:38 UTC
Your last patch (from comment #10) works fine for me.

However, given that this is a change in a critical system component I think it will be prudent to make sure that the trigger calls are really completely unnecessary (maybe test it on other archs than x86/amd64?).

BTW I'm not the original reporter of this bug.
Comment 12 William Hubbs gentoo-dev 2013-02-27 21:31:39 UTC
I haven't heard from the original reporter in months, so I have added
the patch in comment #10 as commit 5dd6589.
This will be part of udev-init-scripts-24.