无法将 Ubuntu 16.04 升级到较新的版本

无法将 Ubuntu 16.04 升级到较新的版本

我有一台 HP EliteBook 2540p。我想将我的 Ubuntu 16.04 升级到较新的版本。我发现我需要先升级到 18.04,然后才能升级到 20.04。

我尝试了推荐的程序,使用以下命令更新系统并升级软件和软件包:

sudo apt update && sudo apt upgrade
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease                                                    
Hit:2 http://ppa.launchpad.net/canonical-chromium-builds/stage/ubuntu xenial InRelease                        
Hit:3 http://repo.mysql.com/apt/ubuntu xenial InRelease                                                       
Hit:4 http://packages.microsoft.com/repos/code stable InRelease                                               
Ign:5 http://repo.vivaldi.com/stable/deb stable InRelease                                                     
Hit:6 http://dl.google.com/linux/chrome/deb stable InRelease                                                  
Hit:7 http://ma.archive.ubuntu.com/ubuntu xenial InRelease                                                    
Get:8 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]                                    
Hit:9 http://ppa.launchpad.net/clipgrab-team/ppa/ubuntu xenial InRelease                                      
Hit:10 http://repo.vivaldi.com/stable/deb stable Release                                                      
Get:11 http://ma.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]                                  
Get:12 https://download.docker.com/linux/ubuntu xenial InRelease [66.2 kB]                                    
Hit:13 http://ppa.launchpad.net/nathan-renniewaldock/flux/ubuntu xenial InRelease                             
Hit:14 https://deb.opera.com/opera-stable stable InRelease                                                    
Hit:15 https://brave-browser-apt-release.s3.brave.com xenial InRelease                                        
Hit:16 https://brave-browser-apt-dev.s3.brave.com xenial InRelease                                            
Hit:17 http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu xenial InRelease                                  
Hit:18 https://brave-browser-apt-beta.s3.brave.com xenial InRelease                                           
Get:19 https://repo.skype.com/deb stable InRelease [4,502 B]                                                  
Hit:20 https://brave-browser-apt-nightly.s3.brave.com xenial InRelease                                        
Hit:21 http://ppa.launchpad.net/noobslab/indicators/ubuntu xenial InRelease
Hit:22 https://esm.ubuntu.com/infra/ubuntu xenial-infra-security InRelease                         
Get:23 http://ma.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]                     
Hit:24 https://deb.nodesource.com/node_5.x xenial InRelease                          
Hit:25 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease                   
Hit:26 https://esm.ubuntu.com/infra/ubuntu xenial-infra-updates InRelease            
Hit:27 http://ppa.launchpad.net/remmina-ppa-team/remmina-next/ubuntu xenial InRelease                         
Hit:29 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial InRelease
Hit:30 https://packagecloud.io/AtomEditor/atom/any any InRelease
Hit:31 https://packagecloud.io/shiftkey/desktop/any any InRelease
Err:19 https://repo.skype.com/deb stable InRelease
  The following signatures were invalid: KEYEXPIRED 1624268195  KEYEXPIRED 1624268195  KEYEXPIRED 1624268195
Hit:32 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Reading package lists... Done 
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: GPG error: https://repo.skype.com/deb stable InRelease: The following signatures were invalid: KEYEXPIRED 1624268195  KEYEXPIRED 1624268195  KEYEXPIRED 1624268195
E: The repository 'https://repo.skype.com/deb stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1

我想我无法获得我需要的所有更新和升级,而且我不知道问题是什么。

之后我尝试了这个命令来检查可用的版本:

$ sudo do-release-upgrade -c
Checking for a new Ubuntu release
New release '18.04.6 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

它看起来好像正在工作,但是当我尝试升级命令时,它不起作用:

$ sudo do-release-upgrade
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

我不知道问题是什么。

答案1

简而言之,您等待的时间太长了,无法轻松有效地完成此事。

16.04 已经超出标准支持范围,这意味着除非您处于扩展安全维护状态,否则不再有更新(静电放电)。您需要先执行更新,然后才能升级到下一个版本,而如果没有 ESM,您就无法做到这一点。因此才出现问题。

您可以注册 ESM,执行系统维护,理论上应该能够顺利升级到 18.04。

但是既然你想使用 20.04,那么版本升级实际上没有任何意义。升级时你不能轻易跳过版本,而且升级总是有可能失败,这取决于你的硬件和系统上已经安装的内容,特别是如果你有任何不是来自 Ubuntu 存储库的软件。版本升级也需要很长时间才能完成。

此时,最好全新安装 20.04。 请记住,LTS 版本附带 5 年的标准支持,如果您不想将来陷入这种困境,请确保及时升级。在新的 LTS 版本不再受支持之前,您有整整三年的时间可以升级到下一个 LTS。

您还可以注册 ubuntu-announce 邮件列表以获取有关新版本和 EOL 公告的电子邮件:

https://lists.ubuntu.com/mailman/listinfo/ubuntu-announce

答案2

我尝试从 14.04 进行更新时遇到了很大困难,正当我准备放弃时,我看到了@N0rbert 的评论,这激励我再次尝试。

最终对我有用的步骤是(可能可以优化)

  • sudo apt 更新 && sudo apt 升级
  • sudo apt dist-upgrade
  • sudo 立即重启
  • dpkg --get-selections | awk'$2 ==“deinstall”{print $1}'| xargs sudo apt-get purge -y
  • sudo apt 更新 && sudo apt 升级
  • sudo apt 安装更新管理器核心
  • sudo do-release-升级

我现在成功运行了 16.04.07 LTS。这是个好消息,因为我想要保留的所有重要服务器自定义都完好无损并且正在运行!

** 编辑 **

我意识到我是从 14.04 开始的,它甚至更加破旧,但我的策略也适用于 16.04+

答案3

如果之后

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt autoremove

仍然

Please install all available updates for your release before upgrading.

sudo apt list --upgradable

sudo apt remove <listed packages of command above>

例如

sudo apt remove chrome-remote-desktop google-chrome-stable

如果还是不行,尝试:

sudo ua enable esm-infra

如果输出是

To use 'esm-infra' you need an Ubuntu Pro subscription Personal and community subscriptions are available at no charge See https://ubuntu.com/pro

然后注册成为专业人士https://ubuntu.com/pro/dashboard 然后从那里

sudo pro attach <pro token>

现在你可以

sudo apt dist-upgrade

使用新的库。之后

sudo do-release-upgrade

将会做这件事。

相关内容