Skip to content

Connectivity problem

Stacy edited this page Dec 13, 2022 · 10 revisions

How to find your car on the competition site

  • on SD card in the boot folder create a wpa_supplicant.conf file, add there
country=<2 letter country code>
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="<your network name>"
    psk="<your password>"
}

  • on your PC go to terminal and run donkey findcar command, if you have windows or wsl install nmap and run nmap -sn <YOUR_IP>/24 command, it will list all hosts in the network that are up. IP above "(Raspberry Pi Foundation)" is your car's IP.

  • Useful command to list all ip-addresses on the network. arp -a in PowerShell or arp-scan -I wifi0 -l in terminal.

If there is error ssh: connect to host <CAR_IP> port 22: Connection refused

It means that somehow OpenBSD Secure Shell server stopped working, e.g. after changes in /etc/ssh/sshd_config file.

Unfortunately placing a dummy ssh file in the boot partition on the SD card doesn't work here.

  • Plug in an HDMI monitor and USB keyboard into the Pi, login (default pi:raspberry)

  • Run sudo raspi-config command

  • Select Interfacing Options

  • Navigate to and select SSH. Choose Yes. Select Ok. Choose Finish

  • Run sudo systemctl enable ssh

  • Run sudo systemctl start ssh

    • If it fails run systemctl status ssh.service to see what is the error.

    • In my case OpenBSD Secure Shell server failed to run. Before error message has appeared I edited /etc/ssh/sshd_config file. It was a huge mistake. So I deleted all my faulty inputs and again ran sudo systemctl start ssh. It started and in systemctl status ssh.service printed that server is active

client_loop: send disconnect: Broken pipe

~/.ssh/config, the client config, for the computer you're connecting from. /etc/ssh/sshd_config, on the remote server you're connecting to.

  1. TCPKeepAlive yes in /etc/ssh/sshd_config

  2. IPQoS cs0 cs0 in /etc/ssh/sshd_config???

  3. ClientAliveInterval 60 in /etc/ssh/sshd_config or ServerAliveInterval 60 in ~/.ssh/config.

  4. add in /etc/sysctl.conf

net.inet.tcp.keepidle = 10000
net.inet.tcp.keepintvl = 10000
net.inet.tcp.always_keepalive = 1 (must be 1 always)
  1. Try mosh instead of ssh. Requires a large range of UDP ports to be opened on the firewall.

  2. Try tmux

  3. Motivation: TCPKeepAlive no means "do not send keepalive messages to the server". When the opposite, TCPKeepAlive yes, is set, then the client sends keepalive messages to the server and requires a response in order to maintain its end of the connection. This will detect if the server goes down, reboots, etc. The trouble with this is that if the connection between the client and server is broken for a brief period of time (due to flaky a network connection), this will cause the keepalive messages to fail, and the client will end the connection with "broken pipe". Setting TCPKeepAlive no tells the client to just assume the connection is still good until proven otherwise by a user request, meaning that temporary connection breakages while your ssh term is sitting idle in the background won't kill the connection. I solved the same problem by editing the file ~/.ssh/config, not to forget chmod 600 ~/.ssh/config:

Host *
ServerAliveInterval 600
TCPKeepAlive no

Restart with sudo systemctl reload sshd.service

Additional resources: one, two