如何从命令行将 20.04 升级到 20.04.6?

如何从命令行将 20.04 升级到 20.04.6?

我找到了一台装有 Ubuntu 20.04 LTS 的电脑,我已经半年没用过了,我想把软件包更新到最新的。我以为 20.04 LTS 会支持到 2025 年,所以我发布了

$ sudo apt update
$ sudo apt upgrade

并得到这个:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

好的,很有趣。所以我检查了一下

$ gcc --version

gcc(Ubuntu 9.3.0-10ubuntu2)9.3.0

然后登录到另一台装有 Ubuntu 20.04 LTS 的机器,在那里我得到了

gcc(Ubuntu 9.4.0-1ubuntu1~20.04.1)9.4.0

好的,有趣...那么让我们再次检查 Ubuntu 版本:

这里:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:    20.04
Codename:   focal

那里:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:    20.04
Codename:   focal

就是这样!哇。现在怎么样?好吧,让我们尝试 do-release-upgrade

$ do-release-upgrade
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [819 B]                                                                 
Get:2 Upgrade tool [1 266 kB]                                                                        
Fetched 1 267 kB in 0s (0 B/s)                                                                       
authenticate 'jammy.tar.gz' against 'jammy.tar.gz.gpg' 
extracting 'jammy.tar.gz'

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree        
Reading state information... Done

Required depends is not installed 

The required dependency 'apt (>= 2.0.4)' is not installed. 

哦,不。我不想要 22.04。它甚至不起作用。真是一团糟!我只想更新我的 20.04 LTS。软件更新程序图形窗口弹出并告诉我有 20.04.02 可用,建议升级。很酷,但是不行。我不想使用图形软件更新程序。我想使用老式的(很快就会被……[审查] 杀死)apt 系列工具。我相信有一种简单的方法,但谷歌搜索从 20.04 升级到 20.04.06 却没有……什么也没说。

请问我遗漏了 Ubuntu 故事的哪一部分?

PS 哦,顺便说一句。当尝试在 20.04 系统上从 Firefox 发布问题时,[查看问题] 按钮不起作用...我不得不通过慢速 X 连接从另一台装有 20.04.6 的机器上运行远程 Firefox :(

控制台报告:

SyntaxError: invalid regular expression flag s  in ask.en.js:62:34216. WTFU!?

根据评论的新发现:

$ sudo apt update
Hit:1 http://en.archive.ubuntu.com/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

$ sudo apt full-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

根据最新评论还有更多令人兴奋的消息:

(除了一些注释行)这是我的 /etc/apt/sources.list 的内容

deb http://archive.ubuntu.com/ubuntu/ focal main restricted
deb http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal multiverse

事实上昨天它是 sk.archive.ubuntu.com,我试图将它更改为 en.archive.ubuntu.com 但没有结果,现在我直接将它更改为 archive.ubuntu.com,再次像上次一样重新下载了软件包列表,但没有其他有用的结果,见下文:

$ sudo apt update
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main Translation-en [506 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 DEP-11 Metadata [494 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main DEP-11 48x48 Icons [98,4 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main DEP-11 64x64 Icons [163 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 c-n-f Metadata [29,5 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [22,0 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/restricted i386 Packages [8 112 B]
Get:11 http://archive.ubuntu.com/ubuntu focal/restricted Translation-en [6 212 B]
Get:12 http://archive.ubuntu.com/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
Get:13 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [8 628 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/universe i386 Packages [4 642 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/universe Translation-en [5 124 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/universe amd64 DEP-11 Metadata [3 603 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal/universe DEP-11 48x48 Icons [3 016 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/universe DEP-11 64x64 Icons [7 794 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal/multiverse i386 Packages [74,7 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 DEP-11 Metadata [48,4 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal/multiverse DEP-11 48x48 Icons [23,1 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal/multiverse DEP-11 64x64 Icons [192 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9 136 B]
Fetched 36,9 MB in 12s (3 061 kB/s)                                            
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

和 也一样sudo apt full-upgrade。这是不是有点神秘了?

最后一条评论还提到了一些关于安全性的内容,我注意到在文件末尾有一些注释掉的 deb-src eoan-security 行,所以我又添加了几行:

deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
deb-src http://security.ubuntu.com/ubuntu focal-security universe
deb-src http://security.ubuntu.com/ubuntu focal-security multiverse

结果如下:

$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease                               
Get:3 http://security.ubuntu.com/ubuntu focal-security/multiverse Sources [12,2 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/restricted Sources [50,9 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/main Sources [287 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/universe Sources [180 kB]
Fetched 644 kB in 1s (561 kB/s)                   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
petrovic@pisek:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt full-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

但那是 deb-src,我们可能只需要 deb,好的,再添加三行:

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

这终于解决了!现在我得到了

已升级 592 个,新安装 12 个,删除 0 个,未升级 0 个。需要获取 733 MB 的档案。

太好了,谢谢你的帮助,机器已更新!

答案1

没什么神秘的。

正如用户 535733 在评论中提到的,您的系统正在执行您设置的操作。

具体来说,你只有主要的repo 到您的源列表中。这样您就可以获得原始交付的系统,而无需更新。

您需要添加更新安全将 repos 添加到你的源列表中。

将源列表从完全更新的系统复制到该系统。

相关内容