2

I am connecting from my BeagleBone running Debian to a cellular modem.

In order to connect, I enter command pppd file /etc/ppp/peers/zdial &

Now, in order to execute this command on boot-up, I created a script start-ppp.sh which runs this command as below.

I then create and enable a service ppp-connect.service as below. sudo systemctl enable ppp-connect.

I would expect this service to run on boot-up and automatically connect to my modem but it doesn't work.

However, If I manually start the service with sudo systemctl start ppp-connect , then my service starts and I can connect to the modem.

Why is it that it does not connect on boot-up automatically? Can anyone see something obvious that I am doing wrong. Perhaps it's something to do with not entering the password for sudo during boot-up. I'm not sure.

start-ppp.sh

#!/bin/sh -e

sudo -H -u debian pppd file /etc/ppp/ppers/zdial &

ppp-connect.service

[Unit]
Description=ppp_service
ConditionPathExists=/dev/ttyACM0

[Service]
Type=forking
ExecStart=/bin/sh /home/debian/start-ppp.sh
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target
  • 1
    Certainly there's no need to background the call, and presumably systemd is starting the unit as root, so those are easy changes -- User=debian in the [Service] section. Presumably the script is executable by that user, so there's also no need to use /bin/sh to call it. Beyond that, all the script is doing is executing ppd, so why not just make that the ExecStart? – Jeff Schaller Jan 29 at 19:35
  • 1
    The interesting part will be why systemd didn't or couldn't do what you wanted; is there anything in journalctl -u ppp_service? – Jeff Schaller Jan 29 at 19:46
  • Please post the output of systemctl status ppp-connect.service after boot, that should help us diagnose the problem. And also, as @JeffSchaller pointed out, please look at journalctl -u ppp-connect.service (he used ppp_service which is incorrect, the argument should match the filename, not the Description=...) – filbranden Jan 30 at 4:45
  • Try adding After=dev-ttyACM0.device to the [Unit] stanza, since it's possible your service is being run before that device is up and that's causing it to fail (due to the ConditionPathExists= constraint.) – filbranden Jan 30 at 4:50
  • @filbranden Thanks for your suggestions. I will try this when I get back. Meanwhile, if I start my script from rc.local, it works ok. – Engineer999 Jan 30 at 4:51

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.