1

I have installed

  • postfix
  • dovecot
  • fail2ban
  • postgray

daemons on top of the Linux mail 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l GNU/Linux

Also, I have connected rpi0 to another rpi over usb-otg (to have a serial and ethernet access).

Unfortunately, even though rpi0 has low load, when ssh to it, every typing takes seconds, and in lot cases connection break due to timeout.

  CPU[#*                        3.2%]   Tasks: 54, 17 thr; 1 running
  Mem[|||||||####*********87.6M/433M]   Load average: 0.02 0.04 0.05
  Swp[                         0K/0K]   Uptime: 23 days, 02:36:02

When I connect to rpi0 via serial link - everything works fine, no delays, no timeouts.

So, question is -- which software may cause a delay?

Andrii Zhuk
  • 11
  • 1
  • 2
  • Please connect your devices and put the dmesg or /var/log/syslog output here and your boot cmdline.txt for more informations, because here it is very difficult.Maybe a conlict with the ethernet gadget and the serial interface ?

    https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/serial-gadget https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget https://raspberrypi.stackexchange.com/questions/67907/debugging-usb-otg-serial-on-the-pi-zero-w

    – Ephemeral Jun 01 '19 at 10:05
  • As you can see on Adafruit tutorial, it is an ethernet gadget OR a serial gadget... I don't known if you can use in the the same time two gadgets. good question. – Ephemeral Jun 01 '19 at 10:08
  • But Serial can be acceded by USB from here you see how to : https://hackaday.com/2016/02/25/giving-the-pi-zero-usb-ethernet-and-serial-over-usb/ – Ephemeral Jun 01 '19 at 10:12
  • You need COMPOSITE USB GADGETS. This tutorial covers emulating a keyboard, ethernet adapter, serial device, etc... – Ephemeral Jun 01 '19 at 10:20
  • It is possible to have both ethernet and serial using g_cdc – Andrii Zhuk Jun 01 '19 at 18:46
  • dmesg https://pastebin.com/i4WN0k8U – Andrii Zhuk Jun 01 '19 at 18:48
  • pi@mail:~$ cat /boot/cmdline.txt dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=68a6cc13-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_cdc – Andrii Zhuk Jun 01 '19 at 18:49
  • Ho yes, sorry, I read "A composite CDC gadget". Also, I read [that] (https://raspberrypi.stackexchange.com/questions/77059/what-does-dtoverlay-dwc2-really-do) it's not really encouraging "So you have to expect to very different performances (and bugs) with both drivers. (for dwc2) ".Do you have an error loop or are it is your hot plug tests in your dmesg? .I do not see any device disconnects, I guess it is a bug for the moment .. . – Ephemeral Jun 01 '19 at 20:07

2 Answers2

2

Uncommenting the following line in /etc/ssh/sshd_config did the trick for me, and my ssh session were not slow anymore afterwards:

UseDNS no

Don't forget to restart the ssh service after modifying the config file:

service ssh restart
0

UseDNS didn't help me. What finally did was to go into the pi's ssh_conf and sshd_conf and add

IPQoS 0x00

It is suggested that an alternative might be to add

-o IPQoS=0

to the client's ssh command line, and that it might be worth changing that value from 0 to throughput.

Basically, open-ssh tries to use the Quality of Service figure for the connection to optimize its performance... and the default assumes a reliability that the Pi Zero W, with its weak WiFi hardware, can't reliably achieve. That causes long timeouts and loss of connection. Setting IPQoS to "we know it's a bad connection" makes the protocol less efficient but lets it recover from problems much more quickly.

Hope this helps others. Now I need to look up the packet-level details of what this setting does to the SSH protocol...

keshlam
  • 171
  • 6