惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
罗磊的独立博客
T
Tenable Blog
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
博客园 - 司徒正美
L
LINUX DO - 最新话题
AI
AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Secure Thoughts
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
W
WeLiveSecurity
博客园_首页
Forbes - Security
Forbes - Security
博客园 - 聂微东
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
V
Visual Studio Blog
Microsoft Security Blog
Microsoft Security Blog
Vercel News
Vercel News
小众软件
小众软件
Webroot Blog
Webroot Blog
V2EX - 技术
V2EX - 技术
博客园 - 叶小钗
T
The Exploit Database - CXSecurity.com
TaoSecurity Blog
TaoSecurity Blog
L
Lohrmann on Cybersecurity
I
InfoQ
J
Java Code Geeks
P
Privacy International News Feed
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
D
Docker
P
Proofpoint News Feed
B
Blog
Cisco Talos Blog
Cisco Talos Blog
M
MIT News - Artificial intelligence
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Threat Research - Cisco Blogs
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements

程序员笔记(huoyijie.cn)

generate new dataset with llm and knowledge graph resume deepseek applications Implement the classic huarongdao game with react Implement the classic tetris game with react Writing admin dashboard template with Nextjs How to AuthN user with OpenLDAP share whiteboard with websocket ocr overview tech notes subscribe topic with sse multi devices github an algorithm used for image text detect an algorithm used for image text detect facial expression recognition technology based on neural network oauth2 mysql store a real time collaborative whiteboard with infinite space How to perform load testing with Grafana k6 fix split of undefined with gitbook theme nodejs http proxy middleware analyze referer of express website writing a CDN origin server with Django a personal lightweight CMS tool writing in Golang profile introduce the post processing introduce the text detect method blockchain for dummies medical applications on ai facial expression recognition study facial expression recognition auth auth with oauth2 auth with jwt chat with sse react chat with websocket react http message signatures infinite whiteboard with socket.io multi factor auth with totp subscribe topic with sse capture screen to gif Golang 经典入门实践教程 · GitBook EFS 加密文件系统 · GitBook 弈杰围棋智能终端 · GitBook 如何把手机触摸屏变成触控板(Touchpad) · GitBook 基于 SOCKET.IO 搭建个人电脑 HTTP 静态服务器代理 · GitBook 三百行代码搭建一个简单的 SOCKS5 代理服务器 · GitBook 微信小程序(蓝牙BLE)远程遥控树莓派小车 · GitBook 语音远程遥控树莓派小车 · GitBook 树莓派的一些使用经验 · GitBook 从零开始制作树莓派小车 · GitBook UDPack 2.0 协议 · GitBook 前言 · GitBook 反向代理服务器实现原理 · GitBook 网站支持 HTTP 2.0 · GitBook 搭建配置邮件服务器 · GitBook 使用 Git 与 Gitbook 创建管理电子书 · GitBook 网站图片视频接入CDN · GitBook a personal lightweight self hosted git server written in Golang 快速搭建CDN回源服务器 · GitBook 基于 Git 搭建代码托管服务器 · GitBook
升级 Ubuntu 到 20.04 LTS 长期维护版本 · GitBook
huoyijie · 2024-05-24 · via 程序员笔记(huoyijie.cn)

我的台式电脑上次升级还是几年前,而且升级后的系统并不是 LTS 长期支持版本,早就不维护了。正常情况下,当一个版本不维护后,Ubuntu 软件源就不能再正常更新了。作为用户,要么选择升级到下一个 LTS 版本,要么只能把源调整下,指向已归档的源。当时为了省事,选择了后者,之后就一直没有再更新。虽然还可以正常使用和安装更新软件,但是和最新的 LTS 版本差异太大了,升级很可能会遇到问题。

查看 Ubuntu 源配置信息 /etc/apt/sources.list,可以看到其中资源地址都指向了 http://old-releases.ubuntu.com/ubuntu

deb http://old-releases.ubuntu.com/ubuntu artful main multiverse restricted universe
deb http://old-releases.ubuntu.com/ubuntu artful-backports main multiverse restricted universe
deb http://old-releases.ubuntu.com/ubuntu artful-proposed main multiverse restricted universe
deb http://old-releases.ubuntu.com/ubuntu artful-security main multiverse restricted universe
deb http://old-releases.ubuntu.com/ubuntu artful-updates main multiverse restricted universe
deb-src http://old-releases.ubuntu.com/ubuntu artful main multiverse restricted universe
deb-src http://old-releases.ubuntu.com/ubuntu artful-backports main multiverse restricted universe
deb-src http://old-releases.ubuntu.com/ubuntu artful-proposed main multiverse restricted universe
deb-src http://old-releases.ubuntu.com/ubuntu artful-security main multiverse restricted universe
deb-src http://old-releases.ubuntu.com/ubuntu artful-updates main multiverse restricted universe

