解决Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'xxx' doesn't support architecture 'i386'

本文最后更新于:2022年10月4日 晚上

安装1.22版nginx的时候遇到了个问题。编辑 /etc/apt/sources.list.d/nginx.list 的时候加进去的库,在 apt update 的时候报错:

1
N: Skipping acquire of configured file 'nginx/binary-i386/Packages' as repository 'http://nginx.org/packages/ubuntu focal InRelease' doesn't support architecture 'i386'

解决办法1

首先找到的解决办法是在 nginx.list 指定arch为amd,也就是:

1
2
3
echo "deb [arch=amd64] [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list

但这样运行 apt update 依然会报错

1
2
E: Malformed entry 1 in list file /etc/apt/sources.list.d/nginx.list (URI parse)
E: The list of sources could not be read.

根本解决办法

参考链接

解决步骤

先找到出问题的库,比如说 repository 'xxx' doesn't support architecture 'i386' ,那么我们就运行:

1
2
3
4
cd /etc/apt/sources.list.d
grep -r xxx(出问题的库) /etc/apt | grep -v amd64
# 或者
grep xxx(出问题的库) * | grep -v amd64

例如我这里可以用

1
2
3
4
cd /etc/apt/sources.list.d
grep nginx * | grep -v amd64
# 或者
grep nginx * | grep -v amd64

输出:

1
/etc/apt/sources.list.d/nginx.list:deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu focal nginx

那么我们就得到了.list文件名+路径 : /etc/apt/sources.list.d/nginx.list

这个就是出问题的。可以先试试在这个文件里面加上 [arch=amd64]

例如我的例子,编辑 /etc/apt/sources.list.d/nginx.list 文件为:

1
deb [arch=amd64] [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu focal nginx

我这样失败了。因为这个语法会被判定为木马,那我们先取消这个解决办法,来找找根本原因

根本原因

1
2
3
4
# 查看本机的架构内核
dpkg --print-architecture
# 查看多架构支持内核
dpkg --print-foreign-architectures

第二条命令输出i386是让64位ubuntu运行32位程序,也就是多架构支持。也就是这个地方,导致了我们会出现这样的报错。

如果你不想要多架构支持,可以移除。

1
dpkg --remove-architecture i386

之后再运行 apt update 即可。


解决Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'xxx' doesn't support architecture 'i386'
https://pawswrite.xyz/posts/47269.html
作者
Rainbow
发布于
2022年8月4日
许可协议