Ubuntu 21.10无法安装软件包,ffmpeg安装失败求助
问题背景
我尝试安装FFmpeg,常规步骤是:
sudo apt update sudo apt install ffmpeg
但执行sudo apt update时出现以下错误:
The following signatures were invalid: EXPKEYSIG 277A7293F59E4889 MiKTeX Packager packager@miktex.org
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu impish-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://gb.archive.ubuntu.com/ubuntu impish 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.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repository.spotify.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7A3A762FAFD4A51F
E: The repository 'http://gb.archive.ubuntu.com/ubuntu impish-updates 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://gb.archive.ubuntu.com/ubuntu impish-backports 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.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://ctan.dcc.uchile.cl/systems/win32/miktex/setup/deb focal InRelease: The following signatures were invalid: EXPKEYSIG 277A7293F59E4889 MiKTeX Packager packager@miktex.org
执行sudo apt install ffmpeg并确认后,出现404错误:
(base) robbie@ro-rmallett-l1:~$ sudo apt install ffmpeg Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed: libavdevice58 libdc1394-25 libopenal-data libopenal1 libsdl2-2.0-0 Suggested packages: ffmpeg-doc libportaudio2 The following NEW packages will be installed ffmpeg libavdevice58 libdc1394-25 libopenal-data libopenal1 libsdl2-2.0-0 0 to upgrade, 6 to newly install, 0 to remove and 19 not to upgrade. Need to get 3,046 kB of archives. After this operation, 5,642 kB of additional disk space will be used. Do you want to continue? [Y/n] Y WARNING: The following packages cannot be authenticated! libdc1394-25 libopenal-data libopenal1 libsdl2-2.0-0 libavdevice58 ffmpeg Install these packages without verification? [y/N] Y Err:1 http://gb.archive.ubuntu.com/ubuntu impish/universe amd64 libdc1394-25 amd64 2.2.6-3 404 Not Found [IP: 185.125.190.36 80] Ign:2 http://gb.archive.ubuntu.com/ubuntu impish/universe amd64 libopenal-data all 1:1.19.1-2 Err:3 http://gb.archive.ubuntu.com/ubuntu impish/universe amd64 libopenal1 amd64 1:1.19.1-2 404 Not Found [IP: 185.125.190.36 80] Ign:4 http://gb.archive.ubuntu.com/ubuntu impish-updates/main amd64 libsdl2-2.0-0 amd64 2.0.14+dfsg2-3ubuntu0.1 Ign:5 http://gb.archive.ubuntu.com/ubuntu impish-updates/universe amd64 libavdevice58 amd64 7:4.4.2-0ubuntu0.21.10.1 Ign:6 http://gb.archive.ubuntu.com/ubuntu impish-updates/universe amd64 ffmpeg amd64 7:4.4.2-0ubuntu0.21.10.1 Err:2 http://gb.archive.ubuntu.com/ubuntu impish/universe amd64 libopenal-data all 1:1.19.1-2 404 Not Found [IP: 185.125.190.36 80] Err:4 http://security.ubuntu.com/ubuntu impish-updates/main amd64 libsdl2-2.0-0 amd64 2.0.14+dfsg2-3ubuntu0.1 404 Not Found [IP: 185.125.190.36 80] Err:5 http://security.ubuntu.com/ubuntu impish-updates/universe amd64 libavdevice58 amd64 7:4.4.2-0ubuntu0.21.10.1 404 Not Found [IP: 185.125.190.36 80] Err:6 http://security.ubuntu.com/ubuntu impish-updates/universe amd64 ffmpeg amd64 7:4.4.2-0ubuntu0.21.10.1 404 Not Found [IP: 185.125.190.36 80] E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/pool/universe/libd/libdc1394/libdc1394-25_2.2.6-3_amd64.deb 404 Not Found [IP: 185.125.190.36 80] E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/pool/universe/o/openal-soft/libopenal-data_1.19.1-2_all.deb 404 Not Found [IP: 185.125.190.36 80] E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/pool/universe/o/openal-soft/libopenal1_1.19.1-2_amd64.deb 404 Not Found [IP: 185.125.190.36 80] E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libs/libsdl2/libsdl2-2.0-0_2.0.14%2bdfsg2-3ubuntu0.1_amd64.deb 404 Not Found [IP: 185.125.190.36 80] E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/f/ffmpeg/libavdevice58_4.4.2-0ubuntu0.21.10.1_amd64.deb 404 Not Found [IP: 185.125.190.36 80] E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/f/ffmpeg/ffmpeg_4.4.2-0ubuntu0.21.10.1_amd64.deb 404 Not Found [IP: 185.125.190.36 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
使用--fix-missing参数也无法解决问题,当前系统为Ubuntu 21.10,无法通过APT安装任何新软件包。
解决方法
核心原因
Ubuntu 21.10(代号Impish Indri)已经终止官方支持(EOL),官方将其源迁移到了归档服务器,原有的gb.archive.ubuntu.com、security.ubuntu.com等地址不再提供该版本的软件包,导致出现404和Release文件缺失错误。此外第三方源(如Spotify、MiKTeX)的密钥过期或失效,也会干扰APT更新。
步骤1:备份原有源配置
先备份当前的源列表,防止操作出错:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo cp -r /etc/apt/sources.list.d /etc/apt/sources.list.d.bak
步骤2:替换官方源为归档源
编辑主源文件:
sudo nano /etc/apt/sources.list
将文件中所有的http://gb.archive.ubuntu.com/ubuntu和http://security.ubuntu.com/ubuntu替换为http://old-releases.ubuntu.com/ubuntu。
替换完成后,按Ctrl+O保存,Ctrl+X退出编辑器。
步骤3:清理第三方源(可选但推荐)
第三方源(如Spotify、MiKTeX)可能因为系统EOL无法正常更新,建议暂时移除这些源以避免干扰:
# 列出所有第三方源文件 ls /etc/apt/sources.list.d/ # 删除对应的源文件,例如: sudo rm /etc/apt/sources.list.d/spotify.list sudo rm /etc/apt/sources.list.d/miktex.list
步骤4:更新APT缓存并安装FFmpeg
执行以下命令更新缓存并安装FFmpeg:
sudo apt update sudo apt install ffmpeg
额外建议
如果条件允许,建议升级到Ubuntu长期支持版本(如22.04 LTS或更高),长期支持版本会提供5年的安全更新和维护,避免类似的源失效问题。
内容的提问来源于stack exchange,提问作者Robbie Mallett

