Re: [yocto] trouble getting systemd oneshot to run

2018-03-15 Thread Greg Wilson-Lindberg
Well, first, thanks to all for the help.


The recommendation for systemctl is what finally led me to my mistake. I was 
blindly figuring that  systemd would figure out that my file named can_start.sh 
was a shell script, without putting #!/bin/sh at the beginning of it. dumb.


At any rate, I've got it running now, on to the next problem.


Thanks again for the community and all of your help,

Greg


From: Jeremy Thien 
Sent: Thursday, March 15, 2018 6:44:17 AM
To: Khem Raj
Cc: Greg Wilson-Lindberg; yocto@yoctoproject.org
Subject: Re: [yocto] trouble getting systemd oneshot to run

Agreed. I would expect the service file to be in 
/lib/systemd/system/canstart.service and a symbolic link in 
/etc/systemd/system/network.target.wants/canstart.service.

If those are both present, then the problem is in the service file. If the 
symbolic link is missing, try "systemctl enable canstart.service" to see if 
there is any useful information. "systemctl start canstart.service" and 
"systemctl status canstart.service" may also help.

In my particular service file, I wanted to start after networking is up so I 
followed this 
post<https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/>. In the 
Install section, I have "WantedBy=multi-user.target". In the Unit section, I 
have "After=network-online.target" and "Wants=network-online.target".

On Wed, Mar 14, 2018 at 10:28 PM Khem Raj 
mailto:raj.k...@gmail.com>> wrote:
On Wed, Mar 14, 2018 at 3:20 PM Greg Wilson-Lindberg 
mailto:gwil...@sakuraus.com>> wrote:

I changed it to look like:

PACKAGES += "${PN}-service"

FILES_${PN} = "${datadir}/*"
FILES_${PN}-service = "${systemd_system_unitdir}/canstart.service"

do_install () {
if test -e ${WORKDIR}/can_start.sh &&
   test -e ${WORKDIR}/canstart.service; then
install -d ${D}${datadir}/canstart
install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/canstart.service 
${D}${systemd_system_unitdir}
sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
${D}${systemd_system_unitdir}/canstart.service
fi
}


SYSTEMD_PACKAGES = "${PN}-service"
SYSTEMD_SERVICE_${PN}-service = "canstart.service"
SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"



Still got the same results, my task is not running at startup.
To make sure that there wasn't some problem in running the script, I changed 
the ExecStart to echo to a file in /tmp. Nothing there. The .service file is 
not being executed.
I've obviously got something totally messed up, but I'm darned if I understand 
what it is.


You can check with systemctl status and other commands on the service on 
running system and might find more details


From: Jeremy Thien mailto:jere...@adtecinc.com>>
Sent: Wednesday, March 14, 2018 1:08 PM
To: Greg Wilson-Lindberg
Cc: yocto@yoctoproject.org<mailto:yocto@yoctoproject.org>
Subject: Re: [yocto] trouble getting systemd oneshot to run

I am no expert, but I have a similar recipe. It might be over complicated, but 
I put the script in one package and the service in another something like:

PACKAGES += "${PN}-service"
FILES_${PN} = "${datadir}/canstart/canstart.sh "
FILES_${PN}-service = "${systemd_unitdir}/system/canstart.service "
SYSTEMD_PACKAGES = ${PN}-service"
SYSTEMD_SERVICE_${PN}-service = canstart.service"
SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"

Of course, this requires image to install both canstart and canstart-service.

Hope this helps,
Jeremy Thien

On Wed, Mar 14, 2018 at 3:21 PM Greg Wilson-Lindberg 
mailto:gwil...@sakuraus.com>> wrote:

I'm building yocto for a raspberry pi3 from Qt's b2qt version.


I'm running into two problems, I've got all of the files copying to the correct 
locations but the .service is not running at startup. I used 
connman-conf.bb<http://connman-conf.bb> as the template for my .bb file:


SUMMARY="recipe to create CAN bus startup service"

LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

inherit systemd

SRC_URI = "file://can_start.sh \
   file://canstart.service \
"

S = "${WORKDIR}"

PACKAGE_ARCH = "${MACHINE_ARCH}"

FILES_${PN} = "${datadir}/*"

