非 LTS 版本的 ubuntu 23.10 官方源更新失败
我用来放个人主页的美国服务器,系统版本是 ubuntu23.10,很久没更新,今天更新时提示报错:
# apt update
Ign:1 http://archive.ubuntu.com/ubuntu mantic InRelease
Ign:2 http://archive.ubuntu.com/ubuntu mantic-updates InRelease
Ign:3 http://security.ubuntu.com/ubuntu mantic-security InRelease
Ign:4 http://archive.ubuntu.com/ubuntu mantic-backports InRelease
Err:5 http://security.ubuntu.com/ubuntu mantic-security Release
404 Not Found [IP: 2620:2d:4002:1::102 80]
Err:6 http://archive.ubuntu.com/ubuntu mantic Release
404 Not Found [IP: 2620:2d:4002:1::102 80]
Err:7 http://archive.ubuntu.com/ubuntu mantic-updates Release
404 Not Found [IP: 2620:2d:4002:1::102 80]
Err:8 http://archive.ubuntu.com/ubuntu mantic-backports Release
404 Not Found [IP: 2620:2d:4002:1::102 80]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu mantic-security Release' does not have a Release file.
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.
E: The repository 'http://archive.ubuntu.com/ubuntu mantic Release' no longer has a Release file.
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.
E: The repository 'http://archive.ubuntu.com/ubuntu mantic-updates Release' no longer has a Release file.
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.
E: The repository 'http://archive.ubuntu.com/ubuntu mantic-backports Release' no longer has a Release file.
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.
问了下 ChatGPT, Ubuntu 23.10(Mantic Minotaur)已经进入“过期(EOL,End of Life)”状态,其软件源被移至 Ubuntu 的旧版本存档(old-releases repository)。解决方法是更换为旧版本存档的源地址。
解决方法:切换到旧版本存档源
- 编辑 sources.list 文件
打开 /etc/apt/sources.list 文件:
sudo nano /etc/apt/sources.list
- 替换所有 archive.ubuntu.com 和 security.ubuntu.com 为 old-releases.ubuntu.com
修改后的内容类似以下:
deb http://old-releases.ubuntu.com/ubuntu/ mantic main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ mantic-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ mantic-backports main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ mantic-security main restricted universe multiverse
- 保存并退出
按 Ctrl+O 保存,Ctrl+X 退出编辑器。
- 更新软件包列表
运行以下命令:
sudo apt update
sudo apt upgrade
推荐:升级到受支持的 Ubuntu 版本
Ubuntu 23.10 是一个 非长期支持版本(非 LTS),其支持周期只有 9 个月。建议升级到长期支持(LTS)版本,例如 Ubuntu 22.04 LTS 或等待下一个 LTS 版本 Ubuntu 24.04(预计 2024 年发布)。
- 确保当前系统已更新:
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
- 使用 do-release-upgrade 升级:
sudo do-release-upgrade
如果没有升级选项,可以加上 -d 强制检测新版本:
sudo do-release-upgrade -d
完成后,系统更新应该恢复正常。