[OE-core] systemd + run-postinsts.service

Patrick Ohly patrick.ohly at intel.com
Tue Mar 24 07:59:36 UTC 2015


On Tue, 2015-03-24 at 09:33 +1100, Jonathan Liu wrote:
> I am not sure how well systemd works with executing systemctl to 
> manipulate services from within a service that is starting...
>
> What is the definition of foobar.service?

Manipulating services within a service works. You were on the right
track when suspecting a dependency deadlock.

> foobar.service may depend on other services/mounts/targets to start 
> before it but since "systemctl start" is blocking, those dependencies 
> may not be satisfied yet until sometime after run-postinsts.service 
> which can result in a circular dependency deadlock. See 
> DefaultDependencies, After, Before in 
> http://www.freedesktop.org/software/systemd/man/systemd.unit.html.
> 
> Things to try:
> 1. Refactor foobar.service and your image recipe to not require calling 
> systemctl from within a systemd service
> 2. Change "systemctl start foobar" to "systemctl start --no-block 
> foobar" to let the startup continue without waiting until foobar is started

"--no-block" did indeed help. The recipe uses only the default
dependencies, but that already seems enough to prevent starting it at
the time when run-postinsts.service runs.

I guess the situation hasn't come up before. But when it does, it
probably breaks systemd.bbclass for most services. I wonder whether
--no-block should be added unconditionally to systemd.bblcass'
"systemctl start" invocation?

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.






More information about the Openembedded-core mailing list