Systemd Service Dependency On Device

In my SailfishOS port for Motorola Photon Q there was a dependency issue. Sometimes the mce service was starting before the LEDs become available and as a result they were not used. I solved the issue by creating a dependency on one of the LEDs for the mce service.
In general, in order to add a systemd service dependency on a device do the following:

  1. Check if systemd created device unit for the device in question:
    systemctl --all | grep dev_name
    If it exists, you can skip step 2.
  2. If there is no systemd device unit, you should tag the udev device, using “TAG+=”systemd”” in a udev rules file:
    /etc/udev/rules.d/99-led.rules
    SUBSYSTEM=="leds", KERNEL=="*keyboard-backlight", TAG+="systemd"

    Once you edited the udev rules, reboot and repeat step 1 to find out the device unit’s name (x2dbacklight.device in my case).
  3. Now that you have the device unit’s name edit the service file:
    [Unit]
    Wants=x2dbacklight.device
    After=x2dbacklight.device
You can leave a response, or trackback from your own site.

3 responses to “Systemd Service Dependency On Device”

  1. danfeng says:

    Hi ! I tried your sailfish os for msm8960 device on my xt907, but it never boot up, I did everything follow your instructions: flash cm11 first, then flash sailfish os and reboot ,stuck at bootloader unlocking warning picture forever, then I tried flash cm11 and boot successfully, then reboot and flash sailfish os and still got no lucky, both waited for about 30 minute ,I don’t know if that is long enougt , flash process is successfully, I don’t know if you are still working on this stuff, if you do please let me know ,thank you !

  2. Vladislav says:

    Hi,
    Thanks for trying the port. Can you please obtain logs as described here and send them back to me?

  3. zhou danfeng says:

    just post a reply at xda forum with Proc/last_kmsg log file

Leave a Reply