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]
dev-lang/python: 2.7.1-r1, 3.1.3-r1
sys-devel/autoconf: 2.13, 2.68
sys-devel/automake: 1.9.6-r3, 1.11.1-r1
sys-devel/gcc: 4.5.2, 4.6.0
Repositories: gentoo gamerlay-stable x11 xake-overlay Mine
Installed sets: @system
CFLAGS="-march=native -O2 -pipe -ggdb -mtune=native"
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"
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"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/overlays/layman/gamerlay /var/overlays/layman/x11 /var/overlays/layman/xake-overlay /var/overlays/mine"
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
+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.
Created attachment 276311 [details, diff]
A patch for udev's init script.
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?
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)
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
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
How's it going? This bug is still marked as unconfirmed, I think we confirmed it.
(In reply to comment #7)
> How's it going? This bug is still marked as unconfirmed, I think we confirmed
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.
10-dm.rules is from LVM/dmsetup.
(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.
Can you please post the version of lvm2 you have installed?
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?
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.
This thread on the udev mailing list discusses the issue . 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.
I received more information on this bug from upstream . Basically
this seems to emphasize that we should be using --action=add, and the fs
type makes no difference.
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.
(In reply to comment #13)
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.
(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-*
Close, as per Comment #17. Xake, reopen if you still experience the problem. Thanks.