升级云服务器Ubuntu LTS版本时遇到的问题及解决
2019-12-12 22:59
本文共约 562 字
预计阅读时间约 2 分钟
我的个人网站现在跑在云服务器上,由于安装时间稍早,使用的还是上一个LTS版本,最近登录提示:
1Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-170-generic x86_64)
2
3 * Documentation: https://help.ubuntu.com
4 * Management: https://landscape.canonical.com
5 * Support: https://ubuntu.com/advantage
6
7 * Overheard at KubeCon: "microk8s.status just blew my mind".
8
9 https://microk8s.io/docs/commands#microk8s.status
10New release '18.04.3 LTS' available.
11Run 'do-release-upgrade' to upgrade to it.于是尝试用sudo do-release-upgrade升级一下,结果遭遇如下错误提示而失败:
1...
2
3Checking package manager
4Reading package lists... Done
5Building dependency tree
6Reading state information... Done
7
8Invalid package information
9
10After updating your package information, the essential package
11'ubuntu-minimal' could not be located. This may be because you have
12no official mirrors listed in your software sources, or because of
13excessive load on the mirror you are using. See /etc/apt/sources.list
14for the current list of configured software sources.
15In the case of an overloaded mirror, you may want to try the upgrade
16again later.经排查,怀疑是/etc/apt/sources.list中配置的某些第三方镜像,无法被do-release-upgrade正确处理。于是考虑如下方法(重置该配置文件,并重新尝试升级):
1mv /etc/apt/sources.list ~/ # 备份
2echo "deb http://archive.ubuntu.com/ubuntu bionic universe main" > /etc/apt/sources.list # 只保留一个主源
3do-release-upgrade更新成功,问题解决。
问题排查过程中,参考了如下网页:
- https://www.digitalocean.com/community/questions/cannot-update-to-19-04-the-essential-package-ubuntu-minimal-could-not-be-located-2
- https://serverfault.com/questions/836889/ubuntu-14-04-on-linode-not-doing-do-release-upgrade
- https://askubuntu.com/questions/124017/how-do-i-restore-the-default-repositories