Good morning,

We are trying to start a custom service on a Raspberry PIZero Wireless. The procedure we are using works on a PI3 under Ubuntu 14.04. The PiZero runs 2017-04-10-raspbian-jessie. I'll use the name CUSTOM_SERVICE below.

I tried different things without success. Querying the status of the service reports:

sudo systemctl status CUSTOM_SERVICE.service
● CUSTOM_SERVICE.service - Custom service
   Loaded: loaded (/etc/systemd/system/CUSTOM_SERVICE.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2017-04-26 14:44:40 UTC; 32s ago
  Process: 1516 ExecStart=/usr/local/etc/startCustomService (code=exited, status=203/EXEC)
 Main PID: 1516 (code=exited, status=203/EXEC)

Apr 26 14:44:40 raspberrypi systemd[1]: CUSTOM_SERVICE.service: main process exited, code=exited, status=203/EXEC
Apr 26 14:44:40 raspberrypi systemd[1]: Unit CUSTOM_SERVICE.service entered failed state.

Using the command:

sudo ls -l /etc/systemd/system/multi-user.target.wants/*.service

output:

...
lrwxrwxrwx 1 root root 40 Apr 10 09:24 /etc/systemd/system/multi-user.target.wants/avahi-daemon.service -> /lib/systemd/system/avahi-daemon.service
lrwxrwxrwx 1 root root 38 Apr 26 13:53 /etc/systemd/system/multi-user.target.wants/CUSTOM_SERVICE.service -> /etc/systemd/system/CUSTOM_SERVICE.service
...

The service unit file is defined as:

more /etc/systemd/system/multi-user.target.wants/CUSTOM_SERVICE.service
[Unit]
Description=Custom service
After=network-online.target

[Service]
Type=simple
RestartSec=60
Restart=always
ExecStart=/usr/local/etc/startCustomService

[Install]
WantedBy=multi-user.target

where /usr/local/etc/startCustomService is defined as

more /usr/local/etc/startCustomService
#!/bin/sh
/usr/local/sbin/customService

As I said, the service is launched and running correctly under Ubuntu 14.04. Also note that the file /usr/local/etc/startCustomService can be launched manually on PIZero.

Any suggestions?

Regards, Daniel

closed as off-topic by Jeff Schaller, Rui F Ribeiro, G-Man, DarkHeart, countermode Apr 27 '17 at 7:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Rui F Ribeiro, G-Man, DarkHeart, countermode
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you read Difference between systemd and terminal starting program and reviewed all the possible differences for a service to not run under systemd vs the shell? – Mark Stosberg Apr 26 '17 at 16:38
  • 2
    Your service exited with code 203. You should refer to the documentation for your service to determine the meaning of this exit code. – Mark Stosberg Apr 26 '17 at 16:39
  • Thanks for the feedback. Looking at /var/log/syslog, I saw the error Failed at step EXEC spawning /usr/local/etc/startCustomService: No such file or directory. The actual error was related to DOS type line termination in the different files, most importantly the startCustomService script. - Daniel – Daniel Labonté Apr 26 '17 at 19:39

Try add working directory.

WorkingDirectory=/usr/local/etc/

Not the answer you're looking for? Browse other questions tagged or ask your own question.