12

I have a Mini2440 ARM Board, and I have put a base Debian 6.0 system on it using multistrap.

I have used tmux to run several processes in defferent windows from /etc/rc.local. I connect to the board using its serial port and an inittab entry to run getty on that port. I use picocom as serial communicator.

When root logs in, ~/.bashrc attaches him to the already running tmux server, and processes can be easily monitored. the actual command is exec tmux attach-session -t "main". tmux runs with default config.

Everything works, except one of the processes (a shell script around pppd) does not receive Ctrlc from terminal, while other processes do. Also Ctrl\ works. also kill -INT <pppd_pid> works, but kill -INT <shellscript_pid> does not.

I really need Ctrlc to work. What is wrong with this setup?

Edit: here is the output of stty -a in the shell script, right before pppd:

speed 38400 baud; rows 23; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

since it's just pppd process that has this issue, I think it has something to do with it or its configuration, but when I run pppd outside of tmux, Ctrl-C works. pppd runs with nodetach option, so it stays in terminal foreground.

I also tested it on my dev machine (Debian 6.0 on amd64) with the same results.

zaadeh
  • 1,173
  • 1
  • 12
  • 17
  • 6
    Does `stty -a` show `intr = ^C`? If not, what is the `intr` setting? (Note: `stty -a | grep intr` won't work, since it makes `stty` write to a pipe rather than to your tty.) Does Ctrl-V Ctrl-C echo `^C`? If not, what does it echo? – Keith Thompson Oct 06 '12 at 18:32
  • @KeithThompson Ctrl-V prints a `^` and Ctrl-C adds a `C` to it. – zaadeh Oct 07 '12 at 08:51
  • 7
    This seems too obvious, but is there a `trap` command in the shell script? – Keith Thompson Oct 08 '12 at 23:19
  • @KeithThompson no there isnt. `trap` returns nothing. I guess it has something to do with changes that tmux makes to terminal behaviour and assumptions that pppd makes about terminal. – zaadeh Oct 09 '12 at 08:52
  • can anyone confirm this on their system? perhaps I could report this as a bug to either tmux or ppp developers. – zaadeh Oct 13 '12 at 07:39
  • same issue here under OSX 10.8.2 (update from this week) - tmux 1.7 - in little shell apps like "top" ctrl+C is just completely ignored - nothing happens. – Toby Nov 03 '12 at 22:02
  • typing "stty sane" fixes it but i dont know if thats permanent. – Toby Nov 03 '12 at 22:10
  • 1
    `pppd` has no say in what its underlying shell decides to do with a direct SIGINT. Try writing a tiny shell script that invokes /bin/sleep 600 and send the shell process a SIGINT, you'll see the exact same thing. – Andrew B Jan 06 '13 at 21:43
  • 2
    I don't know tmux well enough but I suspect pppd detects that it doesn't have a terminal despite running under tmux and then ignores INT signals. a trace of pppd while it is started, as well as when tmux is "Detatched" the first time, will probably be telling. – Johan Feb 28 '13 at 10:51
  • Ctrl-z, kill %% – conny May 06 '13 at 11:05

2 Answers2

2

Have you ever thought about givin GNU screen a try? To be very honest i havent much experience with tmux, but screen always did the job nicely.

0

Turned out it was a bug in the particular version of pppd that was being used in the distro. I checked and previous and later versions of pppd do not have this problem. Also the problem is not specific to this arch and platform or tmux. If pppd is being run inside a shell script, It does not handle Ctrl-C, while outside shell, it has no problem.

zaadeh
  • 1,173
  • 1
  • 12
  • 17