再来看下当前系统版本为 17.10,代号为 artful

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 17.10
Release:    17.10
Codename:    artful

现在最新 LTS 版本是 20.04,中间还隔着一个 先升级到 18.04 LTS,现在的情况是必须要先升级到 18.04 LTS,然后再继续升级到 20.04 LTS 版本。

升级到 18.04 LTS

需要编辑sudo gedit /etc/apt/sources.list,替换 artfulbionic,同时为了升级过程更快,改用阿里云的源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

修改完配置,保存退出,然后更新软件库

$ sudo apt update
......
......
已下载 66.0 MB,耗时 117(853 kB/s)
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
有 1926 个软件包可以升级。请执行 ‘apt list --upgradable’ 来查看它们。

运行系统软件更新器,出现升级画面

ubuntu-upgrade-1

点击部分升级

ubuntu-upgrade-1

升级准备好后会进入下面的界面

ubuntu-upgrade-1

点击开始升级,此时开始下载软件包,因为需要安装近 2000 个 package,所以需要有些耐心。软件包全部下载完成后会自动进入安装过程。

ubuntu-upgrade-1

改为阿里源后下载还是比较快的,如上图已进入安装阶段

安装完成后,重启系统,重新进入系统桌面后,系统分辨率只有 800*600 ,打开软件更新器,找到驱动一栏,看到应该是没有加载显卡驱动,选中对应的显卡驱动,点应用然后重启机器,再次进入桌面后显示正常了。

查看系统版本,已升级为 18.04

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:    18.04
Codename:    bionic

升级到 20.04 LTS

再次打开软件更新器,此时已显示可更新到 20.04

ubuntu-upgrade-1

点击升级按钮

ubuntu-upgrade-1

点击升级按钮

ubuntu-upgrade-1

直到这里,我以为后面会比较顺利,谁知道后面遇到了下面这个问题,不得不终止了升级过程。

Unofficial software packages not provided by Ubuntu Please use the tool 'ppa-purge' from the ppa-purge  package to remove software from a Launchpad PPA and  try the upgrade again

然后在软件更新器里删除所有和 ppa 相关第三方安装源,重新升级没有这个错了,但是报了另外一个错误。估计还是和从 17.10 升级上来有关系,系统太老了,安装了很多第三方软件。升级软件无法计算需要升级安装哪些软件包。

没办法,只好选择手动修改源配置,然后部分升级。

修改 /etc/apt/sources.list,把 bionic 替换为 focal

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

打开软件管理器,提示可以部分升级

ubuntu-upgrade-1

点击部分升级按钮

ubuntu-upgrade-1

ubuntu-upgrade-1

点击开始升级按钮,后面的过程和从 17.10 升级到 18.04 过程差不多,先是下载软件包,然后进行安装升级。

ubuntu-upgrade-1

耐心等一段时间,一般都不会有什么问题。偶尔要看下屏幕,安装过程中,有些配置文件会询问你,是保留原有配置还是采用新的默认配置。我全部选择采用新的默认配置,覆盖已存在的配置。

安装完成后,还是选择立即重启,重启完成后进入新系统,第一感觉,整体风格更漂亮了。最后来看下升级成功后的版本显示,新系统代号 focal,已升级为 20.04

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

结论

如果大家也在使用 Ubuntu 系统,最好安装 LTS 长期支持版本,官方团队一般会支持维护很长时间。而且升级到下一个 LTS 版本也通常很方便。当有新的 LTS 版本出来后,大家还是尽早升级比较好,升级一般不会对系统或者数据造成损失。尽早升级一方面可以体验新版本系统中新增的功能,另一方面减少升级过程中不必要的麻烦。

比较老的系统升级是比较痛苦的,说不准就会遇到什么奇怪的问题。此时官方技术团队的主要精力都在维护当前 LTS 版本以及未来的新版本,这些问题是否能解决就要看运气了。

参考 how-to-upgrade-from-ubuntu-18-04-lts-to-20-04-lts-today