do_install () {
if test -e ${WORKDIR}/can_start.sh &&
   test -e ${WORKDIR}/canstart.service; then
install -d ${D}${datadir}/canstart
install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/canstart.service 
${D}${systemd_system_unitdir}
sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
${D}${

Re: [yocto] trouble getting systemd oneshot to run

2018-03-15 Thread Jeremy Thien
Agreed. I would expect the service file to be in
/lib/systemd/system/canstart.service and a symbolic link in
/etc/systemd/system/network.target.wants/canstart.service.

If those are both present, then the problem is in the service file. If the
symbolic link is missing, try "systemctl enable canstart.service" to see if
there is any useful information. "systemctl start canstart.service" and
"systemctl status canstart.service" may also help.

In my particular service file, I wanted to start after networking is up so
I followed this post
<https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/>. In the
Install section, I have "WantedBy=multi-user.target". In the Unit section,
I have "After=network-online.target" and "Wants=network-online.target".

On Wed, Mar 14, 2018 at 10:28 PM Khem Raj  wrote:

> On Wed, Mar 14, 2018 at 3:20 PM Greg Wilson-Lindberg 
> wrote:
>
>> I changed it to look like:
>>
>> PACKAGES += "${PN}-service"
>>
>> FILES_${PN} = "${datadir}/*"
>> FILES_${PN}-service = "${systemd_system_unitdir}/canstart.service"
>>
>> do_install () {
>> if test -e ${WORKDIR}/can_start.sh &&
>>test -e ${WORKDIR}/canstart.service; then
>> install -d ${D}${datadir}/canstart
>> install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
>> install -d ${D}${systemd_system_unitdir}
>> install -m 0644 ${WORKDIR}/canstart.service 
>> ${D}${systemd_system_unitdir}
>> sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
>> ${D}${systemd_system_unitdir}/canstart.service
>> fi}
>>
>> SYSTEMD_PACKAGES = "${PN}-service"
>> SYSTEMD_SERVICE_${PN}-service = "canstart.service"
>> SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"
>>
>> Still got the same results, my task is not running at startup.
>> To make sure that there wasn't some problem in running the script, I
>> changed the ExecStart to echo to a file in /tmp. Nothing there. The
>> .service file is not being executed.
>> I've obviously got something totally messed up, but I'm darned if I
>> understand what it is.
>>
>>
> You can check with systemctl status and other commands on the service on
> running system and might find more details
>
>>
>> --
>> *From:* Jeremy Thien 
>> *Sent:* Wednesday, March 14, 2018 1:08 PM
>> *To:* Greg Wilson-Lindberg
>> *Cc:* yocto@yoctoproject.org
>> *Subject:* Re: [yocto] trouble getting systemd oneshot to run
>>
>> I am no expert, but I have a similar recipe. It might be over
>> complicated, but I put the script in one package and the service in another
>> something like:
>>
>> PACKAGES += "${PN}-service"
>> FILES_${PN} = "${datadir}/canstart/canstart.sh "
>> FILES_${PN}-service = "${systemd_unitdir}/system/canstart.service "
>> SYSTEMD_PACKAGES = ${PN}-service"
>> SYSTEMD_SERVICE_${PN}-service = canstart.service"
>> SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"
>>
>> Of course, this requires image to install both canstart and
>> canstart-service.
>>
>> Hope this helps,
>> Jeremy Thien
>>
>> On Wed, Mar 14, 2018 at 3:21 PM Greg Wilson-Lindberg <
>> gwil...@sakuraus.com> wrote:
>>
>>> I'm building yocto for a raspberry pi3 from Qt's b2qt version.
>>>
>>>
>>> I'm running into two problems, I've got all of the files copying to the
>>> correct locations but the .service is not running at startup. I used
>>> connman-conf.bb as the template for my .bb file:
>>>
>>>
>>> SUMMARY="recipe to create CAN bus startup service"
>>>
>>> LICENSE = "CLOSED"
>>> LIC_FILES_CHKSUM = ""
>>>
>>> inherit systemd
>>>
>>> SRC_URI = "file://can_start.sh \   file://canstart.service \"
>>>
>>> S = "${WORKDIR}"
>>>
>>> PACKAGE_ARCH = "${MACHINE_ARCH}"
>>>
>>> FILES_${PN} = "${datadir}/*"
>>> do_install () {
>>> if test -e ${WORKDIR}/can_start.sh &&
>>>test -e ${WORKDIR}/canstart.service; then
>>> install -d ${D}${datadir}/canstart
>>> install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
>>> install -d ${D}${systemd_system_unitdir}
>>> install -m 0644 ${WORKDIR}/canstart.service 
>>&

Re: [yocto] trouble getting systemd oneshot to run

2018-03-14 Thread Khem Raj
On Wed, Mar 14, 2018 at 3:20 PM Greg Wilson-Lindberg 
wrote:

> I changed it to look like:
>
> PACKAGES += "${PN}-service"
>
> FILES_${PN} = "${datadir}/*"
> FILES_${PN}-service = "${systemd_system_unitdir}/canstart.service"
>
> do_install () {
> if test -e ${WORKDIR}/can_start.sh &&
>test -e ${WORKDIR}/canstart.service; then
> install -d ${D}${datadir}/canstart
> install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
> install -d ${D}${systemd_system_unitdir}
> install -m 0644 ${WORKDIR}/canstart.service 
> ${D}${systemd_system_unitdir}
> sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
> ${D}${systemd_system_unitdir}/canstart.service
> fi}
>
> SYSTEMD_PACKAGES = "${PN}-service"
> SYSTEMD_SERVICE_${PN}-service = "canstart.service"
> SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"
>
> Still got the same results, my task is not running at startup.
> To make sure that there wasn't some problem in running the script, I
> changed the ExecStart to echo to a file in /tmp. Nothing there. The
> .service file is not being executed.
> I've obviously got something totally messed up, but I'm darned if I
> understand what it is.
>
>
You can check with systemctl status and other commands on the service on
running system and might find more details

>
> ------------------
> *From:* Jeremy Thien 
> *Sent:* Wednesday, March 14, 2018 1:08 PM
> *To:* Greg Wilson-Lindberg
> *Cc:* yocto@yoctoproject.org
> *Subject:* Re: [yocto] trouble getting systemd oneshot to run
>
> I am no expert, but I have a similar recipe. It might be over complicated,
> but I put the script in one package and the service in another something
> like:
>
> PACKAGES += "${PN}-service"
> FILES_${PN} = "${datadir}/canstart/canstart.sh "
> FILES_${PN}-service = "${systemd_unitdir}/system/canstart.service "
> SYSTEMD_PACKAGES = ${PN}-service"
> SYSTEMD_SERVICE_${PN}-service = canstart.service"
> SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"
>
> Of course, this requires image to install both canstart and
> canstart-service.
>
> Hope this helps,
> Jeremy Thien
>
> On Wed, Mar 14, 2018 at 3:21 PM Greg Wilson-Lindberg 
> wrote:
>
>> I'm building yocto for a raspberry pi3 from Qt's b2qt version.
>>
>>
>> I'm running into two problems, I've got all of the files copying to the
>> correct locations but the .service is not running at startup. I used
>> connman-conf.bb as the template for my .bb file:
>>
>>
>> SUMMARY="recipe to create CAN bus startup service"
>>
>> LICENSE = "CLOSED"
>> LIC_FILES_CHKSUM = ""
>>
>> inherit systemd
>>
>> SRC_URI = "file://can_start.sh \   file://canstart.service \"
>>
>> S = "${WORKDIR}"
>>
>> PACKAGE_ARCH = "${MACHINE_ARCH}"
>>
>> FILES_${PN} = "${datadir}/*"
>> do_install () {
>> if test -e ${WORKDIR}/can_start.sh &&
>>test -e ${WORKDIR}/canstart.service; then
>> install -d ${D}${datadir}/canstart
>> install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
>> install -d ${D}${systemd_system_unitdir}
>> install -m 0644 ${WORKDIR}/canstart.service 
>> ${D}${systemd_system_unitdir}
>> sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
>> ${D}${systemd_system_unitdir}/canstart.service
>> fi}
>>
>> SYSTEMD_SERVICE_${PN} = "canstart.service"
>>
>>
>> Service file:
>>
>> [Unit]
>> Description=Startup CAN bus interface
>>
>> [Service]
>> Type=oneshot
>> ExecStart=@SCRIPTDIR@/can_start.sh
>>
>> [Install]
>> WantedBy=network.target
>>
>>
>> From looking at the connman-conf sample I'm setting everything up
>> correctly and the service should default to running on startup but it is
>> not.
>>
>> The second 'problem' is really just perplexing, if I dump the variables S
>> contains a path to a directory in my root not "${WORKDIR}".
>>
>> Any and all help with this would be greatly appreciated.
>>
>>
>> Regards,
>>
>> Greg Wilson-Lindberg
>> --
>> ___
>> yocto mailing list
>> yocto@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
>>
> --
> Jeremy Thien
> Director of Engineering | Adtec Digital
> jeremy.th...@adtecdigital.net | mobile: +1 (904) 910-1749
> --
> ___
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] trouble getting systemd oneshot to run

2018-03-14 Thread Greg Wilson-Lindberg
I changed it to look like:

PACKAGES += "${PN}-service"

FILES_${PN} = "${datadir}/*"
FILES_${PN}-service = "${systemd_system_unitdir}/canstart.service"

do_install () {
if test -e ${WORKDIR}/can_start.sh &&
   test -e ${WORKDIR}/canstart.service; then
install -d ${D}${datadir}/canstart
install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/canstart.service 
${D}${systemd_system_unitdir}
sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
${D}${systemd_system_unitdir}/canstart.service
fi
}


SYSTEMD_PACKAGES = "${PN}-service"
SYSTEMD_SERVICE_${PN}-service = "canstart.service"
SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"



Still got the same results, my task is not running at startup.
To make sure that there wasn't some problem in running the script, I changed 
the ExecStart to echo to a file in /tmp. Nothing there. The .service file is 
not being executed.
I've obviously got something totally messed up, but I'm darned if I understand 
what it is.



From: Jeremy Thien 
Sent: Wednesday, March 14, 2018 1:08 PM
To: Greg Wilson-Lindberg
Cc: yocto@yoctoproject.org
Subject: Re: [yocto] trouble getting systemd oneshot to run

I am no expert, but I have a similar recipe. It might be over complicated, but 
I put the script in one package and the service in another something like:

PACKAGES += "${PN}-service"
FILES_${PN} = "${datadir}/canstart/canstart.sh "
FILES_${PN}-service = "${systemd_unitdir}/system/canstart.service "
SYSTEMD_PACKAGES = ${PN}-service"
SYSTEMD_SERVICE_${PN}-service = canstart.service"
SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"

Of course, this requires image to install both canstart and canstart-service.

Hope this helps,
Jeremy Thien

On Wed, Mar 14, 2018 at 3:21 PM Greg Wilson-Lindberg 
mailto:gwil...@sakuraus.com>> wrote:

I'm building yocto for a raspberry pi3 from Qt's b2qt version.


I'm running into two problems, I've got all of the files copying to the correct 
locations but the .service is not running at startup. I used 
connman-conf.bb<http://connman-conf.bb> as the template for my .bb file:


SUMMARY="recipe to create CAN bus startup service"

LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

inherit systemd

SRC_URI = "file://can_start.sh \
   file://canstart.service \
"

S = "${WORKDIR}"

PACKAGE_ARCH = "${MACHINE_ARCH}"

FILES_${PN} = "${datadir}/*"

do_install () {
if test -e ${WORKDIR}/can_start.sh &&
   test -e ${WORKDIR}/canstart.service; then
install -d ${D}${datadir}/canstart
install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/canstart.service 
${D}${systemd_system_unitdir}
sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
${D}${systemd_system_unitdir}/canstart.service
fi
}

SYSTEMD_SERVICE_${PN} = "canstart.service"



Service file:




[Unit]
Description=Startup CAN bus interface

[Service]
Type=oneshot
ExecStart=@SCRIPTDIR@/can_start.sh

[Install]
WantedBy=network.target



>From looking at the connman-conf sample I'm setting everything up correctly 
>and the service should default to running on startup but it is not.

The second 'problem' is really just perplexing, if I dump the variables S 
contains a path to a directory in my root not "${WORKDIR}".


Any and all help with this would be greatly appreciated.


Regards,

Greg Wilson-Lindberg

--
___
yocto mailing list
yocto@yoctoproject.org<mailto:yocto@yoctoproject.org>
https://lists.yoctoproject.org/listinfo/yocto
--
Jeremy Thien
Director of Engineering | Adtec Digital
jeremy.th...@adtecdigital.net<mailto:jeremy.th...@adtecdigital.net> | mobile: 
+1 (904) 910-1749
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] trouble getting systemd oneshot to run

2018-03-14 Thread Jeremy Thien
I am no expert, but I have a similar recipe. It might be over complicated,
but I put the script in one package and the service in another something
like:

PACKAGES += "${PN}-service"
FILES_${PN} = "${datadir}/canstart/canstart.sh "
FILES_${PN}-service = "${systemd_unitdir}/system/canstart.service "
SYSTEMD_PACKAGES = ${PN}-service"
SYSTEMD_SERVICE_${PN}-service = canstart.service"
SYSTEMD_AUTO_ENABLE_${PN}-service = "enable"

Of course, this requires image to install both canstart and
canstart-service.

Hope this helps,
Jeremy Thien

On Wed, Mar 14, 2018 at 3:21 PM Greg Wilson-Lindberg 
wrote:

> I'm building yocto for a raspberry pi3 from Qt's b2qt version.
>
>
> I'm running into two problems, I've got all of the files copying to the
> correct locations but the .service is not running at startup. I used
> connman-conf.bb as the template for my .bb file:
>
>
> SUMMARY="recipe to create CAN bus startup service"
>
> LICENSE = "CLOSED"
> LIC_FILES_CHKSUM = ""
>
> inherit systemd
>
> SRC_URI = "file://can_start.sh \   file://canstart.service \"
>
> S = "${WORKDIR}"
>
> PACKAGE_ARCH = "${MACHINE_ARCH}"
>
> FILES_${PN} = "${datadir}/*"
> do_install () {
> if test -e ${WORKDIR}/can_start.sh &&
>test -e ${WORKDIR}/canstart.service; then
> install -d ${D}${datadir}/canstart
> install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
> install -d ${D}${systemd_system_unitdir}
> install -m 0644 ${WORKDIR}/canstart.service 
> ${D}${systemd_system_unitdir}
> sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
> ${D}${systemd_system_unitdir}/canstart.service
> fi}
>
> SYSTEMD_SERVICE_${PN} = "canstart.service"
>
>
> Service file:
>
> [Unit]
> Description=Startup CAN bus interface
>
> [Service]
> Type=oneshot
> ExecStart=@SCRIPTDIR@/can_start.sh
>
> [Install]
> WantedBy=network.target
>
>
> From looking at the connman-conf sample I'm setting everything up
> correctly and the service should default to running on startup but it is
> not.
>
> The second 'problem' is really just perplexing, if I dump the variables S
> contains a path to a directory in my root not "${WORKDIR}".
>
> Any and all help with this would be greatly appreciated.
>
>
> Regards,
>
> Greg Wilson-Lindberg
> --
> ___
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>
-- 
Jeremy Thien
Director of Engineering | Adtec Digital
jeremy.th...@adtecdigital.net | mobile: +1 (904) 910-1749
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] trouble getting systemd oneshot to run

