From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Wegner Date: Fri, 20 Aug 2010 15:00:22 +0000 Subject: Re: cold-plugged usb flash drive not handled correctly in embedded Message-Id: <20100820150022.GE10027@debian-wegner1.datadisplay.de> List-Id: References: <20100820144236.GD10027@debian-wegner1.datadisplay.de> In-Reply-To: <20100820144236.GD10027@debian-wegner1.datadisplay.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org Hi, On Fri, Aug 20, 2010 at 04:51:44PM +0200, Kay Sievers wrote: > On Fri, Aug 20, 2010 at 16:42, Wolfgang Wegner wrote: > > /etc/udev/rules.d/50-udev.rules: > > ACTION=3D"add", KERNEL=3D"sd[a-z][0-9]", RUN+=3D"/bin/mount -t auto -o = rw,noauto,flush,quiet,nodev,nosuid,exec,noatime,dmask=000,fmask=111 /dev/%k= /mnt/usbdisk", OPTIONS=3D"last_rule" >=20 > udev 161 has no "last_rule" thing anymore. ok, but I guess this does not change anything, especially in the case when I use this as the only rule. ;-) > You mount all devices, the possibly built-in ,and the plugged-in > devices at the same place? :) Yes, currently I do, because only one USB device is "supported". > > It does not matter if I leave the standard rules in > > /libexec/rules.d/ or if I remove them altogether, in either > > case the USB flash drive is correctly mounted when plugged > > into the running system but not when it is already present when > > the system boots up. >=20 > The event for the device happens during early boot where you have no > chance to mount. Do you run 'udevadm trigger' at bootup? It will > re-generate all events so that they can be handled when userspace is > running. It would need --action=ADd for your current rule to match. The busybox start script (/etc/init.d/rcS) runs my udev start script (/etc/init.d/start_udev.sh) which in turn runs udevadm trigger as one of the last steps: [...] udevd --daemon --debug mkdir -p /dev/.udev/queue/ /dev/.udev/rules.d/ create_dev_root_rule /dev/.udev/ udevadm trigger create_dev_makedev udevadm settle exit 0 Again, I have to admit I do not really understand what create_dev_makedev is for (copied from debian), but I am quite sure it can do no harm... >From my understanding, this should generate all the events - and I see the event is there, because of this: 18.530148 [586] udev_device_new_from_syspath: device 0x40770 has devpath '/= devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/host2/target2:0:0/2:0:0:0/bl= ock/sda/sda1' 18.530268 [586] udev_rules_apply_to_event: LINK 'block/8:1' //libexec/rules= .d/50-udev-default.rules:3 18.530343 [586] udev_rules_apply_to_event: GROUP 0 //libexec/rules.d/50-ude= v-default.rules:72 18.530490 [586] udev_device_new_from_syspath: device 0x3eb40 has devpath '/= devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/host2/target2:0:0/2:0:0:0/bl= ock/sda' 18.530894 [586] udev_device_read_db: device 0x3eb40 filled with db file data All I am missing is the "RUN" line here. BTW, amazing response time! :-) Regards, Wolfgang