突然sudo apt update
在我的 Ubuntu 18.04.6 机器上不再工作了。我收到以下错误:
Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
Get:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Err:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease
Err:3 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Err:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://us.archive.ubuntu.com/ubuntu bionic InRelease' is not signed.
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-security/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://us.archive.ubuntu.com/ubuntu bionic-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
我的/etc/apt/sources.list
:
###### Ubuntu Main Repos
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
###### Ubuntu Update Repos
deb http://us.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
我的/etc/resolv.conf
:
nameserver 1.1.1.1
我尝试过更改存储库镜像,但没有成功。我尝试在 Ubuntu docker 镜像中运行 sudo apt update,但出现相同的错误。
注释掉源存储库并没有改变这种情况。
这是否意味着这是网络问题?或者我仍然可以做/检查某些事情?
更新:
我正在按照评论中的建议添加更多详细信息。/etc/apt/apt.conf
不存在,而且我没有使用代理。这个问题已经持续了上个月。我尝试在 Docker 中更新 Ubuntu bionic,但得到了相同的结果。我还尝试选择另一个存档存储库镜像,再次出现相同的错误。
答案1
因此我无法修复远程机器上的问题,而且由于我目前无法物理访问该机器,因此我只能使用反向 SSH 隧道和 SSH SOCKS5 代理。
我在本地机器上设置了 SSH SOCKS5 代理:
ssh -N -D 54322 localhost
然后在另一个终端上,我创建了反向 SSH 隧道,将远程服务器的端口转发到代理端口(在本例中为 54322):
ssh -N -R 6667:localhost:54322 <server-ip> -o ServerAliveInterval=15 -o ServerAliveCountMax=3
最后我创建了文件/etc/apt/apt.conf.d/proxy.conf
并为 APT 添加了 SOCKS5 代理:
Acquire:http:Proxy "socks5h://127.0.0.1:6667/"
Acquire:https:Proxy "socks5h://127.0.0.1:6667/"
sudo apt update
这使得我可以顺利运行。