Ssh

使用 scp / rsync 後 Manjaro / Arch Linux 中的 ssh 會話無響應

  • June 18, 2021

我在筆記型電腦上重新安裝了 Manjaro 20.2。現在我嘗試通過 scp / rsync 在這台筆記型電腦和本地網路中的另一台筆記型電腦(kubuntu 18.04)和外部伺服器(我相信是 Ubuntu 20.04)之間傳輸文件。

在這兩種情況下,我的 Manjaro 筆記型電腦上的 rsync 初始呼叫將傳輸一些文件,然後暫停並最終中止:

laptop% rsync -rtvvvuL --progress user@webserver:/directory/ /home/user/directory/
[snip]
Timeout, server webserver not responding.
rsync: connection unexpectedly closed (112760 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(228) [receiver=v3.2.3]
[receiver] _exit_cleanup(code=12, file=io.c, line=228): about to call exit(12)
rsync: connection unexpectedly closed (100412 bytes received so far) [generator]
rsync error: unexplained error (code 255) at io.c(228) [generator=v3.2.3]
[generator] _exit_cleanup(code=12, file=io.c, line=228): about to call exit(255)
rsync: [generator] write error: Broken pipe (32)

如果在我的 kubuntu 筆記型電腦上呼叫 rsync 以與 Manjaro 同步文件,也會發生這種情況,因此 Manjaro 機器是伺服器還是客戶端都沒有關係。

如果在那之後,我再次嘗試通過 SSH 連接到網路伺服器,則我已成功通過身份驗證,但我沒有收到命令提示符:

laptop% ssh -vvv user@webserver                                                                           
OpenSSH_8.4p1, OpenSSL 1.1.1i  8 Dec 2020
debug1: Reading configuration data /home/user/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/user/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/user/.ssh/known_hosts2'
debug2: resolving "webserver" port 22
debug2: ssh_connect_direct
debug1: Connecting to webserver [123.456.789.111] port 22.
debug1: Connection established.
[snip]
debug1: Local version string SSH-2.0-OpenSSH_8.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
[snip]
debug1: Authentication succeeded (publickey).
Authenticated to webserver ([123.456.789.111]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 4
debug1: Remote: /home/user/.ssh/authorized_keys:4: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 4
debug1: Remote: /home/user/.ssh/authorized_keys:4: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x48
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
Timeout, server p000327627.pwhost.de not responding.

此外,如果我再次呼叫 rsync,它將什麼也不做:

laptop% rsync -rtvvvuL --progress user@webserver:/directory/ /home/user/directory/
opening connection using: ssh -l user webserver rsync --server --sender -vvvuLtre.iLsfxCIvu . /directory/  (10 args)
Confirm user presence for key ECDSA-SK SHA256:[snip]
Timeout, server webserver not responding.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(228) [Receiver=v3.2.3]
[Receiver] _exit_cleanup(code=12, file=io.c, line=228): about to call exit(12)

在我的 kubuntu 機器上,我可以毫無問題地與伺服器進行 ssh/scp/rsync。此外,從我的 Android 到我的 kubuntu 機器的連接沒有問題,但使用 Manjaro 時它會掛起。我在三個不同的 wifi 中觀察到了這個問題,這讓我認為它與網路無關。

ssh/sshd 配置(或 Manjaro 機器上的任何配置)無關緊要,因為我可以使用 Manjaro 20.2 KDE Live System 重現該問題。

我找到了解決方案。SSH 問題的原因是我的 wifi 晶片組的驅動程序。我正在使用 Broadcom BCM4311 並安裝 Broadcom-wl 驅動程序為我解決了這個問題。我首先安裝了所有已安裝核心的 linux 頭包,然後安裝了 broadcom-wl-dkms 驅動程序。

sudo pacman -Syyu
sudo pacman -S $(pacman -Qsq "^linux" | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-headers"}' ORS=' ')
sudo pacman -S broadcom-wl-dkms

重新啟動後,應該啟用“wl”驅動程序,我可以使用以下命令進行確認:

laptop% inxi -Fxz | grep BCM4331
          Device-2: Broadcom BCM4331 802.11a/b/g/n vendor: Apple AirPort Extreme driver: wl v: kernel port: efa0 

司機應該是wl不是 bcma-pci-bridge

以下網站向我指出了解決方案:

https://wiki.archlinux.org/index.php/Broadcom_wireless#SSH_freeze_for_BCM4331_with_b43

https://archived.forum.manjaro.org/t/broadcom-wifi-driver-fails-to-install-properly/46316/2

引用自:https://unix.stackexchange.com/questions/627451