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.
[Unit]
Description=app2
ConditionPathExists=/app
After=network.target uncrypte_app.service uncrypte_data.service
[Service]
Type=simple
WorkingDirectory=/app
ExecStartPre=/bin/rm -f /var/run/appd.pid
ExecStartPre=/app/provisiondevice && /storage/revertupdate
ExecStart=/app/appd start
ExecStop=/app/appd stop
RemainAfterExit=yes
Restart=on-failure
[Install]
WantedBy=multi-user.target
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 :
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
&&
in any execstart*=. These are not shell commands. Only;
(with spaces) can be used as a separator.