我正在运行 Ubuntu 16.04,突然间,APT 坏了,我无法打开终端。更具体地说,我在顶部的工具栏中看到一个带有白色减号的红色圆圈,当我单击它时,它显示A problem occurred when checking for the updates
。当我单击终端时,鼠标指针变为一个圆圈几秒钟,什么也没发生。
我意识到这个问题已被问过很多次,但我已经尝试了一些其他的解决方案(例如运行 apt-get -f install、apt-get update、apt-get upgrade、在 sources.list 中注释掉 PPA)。
这是我的 sources.list 的内容
# deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution. deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution. deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team. deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
我在 /etc/apt/sources.list.d 下也有 PPA:
- dropbox.列表
- gerardpuig-ubuntu-ppa-xenial.list
- atlassian-hipchat4.list
- jonathonf-ubuntu-python-3_6-xenial.list
- libreoffice-ubuntu-ppa-xenial.list
- pgdg.列表
我还注意到,即使我运行了 update/upgrade/dist-upgrade 并重新启动,当我登录 TTY1 时,它仍然显示我有 94 个包需要升级。
在此之前,我唯一做的事情就是处理一些 Python 代码。不过我认为我没有做任何更改。我确实将默认的 Python 符号链接更改为指向 Python2,但我将其切换回 Python3,不幸的是,这并没有解决任何问题。
谢谢。
答案1
要在 Python 3.X 版本之间切换,只需运行:
sudo update-alternatives --config python3
要恢复软件更新,只需输入 python 3.5 的数字。
答案2
事实证明,在安装 python3 之后的某个时候,我将 /usr/bin/python3 符号链接切换为指向 python3.6 而不是默认的 python3.5 运行时。
将符号链接重置为指向 /usr/bin/python3.5 可解决所有问题。
答案3
准确地说,在我的情况下有帮助:打开终端(如果终端不起作用,则打开 UXTerm 或 Xterm)并输入两个命令:
sudo rm /usr/bin/python3
sudo ln -s /usr/bin/python3.5 /usr/bin/python3