I used the solution proposed by galets in this post to add my own udev rule: How to wait for a /dev/video0 before starting a service
When Linux boots, my device is detected, and the rule creates a
sys-bus-pci-drivers-mydevice.device unit. I created a service which includes the
Requires=sys-bus-pci-drivers-mydevice.device, and the service only loads once my hardware has been detected and its driver loaded. Perfect!
My problem is that whenever I perform any systemctl command to manage any services, my device unit goes into inactive (dead) state. For example:
systemctl daemon-reload systemctl unmask whatever.service
Once any of these are executed, if I perform
systemctl status sys-bus-pci-drivers-mydevice.device, it reports:
* sys-bus-pci-drivers-mydevice.device Loaded: loaded Active: inactive (dead) Jan 25 09:25:41 FLABADO systemd: Found device /sys/bus/pci/drivers/mydevice.
At this point, if I attempt to restart any service which includes the
Requires= dependency, they fail. I have to reboot the system to recover.
I confirmed that the device is still present, its driver active, and commands that I execute that make use of the hardware all function perfectly.
I'd like to know if anyone has ever encountered this behavior, and if so, is there a way to avoid or recover from it without having to reboot?
I'm using Yocto 2.1 (Krogoth) to build my Linux distribution. Kernel version is 4.4.26-yocto-standard.