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
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 executingppd
, so why not just make that the ExecStart? – Jeff Schaller Jan 29 '19 at 19:35journalctl -u ppp_service
? – Jeff Schaller Jan 29 '19 at 19:46systemctl status ppp-connect.service
after boot, that should help us diagnose the problem. And also, as @JeffSchaller pointed out, please look atjournalctl -u ppp-connect.service
(he usedppp_service
which is incorrect, the argument should match the filename, not theDescription=
...) – filbranden Jan 30 '19 at 04:45After=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 theConditionPathExists=
constraint.) – filbranden Jan 30 '19 at 04:50After=network.target
), so it's possible/dev/ttyACM0
is already available at that point. I don't think it's a problem withsudo
, otherwise the problem would exist when you launch it manually withsystemctl
as well. – filbranden Jan 30 '19 at 04:57systemctl start ppp-connect.service
works after the system is up and when the service is using sudo, then it suggests sudo is working some of the time, which suggests "requiretty" is not really the problem... Please postsystemctl status ppp-connect.service
output, that should help most in troubleshooting this. – filbranden Jan 30 '19 at 05:45