apt 正在(未成功)寻找使用 apt-mirror 设置的 arm64 repo 上的 Components-amd64.yml

apt 正在(未成功)寻找使用 apt-mirror 设置的 arm64 repo 上的 Components-amd64.yml

复制:

安装CentOS 7服务器,然后通过debootstrap部署Ubuntu 18.04环境:

yum install epel-release
yum install debootsrap
mkdir /opt/ubuntu-18.04
ln -s /opt/ubuntu-18.04 /opt/ubuntu
debootstrap --arch=amd64 bionic /opt/ubuntu http://de.archive.ubuntu.com/ubuntu/

进入 chroot:

chroot /opt/ubuntu

安装 apt-mirror:

apt install software-properties-common
add-apt-repository universe
apt install apt-mirror

/etc/apt/mirror.list为多种架构设置。bionic-updatesbionic-backports,以及restricteduniversemultiverse被省略以加快测试速度:

set nthreads     20
set _tilde 0

deb-i386  http://archive.ubuntu.com/ubuntu bionic main
# restricted universe multiverse
deb-amd64 http://archive.ubuntu.com/ubuntu bionic main
# restricted universe multiverse
deb-arm64 http://ports.ubuntu.com/ubuntu-ports bionic main
# restricted universe multiverse

#deb-i386  http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
#deb-amd64 http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
#deb-arm64 http://ports.ubuntu.com/ubuntu-ports bionic-updates main restricted universe multiverse

#deb-i386  http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
#deb-amd64 http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
#deb-arm64 http://ports.ubuntu.com/ubuntu-ports bionic-backports main restricted universe multiverse

clean http://archive.ubuntu.com/ubuntu
clean http://ports.ubuntu.com/ubuntu-ports

执行同步:

sudo -u apt-mirror apt-mirror

设置您选择的 HTTP 服务器(我使用 nginx),目录结构如下:

# ls -al /var/www/html
total 62100
drwxr-xr-x. 3 nginx nginx     4096 Jul  2 13:54 .
drwxr-xr-x. 3 nginx nginx     4096 Jul  1 20:10 ..
drwxr-xr-x. 2 root  root      4096 Jul  1 17:42 seed
lrwxrwxrwx. 1 root  root        65 Jul  1 20:10 ubuntu -> /opt/ubuntu/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu
-rw-r--r--. 1 root  root  63564717 Jul  1 17:43 ubuntu-18.04-netinstall.zip
lrwxrwxrwx. 1 root  root        69 Jul  2 13:54 ubuntu-ports -> /opt/ubuntu/var/spool/apt-mirror/mirror/ports.ubuntu.com/ubuntu-ports

在您的 Ubuntu 18.04 桌面客户端上进行设置/etc/apt/sources.list。相同的内容被遗漏了,但它们的行为方式相同,并且-updates-backports导致 3 个文件丢失并返回 404:

# Security

deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ bionic-security main restricted universe multiverse

# Internal mirror

deb [arch=amd64,i386] https://apt.foobar.com/ubuntu bionic main
# restricted universe multiverse
#deb [arch=amd64,i386] https://apt.foobar.com/ubuntu bionic-updates main restricted universe multiverse
#deb [arch=amd64,i386] https://apt.foobar.com/ubuntu bionic-backports main restricted universe multiverse

deb [arch=arm64] https://apt.foobar.com/ubuntu-ports bionic main
# restricted universe multiverse
#deb [arch=arm64] https://apt.foobar.com/ubuntu-ports bionic-updates main restricted universe multiverse
#deb [arch=arm64] https://apt.foobar.com/ubuntu-ports bionic-backports main restricted universe multiverse

# Canonical fallback mirror

deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse

deb [arch=arm64] http://ports.ubuntu.com/ bionic main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse

现在执行apt update(与的结果相同apt-get update):

# apt update
Get:1 https://apt.foobar.com/ubuntu bionic InRelease [242 kB]
Get:2 https://apt.foobar.com/ubuntu-ports bionic InRelease [242 kB]                                                                      
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease                                                                                    
Hit:4 http://ports.ubuntu.com bionic-security InRelease                                                                    
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88,7 kB]                                                  
Hit:6 http://ports.ubuntu.com bionic InRelease                                                                                        
Hit:7 http://ports.ubuntu.com bionic-updates InRelease                                                                                
Hit:8 http://ports.ubuntu.com bionic-backports InRelease                                                  
Get:9 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74,6 kB]
Get:10 https://apt.foobar.com/ubuntu-ports bionic/main arm64 Packages [975 kB]    
Get:11 http://security.ubuntu.com/ubuntu bionic-security InRelease [88,7 kB]         
Get:12 https://apt.foobar.com/ubuntu-ports bionic/main Translation-en [516 kB]           
Get:13 https://apt.foobar.com/ubuntu-ports bionic/main amd64 DEP-11 Metadata [477 kB]    
Get:13 https://apt.foobar.com/ubuntu-ports bionic/main amd64 DEP-11 Metadata [477 kB]    
Ign:13 https://apt.foobar.com/ubuntu-ports bionic/main amd64 DEP-11 Metadata                                       
Ign:13 https://apt.foobar.com/ubuntu-ports bionic/main amd64 DEP-11 Metadata                                   
Ign:13 https://apt.foobar.com/ubuntu-ports bionic/main amd64 DEP-11 Metadata             
Err:13 https://apt.foobar.com/ubuntu-ports bionic/main amd64 DEP-11 Metadata             
  404  Not Found [IP: 10.1.3.96 443]
Fetched 494 kB in 1s (659 kB/s)                                                              
Reading package lists... Done
E: Failed to fetch https://apt.foobar.com/ubuntu-ports/dists/bionic/main/dep11/Components-amd64.yml  404  Not Found [IP: 10.1.3.96 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.

#ubuntu 上有一个提示,这是因为文件ubuntu-ports/dists/bionic/Release列出了Components-amd64.yml。现在,问题在于它也列在官方 ports.ubuntu.com 文件中,并且该文件夹结构Components-amd64.yml也没有,但是,apt update只给出了本地镜像的 404 错误。

我们已经在几个客户端上使用这个本地镜像和 amd64/i386 包成功了,只有 arm64 repo 文件会出现这个错误。

我做错了什么?为什么 apt 在 arm64 repo 上寻找 amd64 文件?


更新:在摆弄了 debmirror 之后我得到了完全一样问题。此时我开始怀疑这是客户端的问题。深入研究后,/etc/apt我在 中找到了以下摘录/etc/apt/apt.conf.d/50appstream

    # The YAML metadata files
    deb::DEP-11  {
        MetaKey "$(COMPONENT)/dep11/Components-$(NATIVE_ARCHITECTURE).yml";
        ShortDescription "Components-$(NATIVE_ARCHITECTURE)";
        Description "$(RELEASE)/$(COMPONENT) $(NATIVE_ARCHITECTURE) DEP-11 Metadata";

        KeepCompressed "true";
        KeepCompressedAs "gz";
    };

尝试这个:

sed -i 's/NATIVE_ARCHITECTURE/ARCHITECTURE/' /etc/apt/apt.conf.d/50appstream

问题apt update都消失了。有人能确认这确实是 Ubuntu 的一个错误并且这确实是解决它的方法吗?

相关内容