I have a PCI device on a CentOS 7.6 system that needs some special configuration to be applied via setpci in order for it to operate properly. I would like to create a udev rule that will automatically run a script to apply those settings when the device is detected at boot time.
I created a rule that looks like this:
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1234", ATTR{device}=="0x5678", RUN+="/bin/sh -c 'KERNEL=$kernel /usr/sbin/device-pci-setup.sh'" However, I found that the rule doesn't appear to execute at boot time when the device is added. If I change the ACTION to change, then run udevadm trigger, then the rule runs properly and invokes the script; it just doesn't run at boot time (I'm guessing because the PCI device is detected too early and it may not have full filesystem access yet).
It doesn't look like I'm the first to have this problem, but there was no solution provided here. Is there a way to make this work as desired at boot time?