2018-03-14 Thread Greg Wilson-Lindberg
I'm building yocto for a raspberry pi3 from Qt's b2qt version.


I'm running into two problems, I've got all of the files copying to the correct 
locations but the .service is not running at startup. I used connman-conf.bb as 
the template for my .bb file:


SUMMARY="recipe to create CAN bus startup service"

LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

inherit systemd

SRC_URI = "file://can_start.sh \
   file://canstart.service \
"

S = "${WORKDIR}"

PACKAGE_ARCH = "${MACHINE_ARCH}"

FILES_${PN} = "${datadir}/*"

do_install () {
if test -e ${WORKDIR}/can_start.sh &&
   test -e ${WORKDIR}/canstart.service; then
install -d ${D}${datadir}/canstart
install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/canstart.service 
${D}${systemd_system_unitdir}
sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' 
${D}${systemd_system_unitdir}/canstart.service
fi
}

SYSTEMD_SERVICE_${PN} = "canstart.service"



Service file:




[Unit]
Description=Startup CAN bus interface

[Service]
Type=oneshot
ExecStart=@SCRIPTDIR@/can_start.sh

[Install]
WantedBy=network.target



>From looking at the connman-conf sample I'm setting everything up correctly 
>and the service should default to running on startup but it is not.

The second 'problem' is really just perplexing, if I dump the variables S 
contains a path to a directory in my root not "${WORKDIR}".


Any and all help with this would be greatly appreciated.


Regards,

Greg Wilson-Lindberg
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto