Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 690C3E00848; Thu, 15 Mar 2018 09:11:56 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,HTML_MESSAGE, MANY_SPAN_IN_TEXT,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [64.235.150.234 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message * 1.0 MANY_SPAN_IN_TEXT Many tags embedded within text X-Greylist: delayed 65224 seconds by postgrey-1.32 at yocto-www; Thu, 15 Mar 2018 09:11:52 PDT Received: from 14pmail.ess.barracuda.com (14pmail.ess.barracuda.com [64.235.150.234]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 7C850E007A7 for ; Thu, 15 Mar 2018 09:11:52 -0700 (PDT) Received: from SFAMAIL.SAKURAUS.LOCAL (mail.sakuraus.com [12.26.104.5]) by mx4.ess.sfj.cudaops.com (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NO); Thu, 15 Mar 2018 16:10:25 +0000 Received: from SFAMAIL.SAKURAUS.LOCAL (10.16.3.8) by SFAMAIL.SAKURAUS.LOCAL (10.16.3.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 15 Mar 2018 09:10:03 -0700 Received: from SFAMAIL.SAKURAUS.LOCAL ([::1]) by SFAMAIL.SAKURAUS.LOCAL ([::1]) with mapi id 15.01.0669.032; Thu, 15 Mar 2018 09:10:03 -0700 From: Greg Wilson-Lindberg To: Jeremy Thien , Khem Raj Thread-Topic: [yocto] trouble getting systemd oneshot to run Thread-Index: AQHTu8SR04VV/wWOvUyTMDytB670GaPQnlgA//+m/0+AAMLkgIAAvQGA//+yETs= Date: Thu, 15 Mar 2018 16:10:03 +0000 Message-ID: References: <7d6a04f438314656ad26b1c0b764f3e9@sakuraus.com> , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.16.5.239] MIME-Version: 1.0 X-BESS-ID: 1521130118-298555-31412-80461-7 X-BESS-VER: 2018.2-r1803082101 X-BESS-Apparent-Source-IP: 12.26.104.5 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.191087 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 HTML_MESSAGE BODY: HTML included in message 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS29408 scores of KILL_LEVEL=7.0 tests=HTML_MESSAGE, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 0 Cc: "yocto@yoctoproject.org" Subject: Re: trouble getting systemd oneshot to run X-BeenThere: yocto@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Discussion of all things Yocto Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2018 16:11:56 -0000 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_dfcf8766442648b6901f833d88c536e0sakurauscom_" --_000_dfcf8766442648b6901f833d88c536e0sakurauscom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Well, first, thanks to all for the help. The recommendation for systemctl is what finally led me to my mistake. I wa= s blindly figuring that systemd would figure out that my file named can_st= art.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/cansta= rt.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 "s= ystemctl status canstart.service" may also help. In my particular service file, I wanted to start after networking is up so = I followed this post. In the Install section, I have "WantedBy=3Dmulti-user.target".= In the Unit section, I have "After=3Dnetwork-online.target" and "Wants=3Dn= etwork-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 +=3D "${PN}-service" FILES_${PN} =3D "${datadir}/*" FILES_${PN}-service =3D "${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_un= itdir} sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' ${D}${systemd_syste= m_unitdir}/canstart.service fi } SYSTEMD_PACKAGES =3D "${PN}-service" SYSTEMD_SERVICE_${PN}-service =3D "canstart.service" SYSTEMD_AUTO_ENABLE_${PN}-service =3D "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 change= d 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 underst= and what it is. You can check with systemctl status and other commands on the service on ru= nning 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 li= ke: PACKAGES +=3D "${PN}-service" FILES_${PN} =3D "${datadir}/canstart/canstart.sh " FILES_${PN}-service =3D "${systemd_unitdir}/system/canstart.service " SYSTEMD_PACKAGES =3D ${PN}-service" SYSTEMD_SERVICE_${PN}-service =3D canstart.service" SYSTEMD_AUTO_ENABLE_${PN}-service =3D "enable" Of course, this requires image to install both canstart and canstart-servic= e. 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 cor= rect locations but the .service is not running at startup. I used connman-c= onf.bb as the template for my .bb file: SUMMARY=3D"recipe to create CAN bus startup service" LICENSE =3D "CLOSED" LIC_FILES_CHKSUM =3D "" inherit systemd SRC_URI =3D "file://can_start.sh \ file://canstart.service \ " S =3D "${WORKDIR}" PACKAGE_ARCH =3D "${MACHINE_ARCH}" FILES_${PN} =3D "${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_un= itdir} sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' ${D}${systemd_syste= m_unitdir}/canstart.service fi } SYSTEMD_SERVICE_${PN} =3D "canstart.service" Service file: [Unit] Description=3DStartup CAN bus interface [Service] Type=3Doneshot ExecStart=3D@SCRIPTDIR@/can_start.sh [Install] WantedBy=3Dnetwork.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 c= ontains 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.thien@adtecdigital.net | mobil= e: +1 (904) 910-1749 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto -- Jeremy Thien Director of Engineering | Adtec Digital jeremy.thien@adtecdigital.net | mobil= e: +1 (904) 910-1749 --_000_dfcf8766442648b6901f833d88c536e0sakurauscom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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 name= d can_start.sh was a shell script, without putting #!/bin/sh at the beginni= ng 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 <jere= myt@adtecinc.com>
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/syst= emd/system/canstart.service and a symbolic link in /etc/systemd/system/netw= ork.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&= quot; to see if there is any useful information. "systemctl start cans= tart.service" and "systemctl status canstart.service" may also help.

In my particular service file, I wanted to start after networking is u= p so I followed this post. In the Install section, I have "WantedBy=3Dmulti-user= .target". In the Unit section, I have "After=3Dnetwork-online.tar= get" and "Wants=3Dnetwork-online.target". 

On Wed, Mar 14, 2018 at 10:28 PM Khem Raj <raj.khem@gmail.com> wrote:
On Wed, Mar 14, 2018 at 3:20 PM Greg Wilson-Lindberg <= GWilson@sakuraus.= com> wrote:

I changed it to look like:


PACKAGES +=3D "${PN}-service"
FILES_${PN} =3D "${datadir}/*"
FILES_${PN}-service =3D "${systemd_system_unitdir}/canstart.service"
do_install () {
    if test -e ${WORKDIR}/can_start.sh &&
       test -e ${WORKDIR}/canstart.serv=
ice; then
        install -d ${D}${datadir}/canstart
        install -m 0755 ${WORKDIR}/ca=
n_start.sh ${D}${datadir}/canstart
        install -d ${D}${systemd_system=
_unitdir}
        install -m 0644 ${WORKDIR}/ca=
nstart.service ${D}${systemd_system_unitdir}
        sed -i -e 's|@SCRIPTDIR@|${datadir}/c=
anstart|g' ${D}${systemd_system_=
unitdir}/canstart.service
    fi
}

SYSTEMD_PACKAGES =3D "${PN}-service"
SYSTEMD_SERVICE_${PN}-service =3D "canstart.service"
SYSTEMD_AUTO_ENABLE_${PN}-service =3D <=
span style=3D"color:#008080">"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 c= hanged 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 underst= and 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 <jeremyt@adtecinc.com>
Sent: Wednesday, March 14, 2018 1:08 PM
To: Greg Wilson-Lindberg
Cc: yoct= o@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 complica= ted, but I put the script in one package and the service in another somethi= ng like:

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

Of course, this requires image to install both canstart and canstart-s= ervice.

Hope this helps,
Jeremy Thien

On Wed, Mar 14, 2018 at 3:21 PM Greg Wilson-Lindberg <GWilson@sakuraus.com> w= rote:

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=3D"recipe to create CAN bus startup service"

LICENSE =3D "CLOSED"
LIC_FILES_CHKSUM =3D ""

inherit systemd

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

S =3D &q=
uot;${WORKDIR}"

PACKAGE_ARCH =3D "${MACHINE_ARCH}"

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

do_install () {
    if test -e ${WORKDIR}/can_start.sh &&
       test -e ${WORKDIR}/canstart.serv=
ice; then
        install -d ${D}${datadir}/canstart
        install -m 0755 ${WORKDIR}/ca=
n_start.sh ${D}${datadir}/canstart
        install -d ${D}${systemd_system=
_unitdir}
        install -m 0644 ${WORKDIR}/ca=
nstart.service ${D}${systemd_system_unitdir}
        sed -i -e 's|@SCRIPTDIR@|${datadir}/c=
anstart|g' ${D}${systemd_system_=
unitdir}/canstart.service
    fi
}

SYSTEMD_SERVICE_${PN} =3D "canstart.service"

Service file:
[Unit]
Description=3DStartup CAN bus interface

[Service]
Type=3Doneshot
ExecStart=3D@SCRIPTDIR@/can_start.sh

[Install]
WantedBy=3Dnetwork.target

From lo= oking at the connman-conf sample I'm setting everything up correctly and th= e service should default to running on startup but it is not.

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

Any and all help with this would be greatly appreciated.


Regards,

Greg Wilson-Lindberg

--
_______________________________________________
yocto mailing list
yocto@yoctoproj= ect.org
https://lists.yoctoproject.org/listinfo/yocto
--
Jeremy Thien
Director of Engineering | Adtec Digital
--
_______________________________________________
yocto mailing list
yocto@yoctoproj= ect.org
https://lists.yoctoproject.org/listinfo/yocto
--
Jeremy Thien
Director of Engineering | Adtec Digital
jeremy.thien@adtecdig= ital.net | mobile: +1 (904) 910-1749
--_000_dfcf8766442648b6901f833d88c536e0sakurauscom_--