Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 365227 - /etc/init.d/udev should do do "udevadm trigger --action=change" if /dev is devtmpfs
Summary: /etc/init.d/udev should do do "udevadm trigger --action=change" if /dev is de...
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: 2011-04-28 16:53 UTC by Xake
Modified: 2013-01-28 13:42 UTC (History)
5 users (show)

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


Attachments
A patch for udev's init script. (udev-devtmpfs-change.patch,296 bytes, patch)
2011-06-08 20:49 UTC, Piotr Karbowski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xake 2011-04-28 16:53:42 UTC
Trying to investigate bug #313047 I hit a issue with /etc/init.d/udev and devtmpfs.

It seems like "udevadm trigger --action=add" does not consider itself "coldplugging" and because of that skips parts of rules (for example nothing from 10-dm.rules is imported into udev-db) if devtmpfs is used on /dev.

I tried on my system with /dev as tmpfs and as devtmpfs and confirmed that with tmpfs stuff is imported into udev-db with current script, however with devtmpfs things like DM_NAME is not imported into udev-db unless "udevadm trigger --action=change" is issued.

So it seems like if we want a complete udev-db we need to run "udevadm trigger --action=change" as well, or maybe only that (which is what I have currently, and seems to work fine), as I am not really 100% sure about what the differences are, but it seems at a quick glance like --action=add is for creating dev-nodes (which in my case devtmpfs has already done), not processing already present ones.


