Ubuntu 20.04.6升级LTS时do-release-upgrade移除官方源导致失败的问题求助
大家好,我最近在把一台运行Ubuntu 20.04.6的服务器升级到最新LTS版本时卡壳了,遇到一个非常棘手的问题:do-release-upgrade工具会自动移除apt源列表里的官方Ubuntu源,之后就因为找不到必要的升级包而终止流程,我完全搞不懂它为什么要这么做,来这里求助各位!
先给大家展示下我的当前环境:
当前的有效APT源配置
我执行了以下命令查看/etc/apt/sources.list里的有效配置(过滤掉空行和注释):
:~# cat /etc/apt/sources.list | grep -v ^$ | grep -v ^# deb http://ftp.ubuntu.com/ubuntu focal main restricted deb http://ftp.ubuntu.com/ubuntu focal-updates main restricted deb http://ftp.ubuntu.com/ubuntu focal universe deb http://ftp.ubuntu.com/ubuntu focal-updates universe deb http://ftp.ubuntu.com/ubuntu focal multiverse deb http://ftp.ubuntu.com/ubuntu focal-updates multiverse deb http://ftp.ubuntu.com/ubuntu focal-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu focal-security main restricted deb http://security.ubuntu.com/ubuntu focal-security universe deb http://security.ubuntu.com/ubuntu focal-security multiverse
APT更新正常执行
运行apt update后,所有源都能正常获取,没有报错,输出如下:
:~# apt update Hit:1 http://ppa.launchpad.net/ondrej/apache2/ubuntu focal InRelease Hit:2 http://ftp.ubuntu.com/ubuntu focal InRelease Get:3 http://ftp.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Get:4 http://ftp.ubuntu.com/ubuntu focal-backports InRelease [108 kB] Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Hit:6 https://esm.ubuntu.com/apps/ubuntu focal-apps-security InRelease Hit:7 https://esm.ubuntu.com/apps/ubuntu focal-apps-updates InRelease Hit:8 https://esm.ubuntu.com/infra/ubuntu focal-infra-security InRelease Hit:9 https://esm.ubuntu.com/infra/ubuntu focal-infra-updates InRelease Fetched 336 kB in 3s (104 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date.
另外,我的/etc/apt/sources.list.d目录下还有几个额外的源文件,主要是ESM相关的仓库。
执行do-release-upgrade后的错误流程
当我运行do-release-upgrade时,一开始的包管理器检查是正常的,然后它提示:
Third party sources disabled
Some third party entries in your sources.list were disabled. You can
re-enable them after the upgrade with the 'software-properties' tool
or your package manager.
To continue please press [ENTER]
我按下回车后,工具开始获取Jammy(22.04)的源,但奇怪的是,它只保留了security.ubuntu.com和ESM的源,把所有ftp.ubuntu.com的官方源都移除了!最后直接报错:
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Get:2 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security InRelease [7,553 B] Get:3 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease [7,459 B] Get:4 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease [7,453 B] Get:5 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease [7,452 B] Get:6 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [277 kB] Get:7 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [631 kB] Get:8 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security/main amd64 Packages [41.5 kB] Get:9 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [148 kB] Get:10 http://security.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [11.0 kB] Get:11 http://security.ubuntu.com/ubuntu jammy-security/restricted i386 Packages [29.7 kB] Get:12 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [651 kB] Get:13 http://security.ubuntu.com/ubuntu jammy-security/restricted Translation-en [104 kB] Get:14 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 c-n-f Metadata [532 B] Get:15 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [756 kB] Get:16 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security/main i386 Packages [32.7 kB] Get:17 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [544 kB] Get:18 http://security.ubuntu.com/ubuntu jammy-security/universe Translation-en [136 kB] Get:19 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates/main amd64 Packages [479 B] Get:20 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 c-n-f Metadata [15.9 kB] Get:21 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [36.5 kB] Get:22 http://security.ubuntu.com/ubuntu jammy-security/multiverse i386 Packages [1,032 B] Get:23 http://security.ubuntu.com/ubuntu jammy-security/multiverse Translation-en [7,060 B] Get:24 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 c-n-f Metadata [260 B] Get:25 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security/main amd64 Packages [479 B] Get:26 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates/main amd64 Packages [479 B] Fetched 3,567 kB in 0s (0 B/s) Checking package manager Reading package lists... Done Building dependency tree Reading state information... Done Invalid package information After updating your package information, the essential package 'ubuntu-minimal' could not be located. This may be because you have no official mirrors listed in your software sources, or because of excessive load on the mirror you are using. See /etc/apt/sources.list for the current list of configured software sources. In the case of an overloaded mirror, you may want to try the upgrade again later.
我的疑问
从流程里能明显看到,do-release-upgrade把原本的ftp.ubuntu.com官方源当成第三方源给移除了,只留下了security源和ESM源,这直接导致找不到ubuntu-minimal这类核心包。我想知道:
- 这个工具是怎么判定一个源是不是第三方源的?
- 有没有办法让它识别
ftp.ubuntu.com是官方源,别把它删掉?
备注:内容来源于stack exchange,提问作者Nicolas Noble




