Recently I discovered the ENV{REMOVE_CMD} variable, which removes the need for using the ACTION==remove match in the case you need both add and remove. I was trying to find some info on other useful variables that can be set in udev rules, but unfortunately I couldn't find anything of value.Does any one know a list where all the ENV variables can be found?
What ENV variables can be set in udev rules?
udev
It appears that the ENV variables are pretty free-form and bound to devices. The only enforced restrictions is that none of these keys may be be used: ACTION, SUBSYSTEM, DEVTYPE, MAJOR, MINOR, DRIVER, IFINDEX, DEVNAME, DEVLINKS, DEVPATH, TAGS.Other than that, interpretation of the environment variables is left to other rules and programs. Use grep -rni 'ENV{' /{lib,etc}/udev/rules.d to find the consumers and providers of environment variables. In your specific REMOVE_CMD case, the file /lib/udev/rules.d/50-udev-default.rules is responsible for handling this action:# run a command on remove eventsACTION==remove, ENV{REMOVE_CMD}!=, RUN+=$env{REMOVE_CMD}ACTION==remove, GOTO=default_endWith this command you can find more environment variables:grep -hrPo 'ENV{\K[^}]*(?=}=[^=])' /{etc,lib}/udev/rules.d | sort -uAs an example, consider the 95-upower-hid.rules file. This file sets the UPOWER_BATTERY_TYPE variable. No other rules use this file, but the UPower daemon registers to udevd for add/change/remove events. Then when an event occurs, UPower specifically queries the device for this variable in order to determine whether it should treat is as regular mice, UPSes or Unifying receiver devices.Another (more useful) example is the UDISKS_IGNORE environment variable which can be used to hint graphical file browsers to hide the device in the drives list. Specifically for udisks2, you can find the variables in udisks(8) manual page (located this using man -K UDISKS_IGNORE).