I have encountered a strange situation on one of my SSH ARM machines I use on a daily basis. Every time I connect to the server and press Ctrl+P to invoke previous-history BASH function SSH connection freezes. I can only exit using tilde SSH sequences. I tried to investigate possible reasons for this situation:

  1. it's not BASH fault because pressing up arrow which also invokes previous-history works correctly

  2. Ctrl+P is not bound to anything unusual according to bind -p:

    $ bind -p | grep previous-history
    "\C-p": previous-history
    "\eOA": previous-history
    "\e[A": previous-history
  3. binding Ctrl+P to a different function like this doesn't help - Ctrl+P still freezes SSH:

    $ bind '"\C-p":"\necho hi\n"'`
  4. raw charactor for Ctrl+P is printed correctly by BASH, Ctrl+V Ctrl+P prints ^P

  5. $TERM is set to screen, /etc/termcap that BASH readline uses by default is correct - for example, Ctrl+L clears screen. After setting $TERM to xterm or linux Ctrl+P still freezes SSH

  6. I tried to start BASH with --noprofile and --nobashrc but Ctrl+P still doesn't work

  7. I connected to the server with -vvv but I didn't notice anything unusal in log messages

  8. when SSH connection freezes I can connect to the same server on another subshell without problems. After doing that, session that was frozen on the previous subshell comes back to life again - I can see what I type but I can't see everything I typed when session was frozen

  9. I connected to this server from several machines to exclude local problems but Ctrl+P never works

Version of bash:

GNU bash, version 4.1.5(1)-release (armv7l-unknown-linux-gnueabi)

Version of SSH:

OpenSSH_5.3p1, OpenSSL 1.0.1c 10 May 2012

Linux kernel:


I don't know what can be the reason for such behavior. I got used to Ctrl+P keybining. Does anybody have a clue?

  • Is it possible to have multiple bindings for a shortcut? That is, does bind -p | grep '\\C.*-p' return more than one relevant entry?
    – l0b0
    Sep 24, 2014 at 11:52
  • There is only one keybinding for C-p: "\C-p": previous-history. Command you suggested also prints "\C-x\C-x": exchange-point-and-mark Sep 24, 2014 at 11:54
  • If running another program, lets say cat, does CTRL+P still freeze the session? If you press CTRL+P while doing read -e, or plain read, does it still freeze? Also "with --noprofile and --nobashrc ... Ctrl+P still doesn't work", does that mean it still freezes, or that it doesn't freeze, but it doesn't go back in history?
    – phemmer
    Sep 24, 2014 at 13:03
  • it freezes inside cat and read also. I mean that it freezes. Sep 24, 2014 at 13:17

1 Answer 1


When debugging in ssh using

ssh -vvv remotehost

to enable maximum debugging output: for each keystroke sent to the remote end, you should see "debug3: Wrote 48 bytes for a total of NNNN". If you don't see it for Ctrl-P, that's an indication that the problem is on the local (client) side rather than the remote.

Do you privileges to control the daemon on the remote side? sshd's -D and -d options (again, -ddd for maximum debug output) may help you isolate the problem to that half of the connection.

On the local side, are there any unusual terminal key bindings? stty -a or stty -a | fgrep '^D' should show you if Ctrl-P had a binding there. (What's bound to "stop"?)

After the client side freezes:

  1. If you issue a command such as touch /tmp/foo, does it have an effect on the server? (i.e., is it just display that frozen, or execution).
  2. Are you able to issue ssh client escapes? Can you type <enter>~? and get a list of "Supported escape sequences"? Can you type <enter>~. and terminate the connection? If so, any freezing is definitely on the server.

You may get a better idea of what the server side is doing with strace:

strace -fo /tmp/strace.out sshd -ddd -D
  • I ran sshd -ddd on the server and connected to it on another subshell. After typing something debug log showed lines similar to debug3: Wrote 32 bytes for a total of 3103. When I pressed C-p both session when sshd was running and the one in which I pressed C-p froze. After that debug only showed debug1: server_input_global_request: rtype [email protected] want_reply 1 interlaced with debug3: Wrote 32 bytes for a total of 3167 with different numbers after total of. I checked with stty -a that ^S is bound to stop. Sep 24, 2014 at 18:38
  • What kind of equipment are you connecting to (what kind of ARM server?), and with what kind of equipment are you doing the connecting? It's interesting that both the client and the server sessions froze on Ctrl-p. I'm adding a couple more step to debug.
    – R Perrin
    Sep 25, 2014 at 14:22
  • When SSH freezes touch /tmp/foo does not have any effect. Yes, I can use SSH escape sequences - I can leave session with . and list available commands with ?. I will do strace and post back the results. Sep 26, 2014 at 11:31
  • What kind of equipment - I connect to normal ARM development board, I don't know hardware details. Sep 26, 2014 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .