I've been struggling to solve this for 2 or 3 days now. I am using Yocto to customize a Linux build. I have a systemd service called app2.service as below.

After=network.target uncrypte_app.service uncrypte_data.service 

ExecStartPre=/bin/rm -f /var/run/appd.pid
ExecStartPre=/app/provisiondevice && /storage/revertupdate
ExecStart=/app/appd start
ExecStop=/app/appd stop


Below is the bottom of my .bb recipe file.

SYSTEMD_SERVICE_${PN} = "app2.service" is the Yocto equivalent of systemctl enable app2.service

FILES_${PN} += "app"
FILES_${PN} += "/persist_storage \
            /storage \
FILES_${PN} += "${sysconfdir} \
           ${systemd_unitdir}/system/app2.service \
inherit systemd

SYSTEMD_SERVICE_${PN} = "app2.service"

However, when my device starts , the service does not.

When I check the status of my service with systemctl status app2.service , I get the following

● app2.service - app2
 Loaded: loaded (/lib/systemd/system/app2.service; disabled; vendor 
preset: enabled)
   Active: inactive (dead)**

I cannot understand this. When I then manually enable it with systemctl enable app2.service , it works fine.

It should be automatically enabled the way I have it specified in the recipe file. I'd appreciate any help with this.

Also adding the following to the bottom of my recipe file doesn't work either :

  • 1
    For anyone playing along at home (or via Stack Overflow), the SO version of this question has been closed there as off-topic, so it's perfectly at-home here at U&L.
    – Jeff Schaller
    Jul 5, 2019 at 14:42
  • @JeffSchaller It is still a software-related question relating to using Yocto and Bitbake. It was more suitable on SO to be honest Jul 5, 2019 at 16:55
  • The daemon creates a pid file. Maybe it is written as an old style daemon, in which case Type should be forking instead of simple in the service file. What does the log say? Jul 6, 2019 at 6:18
  • Note you should not be using && in any execstart*=. These are not shell commands. Only ; (with spaces) can be used as a separator.
    – meuh
    Jul 7, 2019 at 14:48
  • @Engineer999, did you ever solve this problem?
    – Nick
    Feb 15, 2021 at 22:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.