4

It's not very clear from the manual what:

IMPORT{cmdline}="nodmraid" actually does?

Does it bring in the "nodmraid" command line parameter in to a environment variable named nodmraid or does it just set an environment variable "nodmraid" to "1" or "" or does it just return "1" (but there is no assignment in that case)?

Thanks

1 Answer 1

7

IMPORT{cmdline}="nodmraid" parses the kernel command line and sets the nodmraid property for the device to 1 if the nodmraid is present on the boot command line and doesn't have a parameter. If it has a parameter (which doesn't really make sense for nodmraid, but you can give it one) it would set the property value to that parameter.

Simple rule to check how exactly IMPORT{cmdline} works could look like this:

IMPORT{cmdline}="ro"
IMPORT{cmdline}="modprobe.blacklist"
IMPORT{cmdline}="nodmraid"

(just picking some random options on the boot command line) and result in udevadm info

$ udevadm info /dev/sda --query property --property nodmraid,ro,modprobe.blacklist
ro=1
modprobe.blacklist=nouveau

ro doesn't have a parameter so its value is set to 1, modprobe.blacklist has a parameter (nouveau) so its value is set to nouveau and nodmraid isn't set because I don't have it in my boot parameters.

and if you actually have nodmraid on the kernel command line you can actually see it set for all devices to 1 even without the "test" rule above:

$ udevadm info /dev/vda1 --query property --property nodmraid
nodmraid=1
2
  • That makes since - not just to be clear, your sample IMPORT you put in some rules file and had to reboot? Those imported values stay around through all the various other rules being loaded? and continue on in some cached form that udevadm can get to? Aug 14, 2022 at 8:39
  • 1
    You don't need to reboot, all the rules are executed with every udev event (you can trigger your own event with udevadm trigger <device>). udev saves everything to its internal database, IMPORT{cmdline}="xyz" just adds a new property xyz for the device in the database and it is available for all other rules executed after the rule that added the property. My short example adds the property to all devices, you would usually limit it with something like SUBSYSTEM!="block", GOTO="end" to skip all non-block devices. Aug 14, 2022 at 9:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .