[systemd-devel] SYSTEMD_WANTS and oneshot services

Albert Strasheim fullung at gmail.com
Wed Aug 24 04:26:49 PDT 2011


Hello

On Tue, Aug 23, 2011 at 6:09 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Sun, 21.08.11 14:01, Albert Strasheim (fullung at gmail.com) wrote:
>> Is there a way to always get this behavior? I'd like my network
>> interfaces to be brought up regardless of how and when their modules
>> are loaded.
> Hmm, can you run "systemctl status ...." on the service before you
> reload the kmod and paste the output here? Just to verify that the

foo-net-em1.service
          Loaded: loaded (/etc/systemd/system/foo-net-em1.service)
          Active: active (exited) since Wed, 24 Aug 2011 12:30:08
+0000; 1min 49s ago
         Process: 1044 ExecStart=/sbin/ifup em1 (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/foo-net-em1.service

> service is properly stopped. Then, please set "systemd.log_level=debug
> systemd.log_target=kmsg" when reloading it. This will cause the
> transaction to be written to kmsg, please paste that as well. This
> should tell us what is included in the triggered transaction.

When reloading the module, there is no transaction in the debug log.

When I strace systemd, I can see that epoll returns and that systemd
calls recvmsg twice for the netlink messages about the two network
ports. systemd doesn't do anything else after that.

At this point, a systemctl daemon-reload followed by a systemctl
status still yields an active (exited) service. Reloading the module
after the systemctl daemon-reload still does not rerun the service.

I must then do systemctl stop foo-net-em1.service.

Then systemctl status says:

foo-net-em1.service
          Loaded: loaded (/etc/systemd/system/foo-net-em1.service)
          Active: inactive (dead)
          CGroup: name=systemd:/system/foo-net-em1.service

If I then load the module again, I get the transaction as expected and
the service is started again.

Maybe the service should have a Requisite= on the
sys-subsystem...device so that it is stopped when the device
disappears? I tried this, but the subsystem alias still doesn't seem
to work, even with the fixed udev rules.

Thoughts?

Regards

Albert


More information about the systemd-devel mailing list