Ubuntu 升级

Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-181-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
New release '24.04.4 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Wed Jul 22 04:26:49 2026 from 172.25.25.24
root@g150s:~# 
root@g150s:~# do-release-upgrade
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.
root@g150s:~#

您的终端显示,尝试从 Ubuntu 22.04.5 LTS 升级到 24.04.4 LTS 时被阻止,因为系统要求先安装当前版本的所有可用更新。这是标准的安全检查,避免在未打补丁的系统上执行版本升级。

以下是如何顺利完成升级的详细步骤(请在操作前做好重要数据备份):


1. 更新当前系统的所有软件包

apt update
apt upgrade -y
apt dist-upgrade -y   # 可选,用于处理依赖关系变更
apt autoremove -y     # 清理不再需要的包

执行完毕后,建议重启一次系统(如果内核有更新),以确保所有更新生效:

reboot

2. 检查升级工具和配置

确保已安装 update-manager-core(通常默认已安装):

apt install update-manager-core -y

查看 /etc/update-manager/release-upgrades 文件,确认 Prompt 的值为 lts(确保只允许 LTS 到 LTS 升级):

cat /etc/update-manager/release-upgrades

如果显示 Prompt=never,请改为 Prompt=lts,然后保存。


3. 再次尝试版本升级

do-release-upgrade

如果系统提示没有新版本,可以加上 -d 参数(仅当您想升级到开发版,但您目标是 24.04.4 LTS,无需 -d)。正常执行即可。


4. 关于“minimized”系统的额外提示

您的系统是“最小化安装”,提示运行 unminimize 来恢复缺失的内容。虽然不是升级必须,但某些依赖包可能缺失,建议先执行:

unminimize

然后按提示确认,这会安装常用文档、手册页和语言包等,可能避免后续升级过程中的小问题。


5. 升级过程中的注意事项

  • 网络连接:确保网络稳定,升级过程会下载大量包(约 1~2 GB)。
  • 使用 screen 或 tmux:如果是远程 SSH 连接,建议在 screentmux 会话中执行,防止网络中断导致升级失败。
  • 磁盘空间:确保 / 分区至少有 5~10 GB 可用空间。
  • 第三方软件源:升级前建议禁用或移除非官方软件源(如 PPA),否则可能干扰升级过程。

若升级后遇到问题

升级完成后,建议再次重启并检查系统版本:

lsb_release -a

如有异常,可以查看 /var/log/dist-upgrade/ 下的日志文件。


如果您在执行中遇到具体错误,请提供错误信息,我会协助您进一步排查。祝升级顺利! :rocket:


Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.8.0-136-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
Last login: Wed Jul 22 04:48:10 2026 from 172.25.25.24
root@g150s:~#