Score:3

enabled systemd service not starting

vn flag
Bok

I have two systemd services, one is a flask app meant to proxy calls to a C backend. While the flask app works the C program does not start at boot.

My service file looks like this:

[Unit]
Description=my backend
After=multi-user.target

[Service]
User=root
ExecStart=/home/root/camtool
Type=dbus
BusName=com.camera
Restart=always
RestartSec=10

and i have enabled the service like this: systemctl enable camtool.service

The service starts if i do a systemctl start camtool.service but if i reboot the device, the service is not started.

output of systemctl status camtool:

● camtool.service - my backend
     Loaded: loaded (/etc/systemd/system/camtool.service; enabled; vendor preset: disabled)
     Active: inactive (dead)

If i check journalctl, there are no entries.

journalctl -u camtool
-- Logs begin at Wed 2021-07-14 14:12:26 UTC, end at Wed 2021-07-14 14:16:26 UTC. --
-- No entries --

I am unsure how to debug this further, as there does not seem to be any error messages. How can i proceed to figure out why the program didn't start? is there a way i can verify if it was even attempted?

The C program use DBUS to expose functions for the flask app, and stream data via sockets.

Jeff Schaller avatar
ru flag
I assume you also have an `[Install]` section; can you include that in your post?
Bok avatar
vn flag
Bok
Hey jeff. I do not at this point, i used to have ``` [Install] wantedby=multi-user.target ``` and have ```after=dbus```
Score:1
vn flag
Bok

It seems i fixed the problem by re enabling the service. I had made many changes to try and fix the file, but when i disabled and re enabled i realised the symlink was in the wrong place.

By disabling and enabling this was fixed. I would recommend to disable and re enable when ever changes are made to the areas concerning targets.

Before i did that i added the wantedby=multi-user.target.

The commands looked like this:

root@system:~# systemctl disable camtool
Removed /etc/systemd/system/multi-user-target.service.wants/camtool.service.
root@system:~# systemctl enable camtool
Created symlink /etc/systemd/system/multi-user.target.wants/camtool.service → /etc/systemd/system/camtool.service.

Now it boots with the system.

Aviad P. avatar
ph flag
In my case, I neglected to enable it in the first place.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.