前言

最近Ubuntu Server升级到24.04.1的渠道已经开放,于是就顺着升级一下试试看。

按照常规的 do-release-upgrade 方法升级,发现总是提示如下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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.

Restoring original system state

Aborting

g package lists...5%
*** Collecting problem information

The collected information can be sent to the developers to improve the application. This might take a few minutes.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
.
=== Command terminated with exit status 1 (Fri Aug 30 21:15:04 2024) ===

根据错误信息,大致可以判断是由于第三方软件源引起的。

解决方法

直接运行以下命令升级:

1
sudo RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1 do-release-upgrade
  • RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1: 这个环境变量允许从第三方软件源进行升级。

这个方法比较暴力,就是不解决问题直接升级,等升级后再排出问题所在。

注意:升级前确保做好备份!!!