Portage 2.2.0_alpha30 (hardened/linux/amd64, gcc-4.5.2, libc-0-r0, 2.6.38-hardened-r1 x86_64)
=================================================================
System uname: Linux-2.6.38-hardened-r1-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.0.2
Timestamp of tree: Wed, 27 Apr 2011 12:00:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 3.1.4 [disabled]
app-shells/bash:     4.2_p8
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.7.1-r1, 3.1.3-r1
dev-util/ccache:     3.1.4
dev-util/cmake:      2.8.4-r1
sys-apps/baselayout: 2.0.2
sys-apps/openrc:     0.8.2
sys-apps/sandbox:    2.5
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.11.1-r1
sys-devel/binutils:  2.21
sys-devel/gcc:       4.5.2, 4.6.0
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
sys-kernel/linux-headers: 2.6.38
virtual/os-headers:  0
Repositories: gentoo gamerlay-stable x11 xake-overlay Mine
Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -ggdb -mtune=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.0/conf /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe -ggdb -mtune=native"
DISTDIR="/var/portage/distfiles"
FEATURES="assume-digests binpkg-logs buildpkg distlocks fixlafiles fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="ftp://ftp.sunet.se/pub/os/Linux/distributions/gentoo"
LANG="en_US.utf-8"
LC_ALL="en_US.utf-8"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu"
LINGUAS="sv en"
MAKEOPTS="-j16 -l15"
PKGDIR="/var/portage/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="/var/portage"
PORTDIR_OVERLAY="/var/overlays/layman/gamerlay /var/overlays/layman/x11 /var/overlays/layman/xake-overlay /var/overlays/mine"
SYNC="rsync://liten.csbnet.se/gentoo-portage"
USE="X a52 aac accessibility acl acpi alsa amd64 amr amrnb amrwb applet archive asyncns autoipd avahi bash-completion bluetooth branding btrfs bzip2 cairo caps ccache cdaudio cdda cdr cleartype cli clutter connection-sharing consolekit coverart cracklib crypt cups cxx dbus device-mapper devicekit devkit dhcpcd digitalradio djvu dri dts dvd dvdr dvi eds enca encode eselect evo exif fat fbcondecor ffmpeg fftw flac fluidsynth fontconfig fuse gdbm gdm gdu geoip gif gimp glib gmp gnome gnome-keyring gphoto2 gpm grammar graphite gsf gsm gstreamer gtk gtk3 gtkstyle gudev hardened hires-icons hpn ical iconv iconvacl icq icu id3tag idn ieee1394 iptc ipv6 jabber jack java6 jingle jpeg jpeg2k justify kate kvm lcms libffi libnotify libsamplerate lm_sensors logrotate lvm lzma mad maps math matroska md mdadm midi mms mmx mmxext mng moonlight mp2 mp3 mpeg mpfr mpi msn mtp mudflap multilib musepack musicbrainz natspec nautilus ncurses network-cron networkmanager nfs nls nntp nptl nptlonly ntfs ntp nut offensive ogg openal opencore-amr opengl openmp openntpd ots pam pango parted pcre pdf perl pidgin playlist png policykit pppd pulseaudio python qt3support quicktime quvi raw readline realtime rrdcgi rtmp samba schroedinger seed sensord session smp sms speex spell sse sse2 sse3 ssl ssse3 startup-notification subversion svg sysfs test tex theora thesaurus threads tiff totem truetype udev unicode upnp urandom usb userlocales vaapi vhook videos vim-syntax vorbis webkit wmf x264 xattr xcb xcomposite xinerama xml xmp xmpp xorg xrandr xscreensaver xulrunner xv xvid xvmc zeroconf zlib" ALSA_CARDS="hda-intel" 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 authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="lvm mdraid plymouth 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="sv en" NETBEANS_MODULES="cnd profiler dlight harness ide java websvccommon apisupport nb" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nouveau" 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, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-06-08 18:17:35 UTC
+1, I can confirm it. After boot I have full device nodes under /dev/mapper + the same 'nodes' under /dev/dm-X. I have to do udevadm trigger --action=change to change /dev/mapper/* to symlinks to /dev/dm-X.
Comment 2 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-06-08 20:49:26 UTC
Created attachment 276311 [details, diff]
A patch for udev's init script.
Comment 3 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-07-05 09:43:39 UTC
*friendly bump*
Comment 4 William Hubbs gentoo-dev 2011-07-05 15:32:34 UTC
The attached patch doesn't check to see if /dev is DEVTMPFS or TMPFS; it
just checks to see if /dev is a mount point.

Is that the way we want this to work?

William
Comment 5 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-07-05 16:02:29 UTC
It is done intentionally.

Udev init script check if /dev is mounted, if is, then it will not run own magic.

devtmpfs is just fancy tmpfs with nodes managed by kernel, it can also be tmpfs in initramfs and nodes created by mdev, then this tmpfs is moved to realroot before running switch_root.

As udev will not be the one who create nodes when /dev is already mounted, then we should run 'udevadm trigger --action=change' to make our /dev follow udev rules. As I already posted example, on devtmpfs I have both /dev/mapper/vg-rootfs and /dev/dm-0 as nodes, with gentoo's udev rules /dev/mapper/vg-rootfs suppose to be a symlink to /dev/dm-0 (for example). after running this udevadm trigger my devtmpfs-powered /dev become the vaild udev /dev.

(At list this is how I understand the issue and solution ;p)
Comment 6 William Hubbs gentoo-dev 2011-07-14 23:54:54 UTC
Hi,

I have not forgotten about this bug.

I'm working on getting udev 172 into the tree. In looking at upstream's
README, I have noticed the following exerpt:

------ cut here ------
  - The udev daemon should be started to handle device events sent by the kernel.
    During bootup, the kernel can be asked to send events for all already
	existing
    devices so that they too can be configured by udev. This is usually done by:
      /sbin/udevadm trigger --type=subsystems
      /sbin/udevadm trigger --type=devices
------ cut here ------

If you compare that to the way we populate /dev, there is quite a
difference, but I'm not sure why. That is what I'm attempting to figure
out.
Comment 7 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-09-28 08:43:45 UTC
How's it going? This bug is still marked as unconfirmed, I think we confirmed it.
Comment 8 William Hubbs gentoo-dev 2011-09-29 15:47:51 UTC
(In reply to comment #7)
> How's it going? This bug is still marked as unconfirmed, I think we confirmed
> it.

I found out, from upstream, that we are not  supposed to use --action=change in the init scripts.

Also, I discovered that 10-dm.rules is not part of the udev package, so we need to find out which package it belongs to and see what those rules look like.
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-09-29 19:09:50 UTC
10-dm.rules is from LVM/dmsetup.
Comment 10 William Hubbs gentoo-dev 2011-10-01 13:11:58 UTC
(In reply to comment #9)
> 10-dm.rules is from LVM/dmsetup.

This appears to be an issue with the udev rules for lvm2, so I am adding the lvm2 maintainers to this bug.

@zake @piotr:
Can you please post the version of lvm2 you have installed?

@lvm2 maintainers:
Can you take a look at 10-dm.rules for lvm2 and make sure that the actions are set up so that --action=add works correctly for the coldplug sequence?

Thanks,

William
Comment 11 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-10-01 13:23:39 UTC
sys-fs/lvm2-2.02.88

but I think this is not really lvm issue, I have readed my notes and looks like the problem is there for other nodes too, like /dev/pktcdvd is created as file, node, by mdev, and then when udev starts it does print error because it suppose to be a dir with a control node inside. I have written there that 'udevadm trigger
--action=change' fix that. The thing is to 'udevlize' /dev on start, when udev pickup already created /dev.
Comment 12 William Hubbs gentoo-dev 2011-10-02 15:12:39 UTC
This thread on the udev mailing list discusses the issue [1]. In a
nutshell, we should not use --action=change in the coldplug sequence.

Also, I do not know which version of udev you are running.

Thanks,

William

[1] http://www.spinics.net/lists/hotplug/msg05104.html
Comment 13 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-10-02 15:17:22 UTC
sys-fs/udev-171-r2
Comment 14 William Hubbs gentoo-dev 2011-10-04 14:16:25 UTC
I received more information on this bug from upstream [1]. Basically
this seems to emphasize that we should be using --action=add, and the fs
type makes no difference.

[1] http://www.spinics.net/lists/hotplug/msg05135.html
Comment 15 Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 2011-12-06 21:11:49 UTC
Hey @William any progress? 

I just had issues because of this bug. As /dev/mapper/* wasnt symlinks, it was nodes, with different permissions than /dev/dm-*, proper permissions are root:disk 660, but the devtmpfs-created /dev/mapper/* nodes are root:root 600.

udevadm trigger --action=change (or just udevadm trigger) fix it.
Comment 16 Samuli Suominen gentoo-dev 2013-01-27 14:02:36 UTC
(In reply to comment #13)
> sys-fs/udev-171-r2

Please verify with >=sys-fs/udev-197-r3 and >=sys-fs/udev-init-scripts-19-r1. Now udev is requiring devtmpfs for /dev so I suspect things have changed here.
Comment 17 poncho 2013-01-28 10:29:03 UTC
(In reply to comment #16)
> Please verify with >=sys-fs/udev-197-r3 and
> >=sys-fs/udev-init-scripts-19-r1. Now udev is requiring devtmpfs for /dev so
> I suspect things have changed here.

I don't see this issue anymore with above mentioned packages.
The symlinks in /dev/mapper/* correctly point to /dev/dm-*
Comment 18 Samuli Suominen gentoo-dev 2013-01-28 13:42:13 UTC
Close, as per Comment #17. Xake, reopen if you still experience the problem. Thanks.