Ssh

apt 殺死終端

  • May 27, 2022

我有一個帶有 Raspbian 11 靶心的 Raspberry Pi 4(4GB 記憶體)主機。今天,我試圖執行一個 ansible playbook 來使用 apt 更新系統,但由於分段錯誤錯誤而失敗,這看起來很奇怪。我通過 SSH 連接並嘗試apt update手動執行,但它終止了連接。使用 -vvv 的 SSH 輸出為:

pi@rpi4:~ $ apt update
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i0 o1 sock -1 wfd 5 efd 6 [write])
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug2: channel 0: rcvd eow
debug2: chan_shutdown_read: channel 0: (i0 o3 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
 #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1 io 0x00/0x00)

debug3: send packet: type 1
Connection to <ip> closed.
Transferred: sent <B>, received <B> bytes, in <s> seconds
Bytes per second: sent <Bps>, received <Bps>
debug1: Exit status -1

由於它沒有引發任何錯誤,因此我嘗試了搜尋apt update kills ssh和類似的查詢,但沒有解決問題。

執行apt-get update也會終止連接。(我也嘗試在 tmux 中執行它並殺死了 tmux)

既沒有解決問題,sudo dpkg --configure -asudo dpkg-reconfigure apt沒有解決問題,他們沒有終止連接。

編輯:apt upgrade也殺了它

可能出了什麼問題?意外斷電會導致這種情況嗎?

編輯2:進一步調查:跑步ls -l python2的方式相同。python2殺死終端。我不tkink它真的與apt有關。我會繼續嘗試,我會更新。

經過更多調查,似乎 bash 中引發的任何錯誤都會殺死終端。我嘗試ls /usr/bin/python2在 zsh 中執行(不存在),這是輸出:

ls: cannot access '/usr/bin/python2'zsh: segmentation fault  ls /usr/bin/python2

在看到這個結果並閱讀這個問題之後,似乎突然斷電可能已經損壞了 SD 卡。我想是時候將它重新刷入新的 SD 卡了。

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