All of lore.kernel.org
 help / color / mirror / Atom feed
* systemd service failing at start
@ 2014-07-11  2:43 Eduardo Silva
  2014-07-11  6:01 ` Li Zhijian
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eduardo Silva @ 2014-07-11  2:43 UTC (permalink / raw)
  To: openembedded-devel

Hi,

For some reason the systemd service that i plan to use for Monkey HTTP
Server in Yocto is not starting up when booting the core-image-sato image.
Once is booting it hangs saying:

  [  OK  ] Stopped Monkey HTTP Server
  [  ***   ] A Start job is running for Run pending postinsts (20min 12s...)

My service file looks like this:

--- start of monkey.service---

[Unit]
Description=Monkey HTTP Server
Requires=network.target remote-fs.target
After=network.target remote-fs.target

[Service]
Type=forking
ExecStart=/usr/bin/monkey --daemon
PIDFile=/var/run/monkey.pid.2001
TimeoutSec=10

[Install]
WantedBy=multi-user.target

-- end--

If i deploy Monkey RPM (cooked by bitbake) on the Sato image and i add this
service once the system is up, systemd can start the service without
problems, everything works: start, stop, status, etc. Do i am missing
something that can be generating some problems on the first boot ?

thanks for your help

-- 
Eduardo Silva
Monkey Software


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: systemd service failing at start
  2014-07-11  2:43 systemd service failing at start Eduardo Silva
@ 2014-07-11  6:01 ` Li Zhijian
  2014-07-11  7:37   ` Sébastien Mennetrier
  2014-07-11  7:31 ` Henning Heinold
  2014-07-11  8:47 ` Koen Kooi
  2 siblings, 1 reply; 5+ messages in thread
From: Li Zhijian @ 2014-07-11  6:01 UTC (permalink / raw)
  To: eduardo; +Cc: openembedded-devel



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: systemd service failing at start
  2014-07-11  2:43 systemd service failing at start Eduardo Silva
  2014-07-11  6:01 ` Li Zhijian
@ 2014-07-11  7:31 ` Henning Heinold
  2014-07-11  8:47 ` Koen Kooi
  2 siblings, 0 replies; 5+ messages in thread
From: Henning Heinold @ 2014-07-11  7:31 UTC (permalink / raw)
  To: openembedded-devel

On Thu, Jul 10, 2014 at 08:43:02PM -0600, Eduardo Silva wrote:
> Hi,
> 
> For some reason the systemd service that i plan to use for Monkey HTTP
> Server in Yocto is not starting up when booting the core-image-sato image.
> Once is booting it hangs saying:
> 
>   [  OK  ] Stopped Monkey HTTP Server
>   [  ***   ] A Start job is running for Run pending postinsts (20min 12s...)
> 
> My service file looks like this:
> 
> --- start of monkey.service---
> 
> [Unit]
> Description=Monkey HTTP Server
> Requires=network.target remote-fs.target
> After=network.target remote-fs.target
> 
> [Service]
> Type=forking
> ExecStart=/usr/bin/monkey --daemon
> PIDFile=/var/run/monkey.pid.2001
> TimeoutSec=10
> 
> [Install]
> WantedBy=multi-user.target
> 
> -- end--
> 
> If i deploy Monkey RPM (cooked by bitbake) on the Sato image and i add this
> service once the system is up, systemd can start the service without
> problems, everything works: start, stop, status, etc. Do i am missing
> something that can be generating some problems on the first boot ?
> 
> thanks for your help
> 

What is systemd saying when you examine the status after boot?

Bye Henning


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: systemd service failing at start
  2014-07-11  6:01 ` Li Zhijian
@ 2014-07-11  7:37   ` Sébastien Mennetrier
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Mennetrier @ 2014-07-11  7:37 UTC (permalink / raw)
  To: openembedded-devel

Hi,

I had the same issue and for me the problem came from the postinst script :

When you add a pkg_postinst_${PN} in the recipe, the documentation say to
use :

pkg_postinst_PACKAGENAME () {
     #!/bin/sh -e
     if [ x"$D" = "x" ]; then
          # Actions to carry out on the device go here
     else
          exit 1
     fi
     }

But for recipe that inherit systemd, the pkg_postint script is followed by
(see in systemd.bbclass) :

systemd_postinst() {
OPTS=""

if [ -n "$D" ]; then
    OPTS="--root=$D"
fi

if type systemctl >/dev/null 2>/dev/null; then
    systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}

    if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
        systemctl restart ${SYSTEMD_SERVICE}
    fi
fi
}

So your script is followed by "systemctl restart ${SYSTEMD_SERVICE}". And
if the service have some "Requires" that is not start when the postinst
script is executed, the message " A Start job is running for Run pending
postinsts" appears.

For solve the issue, I writed my pkg_postinst follow this schema :

pkg_postinst_${PN} () {
if [ x"$D" != "x" ]; then
    if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
        # Script in systemd_postinst function
        OPTS="--root=$D"
        if type systemctl >/dev/null 2>/dev/null; then
            systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
        fi
    fi

    # Script in updatercd_postinst function
    OPT="-r $D"
    if type update-rc.d >/dev/null 2>/dev/null; then
        update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
    fi
    exit 1
else
    # Actions to carry out on the device go here
    exit 0
fi
}


I think that is maybe a bug in yocto ;)


Regards,
Seb M


2014-07-11 8:01 GMT+02:00 Li Zhijian <lizhijian@cn.fujitsu.com>:

>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: systemd service failing at start
  2014-07-11  2:43 systemd service failing at start Eduardo Silva
  2014-07-11  6:01 ` Li Zhijian
  2014-07-11  7:31 ` Henning Heinold
@ 2014-07-11  8:47 ` Koen Kooi
  2 siblings, 0 replies; 5+ messages in thread
From: Koen Kooi @ 2014-07-11  8:47 UTC (permalink / raw)
  To: openembedded-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eduardo Silva schreef op 11-07-14 04:43:
> Hi,
> 
> For some reason the systemd service that i plan to use for Monkey HTTP 
> Server in Yocto is not starting up when booting the core-image-sato
> image. Once is booting it hangs saying:
> 
> [  OK  ] Stopped Monkey HTTP Server [  ***   ] A Start job is running for
> Run pending postinsts (20min 12s...)
> 
> My service file looks like this:
> 
> --- start of monkey.service---
> 
> [Unit] Description=Monkey HTTP Server Requires=network.target
> remote-fs.target After=network.target remote-fs.target
> 
> [Service] Type=forking ExecStart=/usr/bin/monkey --daemon 
> PIDFile=/var/run/monkey.pid.2001 TimeoutSec=10
> 
> [Install] WantedBy=multi-user.target
> 
> -- end--
> 
> If i deploy Monkey RPM (cooked by bitbake) on the Sato image and i add
> this service once the system is up, systemd can start the service
> without problems, everything works: start, stop, status, etc. Do i am
> missing something that can be generating some problems on the first boot
> ?

The postinst startup script is blocking boot, you;d have to check which
postinst is causing the holdup.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: GPGTools - http://gpgtools.org

iD8DBQFTv6SkMkyGM64RGpERAko3AJ9aJCgDtQqTNaDRFx0x0/J0JbE3agCgrYxP
cfEuXH8Qg/Z+jdh6yeCS96U=
=t4rZ
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-11  8:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11  2:43 systemd service failing at start Eduardo Silva
2014-07-11  6:01 ` Li Zhijian
2014-07-11  7:37   ` Sébastien Mennetrier
2014-07-11  7:31 ` Henning Heinold
2014-07-11  8:47 ` Koen Kooi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.