今天在ubuntu上执行sudo apt-get update 时,出现了下面的错误:
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
Err:2 http://ppa.launchpad.net/alex-p/tesseract-ocr/ubuntu bionic InRelease
Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
Err:3 http://ppa.launchpad.net/damien-moore/codeblocks-stable/ubuntu bionic InRelease
Unable to connect to 192.168.8.1:3128:
Err:4 http://dl.google.com/linux/chrome-remote-desktop/deb stable InRelease
Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
Err:5 http://mirrors.ustc.edu.cn/ros/ubuntu bionic InRelease
Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
Err:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Unable to connect to 192.168.8.1:3128:
Err:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Unable to connect to 192.168.8.1:3128:
Err:8 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Unable to connect to 192.168.8.1:3128:
Err:9 http://security.ubuntu.com/ubuntu xenial-security InRelease
Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
Err:10 http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu bionic InRelease
Unable to connect to 192.168.8.1:3128:
Err:11 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Unable to connect to 192.168.8.1:3128:
Err:12 http://ppa.launchpad.net/nanoshot/ppa/ubuntu bionic InRelease
Unable to connect to 192.168.8.1:3128:
Err:13 http://ppa.launchpad.net/shutter/ppa/ubuntu bionic InRelease
Unable to connect to 192.168.8.1:3128:
Err:14 http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu bionic InRelease
Unable to connect to 192.168.8.1:3128:
Err:15 http://www.scootersoftware.com bcompare4 InRelease
Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
Err:16 https://linux.teamviewer.com/deb stable InRelease
Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-security/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
W: Failed to fetch http://ppa.launchpad.net/alex-p/tesseract-ocr/ubuntu/dists/bionic/InRelease Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
W: Failed to fetch http://dl.google.com/linux/chrome-remote-desktop/deb/dists/stable/InRelease Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
W: Failed to fetch http://ppa.launchpad.net/damien-moore/codeblocks-stable/ubuntu/dists/bionic/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu/dists/bionic/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/dists/bionic/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch http://ppa.launchpad.net/nanoshot/ppa/ubuntu/dists/bionic/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch http://mirrors.ustc.edu.cn/ros/ubuntu/dists/bionic/InRelease Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
W: Failed to fetch http://www.scootersoftware.com/dists/bcompare4/InRelease Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
W: Failed to fetch http://ppa.launchpad.net/shutter/ppa/ubuntu/dists/bionic/InRelease Unable to connect to 192.168.8.1:3128:
W: Failed to fetch https://linux.teamviewer.com/deb/dists/stable/InRelease Could not connect to 192.168.8.1:3128 (192.168.8.1). - connect (111: Connection refused)
W: Failed to fetch http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu/dists/bionic/InRelease Unable to connect to 192.168.8.1:3128:
W: Some index files failed to download. They have been ignored, or old ones used instead.
按照网上的方法,尝试过很多中方案,都没有解决,后来发现是在配置文件中设置了代理所致。解决办法:
cd /etc/apt/
# 将apt.conf文件中内容清空即可
echo >apt.conf
然后执行sudo apt-get update即可成功更新。