Windows 11 WSL。安装 JDK 11 导致错误:404 未找到。
wsl> sudo apt install openjdk-11-jdk-headless
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
alsa-topology-conf alsa-ucm-conf ca-certificates-java fontconfig-config fonts-dejavu-core java-common libasound2 libasound2-data
libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfontconfig1 libfreetype6 libgraphite2-3 libharfbuzz0b
libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 openjdk-11-jre-headless
Suggested packages:
default-jre libasound2-plugins alsa-utils cups-common liblcms2-utils pcscd openjdk-11-demo openjdk-11-source libnss-mdns
fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
The following NEW packages will be installed:
alsa-topology-conf alsa-ucm-conf ca-certificates-java fontconfig-config fonts-dejavu-core java-common libasound2 libasound2-data
libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfontconfig1 libfreetype6 libgraphite2-3 libharfbuzz0b
libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 openjdk-11-jdk-headless openjdk-11-jre-headless
0 upgraded, 24 newly installed, 0 to remove and 0 not upgraded.
Need to get 260 MB of archives.
After this operation, 410 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 alsa-topology-conf all 1.2.5.1-2 [15.5 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libasound2-data all 1.2.6.1-1ubuntu1 [19.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 libasound2 amd64 1.2.6.1-1ubuntu1 [390 kB]
Err:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 alsa-ucm-conf all 1.2.6.3-1ubuntu1.1
404 Not Found [IP: 91.189.91.83 80]
Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 java-common all 0.72build2 [6782 B]
Get:6 http://archive.ubuntu.com/ubuntu jammy/main amd64 libavahi-common-data amd64 0.8-5ubuntu5 [23.9 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 libavahi-common3 amd64 0.8-5ubuntu5 [23.7 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 libavahi-client3 amd64 0.8-5ubuntu5 [28.1 kB]
Ign:9 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libcups2 amd64 2.4.1op1-1ubuntu4.1
Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 liblcms2-2 amd64 2.12~rc1-2build2 [159 kB]
Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 libjpeg-turbo8 amd64 2.1.2-0ubuntu1 [134 kB]
Err:9 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 libcups2 amd64 2.4.1op1-1ubuntu4.1
404 Not Found [IP: 91.189.91.83 80]
答案1
Apt 使用本地缓存来加速获取新软件包。此软件包可能会过期。
列表的位置
/var/lib/apt/lists
什么更新
Manpage 上对此有说明:
update (apt-get(8))
update is used to download package information from all configured sources. Other commands operate on this data to e.g. perform package
upgrades or search in and display details about all packages available for installation.
大多数情况下,当使用不同的来源或改变它时,建议在之前运行清理
clean
clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and
/var/cache/apt/archives/partial/.
为什么现在解决了 404 错误?
我们必须调查Packages
为了减少混淆,我使用以下一个包:
Package: libasound2-data
Source: alsa-lib
Version: 1.2.8-1
Installed-Size: 200
Maintainer: Debian ALSA Maintainers <[email protected]>
Architecture: all
Replaces: libasound2 (<< 1.2.8-1)
Recommends: alsa-ucm-conf, alsa-topology-conf
Suggests: alsa-utils
Breaks: libasound2 (<< 1.2.8-1)
Description: Configuration files and profiles for ALSA drivers
Multi-Arch: foreign
Homepage: https://www.alsa-project.org/
Description-md5: 41f916f1c1cbcf480b3b7fe38fbcef23
Tag: role::shared-lib
Section: libs
Priority: optional
Filename: pool/main/a/alsa-lib/libasound2-data_1.2.8-1_all.deb
Size: 20488
MD5sum: 8cdd32445982638bf5d024453da19673
SHA256: fe0780d2d3674b2977e0acb0d48b448ad72ba1642564b7dc537f55e839984c2d
它告诉 apt,该文件位于pool/main/a/alsa-lib/libasound2-data_1.2.8-1_all.deb
apt update
但也有可能发生这种情况,即该文件已被另一个版本替换,现在可能不可用。这就是为什么在安装软件包之前定期执行如此重要的原因。