![Apt 下载带有编码字符的文件](https://linux22.com/image/1195291/Apt%20%E4%B8%8B%E8%BD%BD%E5%B8%A6%E6%9C%89%E7%BC%96%E7%A0%81%E5%AD%97%E7%AC%A6%E7%9A%84%E6%96%87%E4%BB%B6.png)
我维护着几台无法访问互联网的 Ubuntu 服务器,因此无法连接到任何公共存储库。为了使我们的实例保持更新,我运行了一个脚本,该脚本基本上只下载已安装的软件包和任何依赖项,以使文件传输尽可能小(而不是下载整个存储库的镜像)。
这种方法已经运行了大约 5-6 年 (16.04LTS、18.04LTS、20.04LTS 以及现在的 22.04LTS),但在过去的 2 个月内,我注意到一些软件包在下载和保存时,\var\cache\apt\archives
文件名中带有编码字符。
vim_2%253a8.2.3995-1ubuntu2.5_amd64.deb
举 个例子,我看到:
xauth_1%253a1.1-1build2_amd64.deb
当我将这些包加载到本地存储库并从客户端运行 apt 时,这会导致问题。这些包的 HTTP 通信失败,我被迫apt --skip-broken
单独运行并安装这些包。
虽然我知道我可以更改文件名并使用修改后的名称创建 repofile,但我希望有一个更简单的修复或简单的解决方案来解决我做错的事情或可能发生变化的地方。感谢您提供的任何帮助!!
目前发生的情况是Ubuntu 22.04LTS。
编辑:在出现此问题之前,我刚刚查看了 2022 年 11 月下载的文件,并确认文件名始终包含这些编码字符……但看起来 apt 在过去几个月内对这些特定文件的处理方式不同。
附加信息:
- 这至少发生在两个不同的网络上(以及两个使用相同配置的不同本地存储库)。
%
文件路径中带有 的几个包都发生了这种情况。
更新:完整输出如下。
root@vsite01-splsyslg:~# sudo apt update
Get:1 http://localrepo/2204 InRelease [1,912 B]
Get:2 http://localrepo/2204 Packages [285 kB]
Fetched 287 kB in 1s (445 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
107 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: http://localrepo/2204/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
root@vsite01-splsyslg:~# sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-5.15.0-75 linux-headers-5.15.0-75-generic linux-image-5.15.0-75-generic linux-modules-5.15.0-75-generic linux-modules-extra-5.15.0-75-generic
The following packages will be upgraded:
apparmor apport apt apt-utils bind9-dnsutils bind9-host bind9-libs binutils binutils-common binutils-x86-64-linux-gnu ca-certificates cloud-init curl distro-info-data dpkg fwupd fwupd-signed git git-man grub-common grub2-common
iptables libapparmor1 libapt-pkg6.0 libbinutils libcap2 libcap2-bin libctf-nobfd0 libctf0 libcurl3-gnutls libcurl4 libfreetype6 libfwupd2 libfwupdplugin5 libglib2.0-0 libglib2.0-bin libglib2.0-data libgssapi-krb5-2 libip4tc2
libip6tc2 libk5crypto3 libkrb5-3 libkrb5support0 libldap-2.5-0 libldap-common libncurses6 libncursesw6 libnetplan0 libnss-systemd libnss3 libpam-cap libpam-systemd libperl5.34 libpython3.10 libpython3.10-minimal
libpython3.10-stdlib libssh-4 libssl3 libsystemd0 libtinfo6 libudev1 libx11-6 libx11-data libxml2 libxtables12 linux-firmware linux-generic linux-headers-generic linux-image-generic mdadm ncurses-base ncurses-bin ncurses-term
netplan.io open-vm-tools openssh-client openssh-server openssh-sftp-server openssl perl perl-base perl-modules-5.34 python3-apport python3-distupgrade python3-problem-report python3-requests python3-software-properties python3-tz
python3.10 python3.10-minimal snapd software-properties-common sudo systemd systemd-sysv thermald tzdata ubuntu-advantage-tools ubuntu-drivers-common ubuntu-release-upgrader-core udev update-notifier-common vim vim-common
vim-runtime vim-tiny xxd
107 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 456 MB of archives.
After this operation, 624 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://localrepo/2204 libsystemd0 249.11-0ubuntu3.9 [318 kB]
Get:2 http://localrepo/2204 libnss-systemd 249.11-0ubuntu3.9 [133 kB]
Get:3 http://localrepo/2204 systemd-sysv 249.11-0ubuntu3.9 [10.5 kB]
Get:4 http://localrepo/2204 libpam-systemd 249.11-0ubuntu3.9 [203 kB]
Get:5 http://localrepo/2204 systemd 249.11-0ubuntu3.9 [4,581 kB]
Get:6 http://localrepo/2204 udev 249.11-0ubuntu3.9 [1,557 kB]
Get:7 http://localrepo/2204 libudev1 249.11-0ubuntu3.9 [77.1 kB]
Err:8 http://localrepo/2204 libcap2 1:2.44-1ubuntu0.22.04.1
404 Not Found [IP: localrepo 80]
Get:9 http://localrepo/2204 libapparmor1 3.0.4-2ubuntu2.2 [39.2 kB]
Get:10 http://localrepo/2204 libxtables12 1.8.7-1ubuntu5.1 [31.2 kB]
Get:11 http://localrepo/2204 iptables 1.8.7-1ubuntu5.1 [455 kB]
Get:12 http://localrepo/2204 libip6tc2 1.8.7-1ubuntu5.1 [20.2 kB]
Get:13 http://localrepo/2204 libip4tc2 1.8.7-1ubuntu5.1 [19.8 kB]
Get:14 http://localrepo/2204 libssl3 3.0.2-0ubuntu1.10 [1,901 kB]
Get:15 http://localrepo/2204 libapt-pkg6.0 2.4.9 [906 kB]
Get:16 http://localrepo/2204 dpkg 1.21.1ubuntu2.2 [1,239 kB]
Get:17 http://localrepo/2204 ncurses-bin 6.3-2ubuntu0.1 [184 kB]
Get:18 http://localrepo/2204 libperl5.34 5.34.0-3ubuntu1.2 [4,818 kB]
Get:19 http://localrepo/2204 perl 5.34.0-3ubuntu1.2 [232 kB]
Get:20 http://localrepo/2204 perl-base 5.34.0-3ubuntu1.2 [1,759 kB]
Get:21 http://localrepo/2204 perl-modules-5.34 5.34.0-3ubuntu1.2 [2,977 kB]
Get:22 http://localrepo/2204 ncurses-base 6.3-2ubuntu0.1 [20.2 kB]
Get:23 http://localrepo/2204 apt 2.4.9 [1,379 kB]
Get:24 http://localrepo/2204 apt-utils 2.4.9 [211 kB]
Get:25 http://localrepo/2204 libglib2.0-data 2.72.4-0ubuntu2.2 [4,612 B]
Get:26 http://localrepo/2204 libglib2.0-bin 2.72.4-0ubuntu2.2 [80.9 kB]
Get:27 http://localrepo/2204 libglib2.0-0 2.72.4-0ubuntu2.2 [1,463 kB]
Get:28 http://localrepo/2204 libxml2 2.9.13+dfsg-1ubuntu0.3 [763 kB]
Err:29 http://localrepo/2204 open-vm-tools 2:12.1.5-3~ubuntu0.22.04.1
404 Not Found [IP: localrepo 80]
Get:30 http://localrepo/2204 libk5crypto3 1.19.2-2ubuntu0.2 [86.3 kB]
Get:31 http://localrepo/2204 libkrb5support0 1.19.2-2ubuntu0.2 [32.3 kB]
Get:32 http://localrepo/2204 libkrb5-3 1.19.2-2ubuntu0.2 [357 kB]
Get:33 http://localrepo/2204 libgssapi-krb5-2 1.19.2-2ubuntu0.2 [145 kB]
Get:34 http://localrepo/2204 libldap-2.5-0 2.5.14+dfsg-0ubuntu0.22.04.2 [183 kB]
Get:35 http://localrepo/2204 libssh-4 0.9.6-2ubuntu0.22.04.1 [185 kB]
Get:36 http://localrepo/2204 libcurl3-gnutls 7.81.0-1ubuntu1.10 [285 kB]
Err:37 http://localrepo/2204 git-man 1:2.34.1-1ubuntu1.9
404 Not Found [IP: localrepo 80]
Err:38 http://localrepo/2204 git 1:2.34.1-1ubuntu1.9
404 Not Found [IP: localrepo 80]
Err:39 http://localrepo/2204 openssh-sftp-server 1:8.9p1-3ubuntu0.1
404 Not Found [IP: localrepo 80]
Err:40 http://localrepo/2204 openssh-server 1:8.9p1-3ubuntu0.1
404 Not Found [IP: localrepo 80]
Err:41 http://localrepo/2204 openssh-client 1:8.9p1-3ubuntu0.1
404 Not Found [IP: localrepo 80]
Get:42 http://localrepo/2204 libpython3.10 3.10.6-1~22.04.2ubuntu1.1 [1,955 kB]
Get:43 http://localrepo/2204 python3.10 3.10.6-1~22.04.2ubuntu1.1 [497 kB]
Get:44 http://localrepo/2204 libpython3.10-stdlib 3.10.6-1~22.04.2ubuntu1.1 [1,832 kB]
Get:45 http://localrepo/2204 python3.10-minimal 3.10.6-1~22.04.2ubuntu1.1 [2,262 kB]
Get:46 http://localrepo/2204 libpython3.10-minimal 3.10.6-1~22.04.2ubuntu1.1 [810 kB]
Get:47 http://localrepo/2204 libncurses6 6.3-2ubuntu0.1 [111 kB]
Get:48 http://localrepo/2204 libncursesw6 6.3-2ubuntu0.1 [147 kB]
Get:49 http://localrepo/2204 libtinfo6 6.3-2ubuntu0.1 [105 kB]
Err:50 http://localrepo/2204 ubuntu-drivers-common 1:0.9.6.2~0.22.04.3
404 Not Found [IP: localrepo 80]
Get:51 http://localrepo/2204 update-notifier-common 3.192.54.6 [185 kB]
Get:52 http://localrepo/2204 tzdata 2023c-0ubuntu0.22.04.2 [349 kB]
Err:53 http://localrepo/2204 libpam-cap 1:2.44-1ubuntu0.22.04.1
404 Not Found [IP: localrepo 80]
Err:54 http://localrepo/2204 libcap2-bin 1:2.44-1ubuntu0.22.04.1
404 Not Found [IP: localrepo 80]
Get:55 http://localrepo/2204 ubuntu-advantage-tools 27.14.4~22.04 [171 kB]
Err:56 http://localrepo/2204 vim 2:8.2.3995-1ubuntu2.8
404 Not Found [IP: localrepo 80]
Err:57 http://localrepo/2204 vim-tiny 2:8.2.3995-1ubuntu2.8
404 Not Found [IP: localrepo 80]
Err:58 http://localrepo/2204 vim-runtime 2:8.2.3995-1ubuntu2.8
404 Not Found [IP: localrepo 80]
Err:59 http://localrepo/2204 xxd 2:8.2.3995-1ubuntu2.8
404 Not Found [IP: localrepo 80]
Err:60 http://localrepo/2204 vim-common 2:8.2.3995-1ubuntu2.8
404 Not Found [IP: localrepo 80]
Err:61 http://localrepo/2204 bind9-dnsutils 1:9.18.12-0ubuntu0.22.04.1
404 Not Found [IP: localrepo 80]
Err:62 http://localrepo/2204 bind9-host 1:9.18.12-0ubuntu0.22.04.1
404 Not Found [IP: localrepo 80]
Err:63 http://localrepo/2204 bind9-libs 1:9.18.12-0ubuntu0.22.04.1
404 Not Found [IP: localrepo 80]
Get:64 http://localrepo/2204 openssl 3.0.2-0ubuntu1.10 [1,183 kB]
Get:65 http://localrepo/2204 ca-certificates 20230311ubuntu0.22.04.1 [155 kB]
Get:66 http://localrepo/2204 ncurses-term 6.3-2ubuntu0.1 [267 kB]
Get:67 http://localrepo/2204 apparmor 3.0.4-2ubuntu2.2 [595 kB]
Get:68 http://localrepo/2204 grub2-common 2.06-2ubuntu7.2 [652 kB]
Get:69 http://localrepo/2204 libfreetype6 2.11.1+dfsg-1ubuntu0.2 [389 kB]
Get:70 http://localrepo/2204 grub-common 2.06-2ubuntu7.2 [2,214 kB]
Get:71 http://localrepo/2204 python3-problem-report 2.20.11-0ubuntu82.5 [11.1 kB]
Get:72 http://localrepo/2204 python3-apport 2.20.11-0ubuntu82.5 [88.9 kB]
Get:73 http://localrepo/2204 apport 2.20.11-0ubuntu82.5 [133 kB]
Get:74 http://localrepo/2204 libctf0 2.38-4ubuntu2.2 [103 kB]
Get:75 http://localrepo/2204 libctf-nobfd0 2.38-4ubuntu2.2 [107 kB]
Get:76 http://localrepo/2204 binutils-x86-64-linux-gnu 2.38-4ubuntu2.2 [2,328 kB]
Get:77 http://localrepo/2204 libbinutils 2.38-4ubuntu2.2 [660 kB]
Get:78 http://localrepo/2204 binutils 2.38-4ubuntu2.2 [3,186 B]
Get:79 http://localrepo/2204 binutils-common 2.38-4ubuntu2.2 [222 kB]
Get:80 http://localrepo/2204 netplan.io 0.105-0ubuntu2~22.04.3 [92.9 kB]
Get:81 http://localrepo/2204 libnetplan0 0.105-0ubuntu2~22.04.3 [103 kB]
Get:82 http://localrepo/2204 python3-requests 2.25.1+dfsg-2ubuntu0.1 [48.8 kB]
Get:83 http://localrepo/2204 cloud-init 23.1.2-0ubuntu0~22.04.1 [531 kB]
Get:84 http://localrepo/2204 curl 7.81.0-1ubuntu1.10 [194 kB]
Get:85 http://localrepo/2204 libcurl4 7.81.0-1ubuntu1.10 [290 kB]
Get:86 http://localrepo/2204 distro-info-data 0.52ubuntu0.4 [4,986 B]
Get:87 http://localrepo/2204 fwupd 1.7.9-1~22.04.3 [2,562 kB]
Get:88 http://localrepo/2204 libfwupdplugin5 1.7.9-1~22.04.3 [191 kB]
Get:89 http://localrepo/2204 libfwupd2 1.7.9-1~22.04.3 [106 kB]
Get:90 http://localrepo/2204 fwupd-signed 1.51.1~22.04.1+1.4-0ubuntu0.1 [30.3 kB]
Get:91 http://localrepo/2204 libldap-common 2.5.14+dfsg-0ubuntu0.22.04.2 [15.8 kB]
Err:92 http://localrepo/2204 libnss3 2:3.68.2-0ubuntu1.2
404 Not Found [IP: localrepo 80]
Err:93 http://localrepo/2204 libx11-data 2:1.7.5-1ubuntu0.2
404 Not Found [IP: localrepo 80]
Err:94 http://localrepo/2204 libx11-6 2:1.7.5-1ubuntu0.2
404 Not Found [IP: localrepo 80]
Get:95 http://localrepo/2204 linux-firmware 20220329.git681281e4-0ubuntu3.13 [249 MB]
Get:96 http://localrepo/2204 linux-modules-5.15.0-75-generic 5.15.0-75.82 [23.2 MB]
Get:97 http://localrepo/2204 linux-image-5.15.0-75-generic 5.15.0-75.82 [11.4 MB]
Get:98 http://localrepo/2204 linux-modules-extra-5.15.0-75-generic 5.15.0-75.82 [64.2 MB]
Get:99 http://localrepo/2204 linux-generic 5.15.0.75.73 [1,700 B]
Get:100 http://localrepo/2204 linux-image-generic 5.15.0.75.73 [2,510 B]
Get:101 http://localrepo/2204 linux-headers-5.15.0-75 5.15.0-75.82 [12.3 MB]
Get:102 http://localrepo/2204 linux-headers-5.15.0-75-generic 5.15.0-75.82 [2,904 kB]
Get:103 http://localrepo/2204 linux-headers-generic 5.15.0.75.73 [2,358 B]
Get:104 http://localrepo/2204 mdadm 4.2-0ubuntu2 [464 kB]
Err:105 http://localrepo/2204 ubuntu-release-upgrader-core 1:22.04.16
404 Not Found [IP: localrepo 80]
Err:106 http://localrepo/2204 python3-distupgrade 1:22.04.16
404 Not Found [IP: localrepo 80]
Get:107 http://localrepo/2204 software-properties-common 0.99.22.7 [14.1 kB]
Get:108 http://localrepo/2204 python3-software-properties 0.99.22.7 [28.8 kB]
Get:109 http://localrepo/2204 python3-tz 2022.1-1ubuntu0.22.04.1 [30.7 kB]
Get:110 http://localrepo/2204 snapd 2.58+22.04.1 [23.8 MB]
Get:111 http://localrepo/2204 sudo 1.9.9-1ubuntu2.4 [821 kB]
Get:112 http://localrepo/2204 thermald 2.4.9-1ubuntu0.2 [212 kB]
Fetched 437 MB in 9s (49.6 MB/s)
E: Failed to fetch http://localrepo/2204/./libcap2_1%253a2.44-1ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./open-vm-tools_2%253a12.1.5-3%7eubuntu0.22.04.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./git-man_1%253a2.34.1-1ubuntu1.9_all.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./git_1%253a2.34.1-1ubuntu1.9_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./openssh-sftp-server_1%253a8.9p1-3ubuntu0.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./openssh-server_1%253a8.9p1-3ubuntu0.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./openssh-client_1%253a8.9p1-3ubuntu0.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./ubuntu-drivers-common_1%253a0.9.6.2%7e0.22.04.3_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./libpam-cap_1%253a2.44-1ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./libcap2-bin_1%253a2.44-1ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./vim_2%253a8.2.3995-1ubuntu2.8_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./vim-tiny_2%253a8.2.3995-1ubuntu2.8_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./vim-runtime_2%253a8.2.3995-1ubuntu2.8_all.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./xxd_2%253a8.2.3995-1ubuntu2.8_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./vim-common_2%253a8.2.3995-1ubuntu2.8_all.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./bind9-dnsutils_1%253a9.18.12-0ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./bind9-host_1%253a9.18.12-0ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./bind9-libs_1%253a9.18.12-0ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./libnss3_2%253a3.68.2-0ubuntu1.2_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./libx11-data_2%253a1.7.5-1ubuntu0.2_all.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./libx11-6_2%253a1.7.5-1ubuntu0.2_amd64.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./ubuntu-release-upgrader-core_1%253a22.04.16_all.deb 404 Not Found [IP: localrepo 80]
E: Failed to fetch http://localrepo/2204/./python3-distupgrade_1%253a22.04.16_all.deb 404 Not Found [IP: localrepo 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?