此工具不支持从“hirsute”升级到“jammy”

sai*_* sa 9 upgrade ubuntu-21.04 ubuntu-22.04

我按照本教程将 ubuntu 21.04 hirsute 升级到 22.04,在第 6 步中失败并抛出以下错误,请帮助我解决此问题

Reading cache

Checking package manager

Can not upgrade 

An upgrade from 'hirsute' to 'jammy' is not supported with this tool.
Run Code Online (Sandbox Code Playgroud)
https://linuxconfig.org/how-to-upgrade-ubuntu-to-22-04-lts-jammy-jellyfish
Run Code Online (Sandbox Code Playgroud)

nb5*_*2er 18

更新:感谢 smknstd、JoeCool、MDarrinT 和 PurplProto。

脚本又开始工作了。

您可以选择 3 种不同的方法:

# First method, upgrade to 22.04 with the official ubuntu method ( old-releases.ubuntu.com )
# Replace sources.list   
text="deb http://old-releases.ubuntu.com/ubuntu/ hirsute main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-security main restricted universe multiverse"
sudo echo "$text" | sudo tee /etc/apt/sources.list
# Prerequisites
sudo apt-get update
sudo apt-get install update-manager-core update-manager -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y 
# Download and run the ubuntu upgrade tool
wget http://archive.ubuntu.com/ubuntu/dists/jammy-updates/main/dist-upgrader-all/current/jammy.tar.gz
tar -xaf jammy.tar.gz 
sudo ./jammy --frontend=DistUpgradeViewText

-------------------------------++++++++++++++++++++++++--------------------------------

# Second method, upgrade to 22.04 replacing the entire sources.list with the jammy repos
# Replace sources.list   
text="deb http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse
deb http://security.ubuntu.com/ubuntu jammy-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu jammy-security main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse"
sudo echo "$text" | sudo tee /etc/apt/sources.list
# Bypass "An upgrade from 'xxx' to 'xxx' is not supported with this tool" error
sudo sed -i 's/continue/pass/g' /usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py
# Start upgrade
sudo apt-get update
sudo do-release-upgrade
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install -f -y
sudo apt-get autoremove --purge -y
       
-------------------------------++++++++++++++++++++++++--------------------------------

# Third method, upgrade to 22.04 replacing the current distro codename with jammy into the sources.list with sed
# Replace sources.list  
sudo sed -i 's/hirsute/jammy/g' /etc/apt/sources.list
# Bypass "An upgrade from 'xxx' to 'xxx' is not supported with this tool" error
sudo sed -i 's/continue/pass/g' /usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py
# Start upgrade
sudo apt-get update
sudo do-release-upgrade
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install -f -y
sudo apt-get autoremove --purge -y
       
Run Code Online (Sandbox Code Playgroud)

完整的 github 脚本链接请参见此处


小智 7

嗯,我尝试了上面的方法。它失败了。

通过查看脚本,我决定检查 Ubuntu 服务器上的软件包。奇怪了,居然还有这些NotFound错误。你猜怎么了?Ubuntu 服务器中缺少引用的 apt 文件。

然后我进去并将文件中的所有hirsute标签更改为。一旦我这样做了,apt就跑了。然后我可以运行上面指出的脚本并让它找到包。jammy/etc/apt/sources.list

现在,它起作用了。有几条关于php-fpm在Apache HTTP下未启用的消息,但由于我运行nginx,我希望它能正常工作。

它奏效了。我必须运行一遍apt upgrade && apt update && apt dist-upgrade && apt autoremove才能清除碎屑,但我在 LTS 上安装了一个有效的安装。

  • 您可以使用 `sed` 来更轻松地更新源列表:`sed -i 's/hirsute/jammy/g' /etc/apt/sources.list`。 (3认同)