LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-30-2014, 11:55 PM   #1
NickZhang1996
LQ Newbie
 
Registered: Dec 2014
Posts: 3

Rep: Reputation: Disabled
pppd killed by mysterious SIGHUP


Hi everyone.
I've been trying to connect to my 3g usb modem for some time, and now i have problems trying to have things started on boot.

basically, the procedure is like this:
start option which i compiled myself with a little modification to support the HUAWEI EC122 i am using
Code:
modprobe option
then,prepare the modem.
Code:
usb_modeswitch -v 12d1 -p 1505 -c /usr/share/usb_modeswitch/12d1:1505
after this several devices are made in /dev ,USB0,USB1and etc
Question1, these devices do not show up immediately after usb_modeswitch returns,but after several seconds. Why does this happen? Is the gap caused by option.ko not detecting the modem? Anyway, this makes it difficult to automate the whole procedure in a shell script,i have to use sleep until device are ready,which does not seem to be the right way.(maybe i need something like select() in c?,or should i load the module after modeswitching?)

next,connect using pppd.
Code:
pppd connect 'nohup chat -v  "" "AT" "OK" "ATZ" "OK" "ATDT#777 CONNECT"' user card password card /dev/ttyUSB0 115200 nodetach noauth nocrtscts modem noipdefault debug usepeerdns defaultroute ipcp-accept-local noccp
it takes a couple seconds to connect, during which i can monitor the procedure on terminal.but after that,it does not return because it is running as a daemon.So it occupies a terminal.

to over come this ,i tried this
Code:
nohup pppd connect 'nohup chat -v  "" "AT" "OK" "ATZ" "OK" "ATDT#777 CONNECT"' user card password card /dev/ttyUSB0 115200 nodetach noauth nocrtscts modem noipdefault debug usepeerdns defaultroute ipcp-accept-local noccp 2>&1 >/root/pppd.log </dev/null
and things work OK,but i have to type ENTER once before re prompt reappears.and here comes Question 2: i can not put it in a script because the following commands depend on network connecting which it has no way of knowing when is ready.Also, even after it is ready, the following commands can not be executed because pppd does not return. How to fix this?

finally, i need to run some other command(streaming video to a specific IP address)

----------------------------
this is the script i call in rc.local.
Code:
#!/bin/sh
modprobe option
echo "------------switching mode..."
usb_modeswitch -v 12d1 -p 1505 -c /usr/share/usb_modeswitch/12d1:1505
#wait for device to be ready, how to fix?
sleep 5
echo "modeswitch succeed!"
#this script sleeps for some time to wait for ppd's completion
/root/videostream.sh&
echo "--------------connecting via 3G..."
nohup pppd connect 'nohup chat -v  "" "AT" "OK" "ATZ" "OK" "ATDT#777 CONNECT"' user card password card /dev/ttyUSB0 115200 nodetach noauth nocrtscts modem noipdefault debug usepeerdns defaultroute ipcp-accept-local noccp 2>&1 >/root/pppd.log </dev/null 
# i think this is never reached
exit 0
this is a poor solution , and i still get problems afterwards.
in pppd.log, i discovered that the connecting procedure is killed by a mysterious SIGHUP. this is strange because 1nohup should block SIGHUP 2 nobody is sending the signal.
Question 3 who send the signal and how to fix it?
(may be SIGHUP is blocked for pppd, but isn't for 'chat -v' it calls?)

That's my problem, which may be confusing as a result of my inferior expression,but please help! any information that may help is also welcomed.
 
Old 01-01-2015, 03:42 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i sympathize.
i have been using mobile broadband a lot and i never managed to set it up so it initializes properly at boot time. i suspect the device (dongle) simply needs time to get ready, and it's not so easy to integrate it without the whole boot process hanging on that.

in the end i gave up and just start the network after login. actually i'm quite happy to have manual control over it.

this command:
Code:
nohup pppd connect 'nohup chat -v  "" "AT" "OK" "ATZ" "OK" "ATDT#777 CONNECT"' user card password card /dev/ttyUSB0 115200 nodetach noauth nocrtscts modem noipdefault debug usepeerdns defaultroute ipcp-accept-local noccp 2>&1 >/root/pppd.log </dev/null
looks a little baroque to me.
- pppd is a daemon and thus should give you back the command line. if it really doesn't, simply append a " &" to the end of the line.
- it also has config files so you don't have to enter the options on the command line.
- have you tried pon/poff instead?
- why the nohup? if something is killing pppd, you should rather troubleshoot that instead of just blocking it.

what system are you running? chances are you don't even have to execute the modeswitch command, it happens automagically.
 
Old 01-04-2015, 06:58 AM   #3
NickZhang1996
LQ Newbie
 
Registered: Dec 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
i sympathize.
i have been using mobile broadband a lot and i never managed to set it up so it initializes properly at boot time. i suspect the device (dongle) simply needs time to get ready, and it's not so easy to integrate it without the whole boot process hanging on that.

in the end i gave up and just start the network after login. actually i'm quite happy to have manual control over it.

this command:
Code:
nohup pppd connect 'nohup chat -v  "" "AT" "OK" "ATZ" "OK" "ATDT#777 CONNECT"' user card password card /dev/ttyUSB0 115200 nodetach noauth nocrtscts modem noipdefault debug usepeerdns defaultroute ipcp-accept-local noccp 2>&1 >/root/pppd.log </dev/null
looks a little baroque to me.
- pppd is a daemon and thus should give you back the command line. if it really doesn't, simply append a " &" to the end of the line.
- it also has config files so you don't have to enter the options on the command line.
- have you tried pon/poff instead?
- why the nohup? if something is killing pppd, you should rather troubleshoot that instead of just blocking it.

what system are you running? chances are you don't even have to execute the modeswitch command, it happens automagically.
Thank you for replying!
1 it does not give back command line. I suspect there is a corresponding daemon script. like the ones in /etc/init.d may be xxx start. These kind of script usually are quite easy and user-friendly.
2 I followed your advice and now i need simply pppd /dev/ttyUSB0 115200 to connect, much trouble saved,TKS!
3 i don't know what it is, will google
4 well, i don't know what killed pppd, it output: SIGHUP received but provide no information about who send the signal. Is there a mechanism to get the sender of signals? could you provide a simple guideline to troubleshooting it? ps, connect script is still SIGHUPed despite nohup. Is nohup passed on to child process of pppd? or scripts it called? I believe not.

I'm using Raspbian on RaspberryPi. Linux kernel version 3.12.34, self compiled. Didn't do much work on modeswitch.I'll try.
Thanks again.
 
Old 01-07-2015, 01:47 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by ondoho View Post
- have you tried pon/poff instead?
it won't solve your problems, but will be more convenient.

unless you use multiple dongles, there should be no need to write out the connection every time.
maybe you can take a look at this:
https://wiki.archlinux.org/index.php...dems_with_pppd
mind, archlinux is not debian, but it should be possible to adapt to your raspbian.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sighup palisetty_suman Linux - Newbie 8 03-28-2009 08:09 PM
Sighup palisetty_suman Linux - Newbie 3 02-22-2009 06:08 AM
SIGHUP / kill -1 SlowCoder Linux - General 6 01-30-2008 06:38 PM
How inetd gets sighup? rajesh_b Programming 1 09-17-2004 04:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration