Ubuntu – xubuntu xterm strange lag/echo issue with ssh

command linescpsshxtermxubuntu

I have a xubuntu box and using its terminal everything is fine locally; but when I ssh to any server, the remote echo seems to be holding the last line until a key is pressed or the window is resized. In long output commands, only the first few lines are output (i.e. find see test below). The issue is not present locally but will affect all utilities that rely on ssh, i.e. git, scp. Randomly ssh sessions are closed even while processes are running and displaying output (which is not updated unless keys are pressed repeatedly).

the terminal hangs and doesn't show next prompt until a key is pressed

In the screencast at http://www.tmg.it/files/funnyterm.ogv , all commands are ended with a return; I wait 5 seconds between commands. As you can see, the line with my prompt is shown only once I start typing again.

Tests I performed:

  • Booting from a live ubuntu 13.04 on a usb stick shows the same problem!
  • Booting from a live ubuntu 12.04 on a usb stick works just fine
  • Booting from a live xubuntu 13.04 on a usb stick shows the same problem!
  • Connecting with either WiFi or LAN shows the same issue
  • In a window, the output is updated if I resize it
  • pressing right arrow, or any other non-character keys will update as well
  • same issue appears in a full screen console opened with CTRL-ALT-F1
  • using another terminal i.e. aterm did not solve the issue
  • deleting the .bashrc and .bash_profile locally and remotely didn't solve the issue.
  • the issue appears with several remote CentOS both 32 and 64 bits v5.8 5.9 and 6; remote Ubuntu 10.04.4 LTS.

scp tests:
– scp remotefile localfile works if file < MTU.
– tried fiddling with MTU, setting to several values between 1000 and 1600 – no success.

find tests:
in a ssh connection, find on a folder with many files will stop after a few lines of output. Pressing the Return key 3-4 times shows the next few lines.
I started monitoring Tx excessive retries and Invalid misc from iwconfig, and see that "Invalid misc" and "Excessive retries" go up nicely with every few returns:

System is up to date xubuntu 13.04 amd64 with lamp stack running on Samsung RC530-S05IT (i7/6Gb ram/60Gb HDD partition + an extra SSD drive). I first noticed the issue when there was only lamp + eclipse installed and can reproduce it booting from a live distro (same version).

Other systems in the network do not suffer from this issue (update! the mac started to show this same issue too!). On this pc, CentOS runs fine in a VM and so does Windows 7 both with Putty and cygwin, plus any non-13.04 (x)ubuntu distributions from usb/iso. 13.04 (x)ubuntu fails even booting from a live usb stick.

Output of commands, iwconfig

$ echo "#find in ssh connection";date +"%H:%M:%S";iwconfig 2>nul | grep misc

#find in ssh connection
14:22:56
          Tx excessive retries:695  Invalid misc:273   Missed beacon:0

#find in ssh connection.. after a few returns were pressed in the terminal:
14:23:07
          Tx excessive retries:697  Invalid misc:281   Missed beacon:0

$ iwconfig

eth0      no wireless extensions.

lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"zzz-guests"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: A4:B1:E9:97:72:ED   
          Bit Rate=65 Mb/s   Tx-Power=15 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=62/70  Signal level=-48 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:582  Invalid misc:209   Missed beacon:0

The following block is the output of iwconfig on the ubuntu 12.04 where ssh works fine, after a huge find command completed:

wlan0     IEEE 802.11bgn  ESSID:"zzz-guests"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: A4:B1:E9:97:72:ED   
          Bit Rate=65 Mb/s   Tx-Power=15 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=61/70  Signal level=-49 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:4  Invalid misc:65   Missed beacon:0

(on this 12.04 ubuntu, lspci shows the exact same network drivers and versions being loaded as xubuntu 13.04)

Some misc info from my system

  • cat /etc/lsb-release; uname -a
  • lspci -nnk | grep -iA2 net
  • rfkill list all
  • lsmod
  • nm-tool
  • lsmod | grep rt2
  • sudo cat /var/log/syslog | grep -e rt2 -e firmware -e wpa -e wlan -e etork | tail -n75

$ cat /etc/lsb-release; uname -a

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.04
DISTRIB_CODENAME=raring
DISTRIB_DESCRIPTION="Ubuntu 13.04"
Linux osiris 3.8.0-30-generic #44-Ubuntu SMP Thu Aug 22 20:52:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

$ lspci -nnk | grep -iA2 net

