Discussion:
Udev rule from Yocto 1.8.1 no longer works in Yocto 2.2.2
(too old to reply)
Brian Hutchinson
2017-08-16 18:52:02 UTC
Permalink
Raw Message
Hi,

I have a case where I have basically a cold plugged USB based mass storage
device.

This is an embedded application, so I do some magic with udev rules (not
using systemd yet which would make this easier from what I hear) to make
sure the device has e2fsck ran on it before it mounts.

To make a long story short, I have one "add" rule that adds the device
symlink and sets a user environment variable (lets call it my_usb_storage).

Later when init is running, I have a rc.local script that runs e2fsck on
the device if the expected symlink is present (udev enumerated it as we
expected) and when fsck returns with a clean status, a udevadm trigger
event fires and I have a matching rule that tests user set environment
variable ENV{my_usb_storage}=="1".

This testing of a user set environment variable used to work but now it
doesn't.

In researching the problem, I stumbled on this email in the archives:

https://lists.freedesktop.org/archives/systemd-devel/2013-December/015707.html

... which clued me into maybe having to use a rule that does IMPORT{db}.
In trying to find info on IMPORT{db} I found the original commit of the
feature???

https://www.redhat.com/archives/lvm-devel/2010-April/msg00225.html

... which was done in 2010 but my udev from Yocto 1.8.1 is beyond udev 152
so don't know how I didn't run into this problem earlier.

So I still can't find any good examples or documentation on how to use
IMPORT{db} to get back the expected behavior I had before.

Ironnically my udevadm trigger that worked was also a "add" trigger and I
get the idea that I shouldn't have done that but I basically hacked the
standard mount.sh udev script to use with my special cold plugged device
and it won't mount unless it's a "add" even so that's why I did it.

Anybody know what I'm getting at here and how I can get my rules to work
again???

Thanks!

Regards,

Brian

Loading...