Systemd and Custom Early Init Script

T.C. Hollingsworth tchollingsworth at gmail.com
Tue Feb 5 23:58:23 UTC 2013


Sorry, I missed this mail somehow.

On Tue, Feb 5, 2013 at 3:49 PM, Gordan Bobic <gordan at bobich.net> wrote:
> Yes, I got that part mostly figured out:
>
> My custom service is:
>
> ======
> [Unit]
> Description=pciehp disable
> DefaultDependencies=no
> After=local-fs.target
>
> [Service]
> Type=oneshot
> ExecStart=echo -n 0000:00:1c.0:pcie04 >
> /sys/bus/pci_express/drivers/pciehp/unbind

I don't think systemd will execute shell fragments like this.  You
need to wrap it in `/bin/bash -c 'command'`.  Perhaps that's why it's
not working.

Also, After=local-fs.target isn't strictly necessary in your case, you
can be sure dracut has mounted root ro at least and that systemd has
mounted /sys if your unit is being run at all.  Dropping it will make
sure it gets executed as early as possible.

> ======

Speaking of dracut, if systemd can't do this early enough, you could
try doing it from the initramfs.

-T.C.


More information about the users mailing list