常见的问题是apt使用代理。
不过今天遇到的情况是,桌面进不去,只能tty;在tty界面下,发现1080端口上开着代理,/etc/environment
和~/.bashrc
中都确保注释掉了http_proxy
和https_proxy
,重启电脑后还是提示:
Ign:1 http://mirrors.aliyun.com/ubuntu xenial/main i386 aptitude-common all 0.7.4-2ubuntu2
Err:2 http://mirrors.aliyun.com/ubuntu xenial/main amd64 libcwidget3v5 amd64 0.5.17-4ubuntu2
Unable to connect to 127.0.0.1:1080:
Err:3 http://mirrors.aliyun.com/ubuntu xenial/main amd64 aptitude amd64 0.7.4-2ubuntu2
Unable to connect to 127.0.0.1:1080:
Err:1 http://mirrors.aliyun.com/ubuntu xenial/main i386 aptitude-common all 0.7.4-2ubuntu2
Could not connect to 127.0.0.1:1080 (127.0.0.1). - connect (111: Connection refused)
Unable to correct missing packages.
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/main/a/aptitude/aptitude-common_0.7.4-2ubuntu2_all.deb Could not connect to 127.0.0.1:1080 (127.0.0.1). - connect (111: Connection refused)
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/main/c/cwidget/libcwidget3v5_0.5.17-4ubuntu2_amd64.deb Unable to connect to 127.0.0.1:1080:
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/main/a/aptitude/aptitude_0.7.4-2ubuntu2_amd64.deb Unable to connect to 127.0.0.1:1080:
E: Aborting install.
解决办法:指定-o Acquire::http::proxy=false
参数。 例如:
sudo apt install aptitude --fix-missing -o Acquire::http::proxy=false