This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pppd Start as Service
#1
Hi all, 

I have a pppd Service which i'd like to start on Boot but have no success.

OS Version 2.0.8 or 2.0.10
I can successfully start ppp when i logged in with linaro 
sudo /usr/bin/pon gprs'

but if I start the the pppd connection with a script /etc/init.d/gprs, it fails

#! /bin/sh

### BEGIN INIT INFO
# Provides:             GPRS
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:
# Short-Description:    GPRS Connection Script
### END INIT INFO

set -e

# /etc/init.d/gprs: start and stop the OpenBSD "secure shell™" daemon

case "$1" in
  start)
        echo "Starting GPRS Connection..."
        sudo /usr/bin/pon gprs
        ;;
  stop)
        echo "Stop GPRS Connection..."
        sudo /usr/bin/poff
        ;;
  restart)
        echo "Stoping GPRS Connection..."
        sudo /usr/bin/poff
        echo "Starting GPRS Connection..."
        sudo /usr/bin/pon gprs
        ;;
  *)
        echo "Usage: /etc/init.d/foo {start|stop|restart}"
        exit 1
esac

exit 0

When I do a Reboot and see what happend to my gprs Script I got the following Error!

 systemctl status gprs
● gprs.service - LSB: GPRS Connection Script
   Loaded: loaded (/etc/init.d/gprs; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-06-03 15:19:00 UTC; 41s ago
     Docs: manConfusedystemd-sysv-generator(8)
  Process: 558 ExecStart=/etc/init.d/gprs start (code=exited, status=2)

Jun 03 15:19:00 tinkerboard gprs[558]: Starting GPRS Connection...
Jun 03 15:19:00 tinkerboard sudo[574]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=usr/bin/pon gprs
Jun 03 15:19:00 tinkerboard sudo[574]: pam_unix(sudoConfusedession): session opened for user root by (uid=0)
Jun 03 15:19:00 tinkerboard gprs[558]: /usr/sbin/pppd: In file /etc/ppp/peers/gprs: unrecognized option '/dev/ttyUSB4'
Jun 03 15:19:00 tinkerboard sudo[574]: pam_unix(sudoConfusedession): session closed for user root
Jun 03 15:19:00 tinkerboard systemd[1]: Failed to start LSB: GPRS Connection Script.
Jun 03 15:19:00 tinkerboard systemd[1]: gprs.service: Failed with result 'exit-code'.

I can normaly start again as follows 

root@tinkerboard:~# sudo linaro
sudo: linaro: command not found
root@tinkerboard:~# su - linaro
linaro@tinkerboard:~$ sudo /usr/bin/pon gprs
pppd options in effect:
debug           # (from /etc/ppp/peers/gprs)
nodetach                # (from /etc/ppp/peers/gprs)
dump            # (from /etc/ppp/peers/gprs)
noauth          # (from /etc/ppp/peers/gprs)
remotename 3gppp                # (from /etc/ppp/peers/gprs)
/dev/ttyUSB4            # (from /etc/ppp/peers/gprs)
115200          # (from /etc/ppp/peers/gprs)
lock            # (from /etc/ppp/peers/gprs)
connect chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet         # (from /etc/ppp/peers/gprs)
disconnect chat -s -v -f /etc/chatscripts/quectel-chat-disconnect               # (from /etc/ppp/peers/gprs)
nocrtscts               # (from /etc/ppp/peers/gprs)
modem           # (from /etc/ppp/peers/gprs)
asyncmap 0              # (from /etc/ppp/options)
lcp-echo-failure 4              # (from /etc/ppp/options)
lcp-echo-interval 30            # (from /etc/ppp/options)
hide-password           # (from /etc/ppp/peers/gprs)
novj            # (from /etc/ppp/peers/gprs)
novjccomp               # (from /etc/ppp/peers/gprs)
ipcp-accept-local               # (from /etc/ppp/peers/gprs)
ipcp-accept-remote              # (from /etc/ppp/peers/gprs)
ipparam 3gppp           # (from /etc/ppp/peers/gprs)
noipdefault             # (from /etc/ppp/peers/gprs)
ipcp-max-failure 30             # (from /etc/ppp/peers/gprs)
defaultroute            # (from /etc/ppp/peers/gprs)
usepeerdns              # (from /etc/ppp/peers/gprs)
noccp           # (from /etc/ppp/peers/gprs)
noipx           # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
AT^M^M
OK
 -- got it

send (ATE0^M)
expect (OK)
^M
ATE0^M^M
OK
 -- got it

send (ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
EC25^M
Revision: EC25EFAR06A01M4G^M
^M
SubEdition: V01^M
^M
+CSQ: 15,99^M
^M
+CPIN: SIM PIN^M
^M
+COPS: 0^M
^M
+CGREG: 0,2^M
^M
OK
 -- got it

send (AT+CPIN=9241^M)
expect (OK)
^M
^M
OK
 -- got it

send (AT+CGDCONT=1,"IP","internet",,0,0^M)
expect (OK)
^M
^M
OK
 -- got it

send (ATD*99#^M)
expect (CONNECT)
^M
^M
+CPIN: READY^M
^M
+QUSIM: 1^M
^M
CONNECT
 -- got it

Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet finished (pid 2636), status = 0x0
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB4
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x3502d6a3> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0xd1112794> <pcomp> <accomp>]
No auth is possible
sent [LCP ConfRej id=0x0 <auth chap MD5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x3502d6a3> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xd1112794> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xd1112794> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0x3502d6a3]
kernel does not support PPP filtering
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [LCP DiscReq id=0x2 magic=0xd1112794]
rcvd [LCP EchoRep id=0x0 magic=0xd1112794 35 02 d6 a3]
rcvd [IPCP ConfReq id=0x0]
sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 100.81.33.167> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>]
sent [IPCP ConfReq id=0x2 <addr 100.81.33.167> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>]
rcvd [IPCP ConfReq id=0x1]
sent [IPCP ConfAck id=0x1]
rcvd [IPCP ConfAck id=0x2 <addr 100.81.33.167> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>]
Could not determine remote IP address: defaulting to 10.64.64.64
not replacing default route to br0 [192.168.222.100]
local  IP address 100.81.33.167
remote IP address 10.64.64.64
primary   DNS address 8.8.8.8
secondary DNS address 8.8.4.4
Script /etc/ppp/ip-up started (pid 2837)
Script /etc/ppp/ip-up finished (pid 2837), status = 0x0

Any hint to my Problem
Reply
#2
It is supposed that a user is necessary to start such service. If you're able to run it by the admin then it will take to see whether it has permission to write all the stuffs necessary to the service.

So it may be useful to configure an "ppp" user with its own home and login then put an order (in the /etc/rc? or /etc/rc.local) to execute the service after having successful collect all the necessary stuffs.

One more chance it may be to instruct NetworkManager to handle the operation. As long as it will complete such task I don't doubt it will do it at boot time.
Light blue words might be a link. Have you try to click on them? Big Grin
Reply
#3
Hill all

I got the Solution and as usual it's very simple.

The Devices /dev/ttyUSBx takes quite long to mount. My PPP Service called them to early 

I just put a simple sleep command bevore i start the pppd command

Here the new init script

#! /bin/sh

### BEGIN INIT INFO
# Provides:             GPRS
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:
# Short-Description:    GPRS Connection Script
### END INIT INFO

set -e

# /etc/init.d/gprs: start and stop the OpenBSD "secure shell™" daemon

case "$1" in
  start)
        echo "Starting GPRS Connection..."
        /bin/sleep 10
        sudo /usr/bin/pon gprs
        ;;
  stop)
        echo "Stop GPRS Connection..."
        sudo /usr/bin/poff
        ;;
  restart)
        echo "Stoping GPRS Connection..."
        sudo /usr/bin/poff
        echo "Starting GPRS Connection..."
        sudo /usr/bin/pon gprs
        ;;
  *)
        echo "Usage: /etc/init.d/foo {start|stop|restart}"
        exit 1
esac

exit 0

Have a nice day...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)