关于局域网内Ubuntu客户端使用apt从局域网内Ubuntu镜像服务器拉取软件失败的问题。
将Ubuntu客户端上/etc/apt/source.list中的链接改为局域网内镜像服务器的IP地址,但是在更新时系统报错。
使用apt-mirror在局域网中配置了一台Ubuntu镜像服务器供局域网内其他设备使用,但是发现在Ubuntu终端上输入
sudo apt-get update
后,终端提示如下错误
E: Failed to fetch http://172.6.0.2/ubuntu/dists/jammy/main/binary-i386/Packages 404 Not Found [IP: 172.6.0.2 80]
E: Failed to fetch http://172.6.0.2/ubuntu/dists/jammy-updates/main/binary-i386/Packages 404 Not Found [IP: 172.6.0.2 80]
E: Failed to fetch http://172.6.0.2/ubuntu/dists/jammy-backports/universe/binary-i386/Packages 404 Not Found [IP: 172.6.0.2 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
简单翻译一下可以知道,上面错误是在更新i386架构的包时出的错误,所以采用如下方法解决
1、查看系统支持的其他架构
dpkg --print-foreign-architectures
输入上面指令后会看到终端回显
i386
说明系统还支持其他i386架构,所以对其进行移除操作
2、移除i386架构
终端输入
dpkg --remove-architecture i386
在移除过程中,终端回显
dpkg: error: cannot remove architecture 'i386' currently in use by the database
这是因为有些软件是i386的,所以需要先移除i386架构的软件,然后再移除i386架构
apt-get remove .*:i386
dpkg --remove-architecture i386
如果移除过程仍然失败,可以尝试在指令前加sudo,使用超级用户去操作
sudo apt-get remove .*:i386
sudo dpkg --remove-architecture i386
3、移除后再尝试更新
以上操作完成后尝试进行更新,在终端输入
sudo apt-get update
现在可以发现终端没有再报错,终端输入
sudo apt-get install hping3 iperf
可以发现Ubuntu已经能够正常从局域网内配置的镜像服务器上下载安装软件。