02:00.0 Network controller [0280]: Intel Corporation Centrino Wireless-N 130 [8086:0896] (rev 34)
    Subsystem: Intel Corporation Centrino Wireless-N 130 BGN [8086:5005]
    Kernel driver in use: iwlwifi
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller [10ec:8168] (rev 06)
    Subsystem: Samsung Electronics Co Ltd Device [144d:c0c1]
    Kernel driver in use: r8169

ric@osiris:~$ rfkill list all

0: samsung-wlan: Wireless LAN
    Soft blocked: no
    Hard blocked: no
...
3: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no

$ lsmod

Module                  Size  Used by
pci_stub               12622  1 
vboxpci                23194  0 
vboxnetadp             25670  0 
vboxnetflt             23479  0 
vboxdrv               320372  3 vboxnetadp,vboxnetflt,vboxpci
parport_pc             28152  0 
ppdev                  17073  0 
rfcomm                 42641  16 
bnep                   18036  2 
binfmt_misc            17500  1 
snd_hda_codec_hdmi     36906  1 
snd_hda_codec_realtek    78399  1 
joydev                 17377  0 
arc4                   12615  2 
snd_hda_intel          39619  3 
snd_hda_codec         136498  3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
iwldvm                241872  0 
mac80211              606457  1 iwldvm
snd_hwdep              13602  1 snd_hda_codec
snd_pcm                97451  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
snd_page_alloc         18710  2 snd_pcm,snd_hda_intel
coretemp               13355  0 
snd_seq_midi           13324  0 
snd_seq_midi_event     14899  1 snd_seq_midi
kvm_intel             132891  0 
kvm                   443165  1 kvm_intel
snd_rawmidi            30180  1 snd_seq_midi
i915                  600349  3 
uvcvideo               80847  0 
snd_seq                61554  2 snd_seq_midi_event,snd_seq_midi
videobuf2_vmalloc      13056  1 uvcvideo
nouveau               943184  0 
ghash_clmulni_intel    13259  0 
aesni_intel            55399  1 
snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi
videobuf2_memops       13202  1 videobuf2_vmalloc
ttm                    83187  1 nouveau
aes_x86_64             17255  1 aesni_intel
drm_kms_helper         49394  2 i915,nouveau
xts                    12885  1 aesni_intel
lrw                    13257  1 aesni_intel
snd_timer              29425  2 snd_pcm,snd_seq
gf128mul               14951  2 lrw,xts
videobuf2_core         40513  1 uvcvideo
ablk_helper            13597  1 aesni_intel
videodev              129260  2 uvcvideo,videobuf2_core
iwlwifi               173516  1 iwldvm
btusb                  22474  0 
cryptd                 20373  3 ghash_clmulni_intel,aesni_intel,ablk_helper
lp                     17759  0 
drm                   286028  6 ttm,i915,drm_kms_helper,nouveau
microcode              22881  0 
cfg80211              510937  3 iwlwifi,mac80211,iwldvm
psmouse                95905  0 
bluetooth             228667  22 bnep,btusb,rfcomm
snd                    68876  16 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec,snd_hda_intel,snd_seq_device
samsung_laptop         14532  0 
serio_raw              13215  0 
mei                    41158  0 
parport                46345  3 lp,ppdev,parport_pc
video                  19390  3 i915,samsung_laptop,nouveau
mxm_wmi                13021  1 nouveau
wmi                    19070  2 mxm_wmi,nouveau
i2c_algo_bit           13413  2 i915,nouveau
mac_hid                13205  0 
lpc_ich                17061  0 
soundcore              12680  1 snd
hid_generic            12540  0 
usbhid                 47074  0 
hid                   101002  2 hid_generic,usbhid
r8169                  67466  0 
ahci                   25731  5 
libahci                31364  1 ahci

$ nm-tool

NetworkManager Tool

State: connected (global)

- Device: wlan0  [zzz-guests] --------------------------------------------------
  Type:              802.11 WiFi
  Driver:            iwlwifi
  State:             connected
  Default:           yes
  HW Address:        DC:A9:71:96:81:92

  Capabilities:
    Speed:           65 Mb/s

  Wireless Properties
    WEP Encryption:  yes
    WPA Encryption:  yes
    WPA2 Encryption: yes

  Wireless Access Points (* = current AP)
    zzz:             Infra, 00:1B:2F:94:ED:BE, Freq 2427 MHz, Rate 54 Mb/s, Strength 99 WPA WPA2
    *zzz-guests:     Infra, A4:B1:E9:97:72:ED, Freq 2462 MHz, Rate 54 Mb/s, Strength 72 WPA WPA2

  IPv4 Settings:
    Address:         192.168.1.64
    Prefix:          24 (255.255.255.0)sudo cat /var/log/syslog | grep -e rt2 -e firmware -e wpa -e wlan -e etork | tail -n75

    Gateway:         192.168.1.254

    DNS:             192.168.1.254

$ sudo cat /var/log/syslog | grep -e rt2 -e firmware -e wpa -e wlan -e etork | tail -n75

Sep  7 14:04:26 osiris NetworkManager[1281]: <info> (wlan0): device state change: secondaries -> activated (reason 'none') [90 100 0]
Sep  7 14:04:26 osiris NetworkManager[1281]: <info> Policy set 'zzz-guests' (wlan0) as default for IPv4 routing and DNS.
Sep  7 14:04:28 osiris NetworkManager[1281]: <info> Activation (wlan0) successful, device activated.
Sep  7 14:04:44 osiris NetworkManager[1281]: <info> (wlan0): IP6 addrconf timed out or failed.
Sep  7 14:04:44 osiris NetworkManager[1281]: <info> Activation (wlan0) Stage 4 of 5 (IPv6 Configure Timeout) scheduled...
Sep  7 14:04:44 osiris NetworkManager[1281]: <info> Activation (wlan0) Stage 4 of 5 (IPv6 Configure Timeout) started...
Sep  7 14:04:44 osiris NetworkManager[1281]: <info> Activation (wlan0) Stage 4 of 5 (IPv6 Configure Timeout) complete.
Sep  7 14:04:58 osiris wpa_supplicant[1376]: wlan0: WPA: Group rekeying completed with a4:b1:e9:97:72:ed [GTK=TKIP]
Sep  7 14:11:37 osiris wpa_supplicant[1376]: dbus: wpa_dbus_get_object_properties: failed to get object properties: (org.freedesktop.DBus.Error.Failed) failed to parse WPA IE
Sep  7 14:11:37 osiris wpa_supplicant[1376]: dbus: Failed to construct signal
Sep  7 14:14:58 osiris wpa_supplicant[1376]: wlan0: WPA: Group rekeying completed with a4:b1:e9:97:72:ed [GTK=TKIP]
Sep  7 14:17:37 osiris wpa_supplicant[1376]: dbus: wpa_dbus_get_object_properties: failed to get object properties: (org.freedesktop.DBus.Error.Failed) failed to parse WPA IE
Sep  7 14:17:37 osiris wpa_supplicant[1376]: dbus: Failed to construct signal
Sep  7 14:24:57 osiris wpa_supplicant[1376]: wlan0: WPA: Group rekeying completed with a4:b1:e9:97:72:ed [GTK=TKIP]

Output of commands, stty

Here is the output of stty -a, both local and after ssh to a remote server, both in xubuntu 13.04 (ssh has issues) and from ubuntu 12.04 live (which works):

local console (xubuntu 13.04):

$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; 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

ssh to a remote server (centos 5.9) from xubuntu 13.04:

$ stty -a
speed 38400 baud; rows 24; 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 -cdtrdsr
-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

ssh to a different server (ubuntu 10) from xubuntu 13.04:

$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
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

local console on ubuntu 12.04.2 LTS:

$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; 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

remote server (centos 5.9) from ubuntu 12.04.2

$ stty -a

speed 38400 baud; rows 24; 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 -cdtrdsr
-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

cygwin ssh on windows 7 -> centos 5.9

$ stty -a
speed 38400 baud; rows 24; columns 100; 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 -cdtrdsr
-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

mac osx 10.6.8

lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
    -ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
    min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
    stop = ^S; susp = ^Z; time = 0; werase = ^W;

12.04 ssh to centos 5.9

stty -g
500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

13.04 ssh to centos 5.9

stty -g
500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

(stty -g output is identical)

(this question was originally asked on https://superuser.com/questions/640348/xubuntu-xterm-lag-echo-issue-with-ssh )

Best Answer

Some more ideas for diagnostics:

  1. analyze output of stty -a (Done, ruled out for certain, see discussion below)

  2. try another network device to access the net. Do you have the same problems via

    • wireless
    • ethernet
    • usb-to-ethernet, or usb-to-wlan adapter?
  3. boot another (non ubuntu) system from usb

The scp test you mentioned would make me try (2) first.

Related Question