龙芯loongarch实验(3)--在x86_64主机上构建debian/loong64根(续1)
  kgYTaWWZjeAa 2023年11月02日 34 0

上篇<构建debian/loong64根>讲到,loongarch才刚刚加入debian ports,少部分软件包(libc6)还没自动构建,导致执行debootstrap后要手工下载缺失的软件包
实际上debootstrap带上 --extra-suites=unreleased 参数就可解决libc6等自动下载安装问题

查看网站https://deb.debian.org/debian-ports/dists/有如下目录 [DIR] experimental [DIR] sid [DIR] unreleased [DIR] unstable

sid等同unstable experimental是实验性质 unreleased我不怎了解 下载https://deb.debian.org/debian-ports/dists/unreleased/main/binary-loong64/Packages.xz看看 libc6就在unreleased的Packages里 或许不久将来libc6应在sid的Packages里

shell提示符

宿主      :  root@debian:~#
loong64根 :  root@debian:/#

一.构建根(2023-10-13) 在上篇<构建debian/loong64根>基础上再加 --extra-suites=unreleased 参数

1.构建

root@debian:~# debootstrap  --no-check-gpg   --arch=loong64  --variant=minbase  --extra-suites=unreleased  sid /home/linlin/vm/debloong64/ http://deb.debian.org/debian-ports
I: Can't verify that target arch works
I: Retrieving InRelease 
I: Retrieving Packages 
...
I: Validating libc-bin 2.37-9+loong64
I: Retrieving libc6 2.37-9+loong64      <= 已找到libc6
I: Validating libc6 2.37-9+loong64
I: Retrieving libmount1 2.38.1-5+loong64
...
I: Configuring libc-bin...
I: Unpacking the base system...
I: Base system installed successfully.  <= 已成功
root@debian:~#

可见已成功构建,无需手工下载

2.切换到loong64根

root@debian:~# chroot /home/linlin/vm/debloong64
root@debian:/#

已正常进入chroot根环境

1)查看软件源

root@debian:/# cat /etc/apt/sources.list
deb http://deb.debian.org/debian-ports sid main
deb http://deb.debian.org/debian-ports unreleased main
root@debian:/# 

2)查看软件包信息文件

root@debian:/# ls -l /var/lib/apt/lists
total 72884
drwxr-xr-x 2 _apt root     4096 Oct 13 03:06 auxfiles
-rw-r--r-- 1 root root    93584 Oct 13 01:22 deb.debian.org_debian-ports_dists_sid_InRelease
-rw-r--r-- 1 root root    91933 Oct 13 02:43 deb.debian.org_debian-ports_dists_sid_Release
-rw-r--r-- 1 root root     1601 Oct 13 02:43 deb.debian.org_debian-ports_dists_sid_Release.gpg
-rw-r--r-- 1 root root 73477890 Oct 13 01:18 deb.debian.org_debian-ports_dists_sid_main_binary-loong64_Packages
-rw-r--r-- 1 root root    62948 Oct 13 01:22 deb.debian.org_debian-ports_dists_unreleased_InRelease
-rw-r--r-- 1 root root    61297 Oct 13 02:56 deb.debian.org_debian-ports_dists_unreleased_Release
-rw-r--r-- 1 root root     1601 Oct 13 02:56 deb.debian.org_debian-ports_dists_unreleased_Release.gpg
-rw-r--r-- 1 root root   823005 Oct 13 00:11 deb.debian.org_debian-ports_dists_unreleased_main_binary-loong64_Packages
-rw-r----- 1 root root        0 Oct 13 03:06 lock
drwx------ 2 _apt root     4096 Oct 13 03:10 partial  <=2023-10-13
root@debian:/# 

两个文件sid_main_binary-loong64_Packages和unreleased_main_binary-loong64_Packages,含有软件包信息内容,如


Package: libc6
Architecture: loong64
Version: 2.37-9+loong64
Multi-Arch: same
Priority: optional
Section: libs
Source: glibc
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Installed-Size: 10802
Depends: libgcc-s1
Recommends: libidn2-0 (>= 2.0.5~)
Suggests: glibc-doc, debconf | debconf-2.0, libc-l10n, locales, libnss-nis, libnss-nisplus
Breaks: chrony (<< 4.2-3~), fakechroot (<< 2.19-3.5), firefox (<< 91~), firefox-esr (<< 91~), gnumach-image-1.8-486 (<< 2:1.8+git20210923~), gnumach-image-1.8-486-dbg (<< 2:1.8+git20210923~), gnumach-image-1.8-xen-486 (<< 2:1.8+git20210923~), gnumach-image-1.8-xen-486-dbg (<< 2:1.8+git20210923~), hurd (<< 1:0.9.git20220301-2), locales (<< 2.37), locales-all (<< 2.37), nscd (<< 2.37), python3-iptables (<< 1.0.0-2), tinydns (<< 1:1.05-14), valgrind (<< 1:3.19.0-1~)
Filename: pool-loong64/main/g/glibc/libc6_2.37-9+loong64_loong64.deb
...

重要信息Filename(文件下载位置)、Depends(软件包依赖关系)

3)更新软件源

root@debian:/# apt-get update
Hit:1 http://deb.debian.org/debian-ports sid InRelease
Hit:2 http://deb.debian.org/debian-ports unreleased InRelease
Err:1 http://deb.debian.org/debian-ports sid InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
Err:2 http://deb.debian.org/debian-ports unreleased InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.debian.org/debian-ports sid InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.debian.org/debian-ports unreleased InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: Failed to fetch http://deb.debian.org/debian-ports/dists/sid/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: Failed to fetch http://deb.debian.org/debian-ports/dists/unreleased/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: Some index files failed to download. They have been ignored, or old ones used instead.
root@debian:/# 

因为没安装debian-ports-archive-keyring_2023.02.01_all.deb,提示NO_PUBKEY出错信息 但安装了debian-ports-archive-keyring后仍有问题(见第三章节),所以本实验不安装,并因此不得不改为完全信任软件源(见第4)小节)

4)信任软件源,不校验 要绕过验证,必须如下操作: 4.1)修改sources.list 加[trusted=yes],完全信任http://deb.debian.org/debian-ports这个源,不会进行证书检查

root@debian:/# cat /etc/apt/sources.list
deb [trusted=yes] http://deb.debian.org/debian-ports sid main
deb [trusted=yes] http://deb.debian.org/debian-ports unreleased main
root@debian:/#

4.2)删除/var/lib/apt/lists/下*.gpg文件

root@debian:/# rm /var/lib/apt/lists/deb.debian.org_debian-ports_dists_sid_Release.gpg
root@debian:/# rm /var/lib/apt/lists/deb.debian.org_debian-ports_dists_unreleased_Release.gpg

4.3)删除/var/lib/apt/lists/下*InRelease文件

root@debian:/# rm /var/lib/apt/lists/deb.debian.org_debian-ports_dists_sid_InRelease
root@debian:/# rm /var/lib/apt/lists/deb.debian.org_debian-ports_dists_unreleased_InRelease

以上就没有验证软件源网站的真伪,请不要用在正式生产环境(为了安全)

二.更新loong64根软件源(2023-10-14) 在构建后的第二天,到http://deb.debian.org/debian-ports/dists/sid/main/binary-loong64/查看有新的Packages是2023-10-14 ... Packages.xz 2023-10-14 01:29 13M ...

1.更新软件源

root@debian:/# apt-get update
Get:1 http://deb.debian.org/debian-ports sid InRelease [93.6 kB]
Get:2 http://deb.debian.org/debian-ports unreleased InRelease [62.9 kB]
Ign:1 http://deb.debian.org/debian-ports sid InRelease
Get:3 http://deb.debian.org/debian-ports sid/main loong64 Packages [13.9 MB]
Ign:2 http://deb.debian.org/debian-ports unreleased InRelease
Get:4 http://deb.debian.org/debian-ports unreleased/main loong64 Packages [225 kB]                                                                                           
Fetched 14.1 MB in 1min 52s (126 kB/s)                                                                                                                                       
Reading package lists... Done
W: GPG error: http://deb.debian.org/debian-ports sid InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: GPG error: http://deb.debian.org/debian-ports unreleased InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
root@debian:/# 

忽略下载InRelease,成功下载Packages 更新已成功,提示警告信息'W: GPG ...'可忽略

2.查看软件包信息文件

root@debian:/# ls -l /var/lib/apt/lists
total 73060
drwxr-xr-x 2 _apt root     4096 Oct 13 03:06 auxfiles
-rw-r--r-- 1 root root    93584 Oct 14 01:33 deb.debian.org_debian-ports_dists_sid_Release
-rw-r--r-- 1 root root 73680668 Oct 14 01:29 deb.debian.org_debian-ports_dists_sid_main_binary-loong64_Packages
-rw-r--r-- 1 root root    62948 Oct 14 01:33 deb.debian.org_debian-ports_dists_unreleased_Release
-rw-r--r-- 1 root root   961193 Oct 14 00:11 deb.debian.org_debian-ports_dists_unreleased_main_binary-loong64_Packages
-rw-r----- 1 root root        0 Oct 13 03:06 lock
drwx------ 2 _apt root     4096 Oct 14 04:14 partial
root@debian:/# 

文件*loong64_Packages已是2023-10-14了

三.问题记录 loong64根安装debian-ports-archive-keyring后,apt-get update总有问题

root@debian:/# ls -l /etc/apt/trusted.gpg.d
总计 92
-rw-r--r-- 1 root root 11861  7月31日 03:24 debian-archive-bookworm-automatic.asc
-rw-r--r-- 1 root root 11873  7月31日 03:24 debian-archive-bookworm-security-automatic.asc
-rw-r--r-- 1 root root   461  7月31日 03:24 debian-archive-bookworm-stable.asc
-rw-r--r-- 1 root root 11861  7月31日 03:24 debian-archive-bullseye-automatic.asc
-rw-r--r-- 1 root root 11873  7月31日 03:24 debian-archive-bullseye-security-automatic.asc
-rw-r--r-- 1 root root  3403  7月31日 03:24 debian-archive-bullseye-stable.asc
-rw-r--r-- 1 root root 11093  7月31日 03:24 debian-archive-buster-automatic.asc
-rw-r--r-- 1 root root 11105  7月31日 03:24 debian-archive-buster-security-automatic.asc
-rw-r--r-- 1 root root  1704  7月31日 03:24 debian-archive-buster-stable.asc
-rw-r--r-- 1 root root  1813 2023年 2月 1日 debian-ports-archive-2023.gpg  --\ debian-ports-archive-keyring软件包的文件
-rw-r--r-- 1 root root  1214 2023年 2月 1日 debian-ports-archive-2024.gpg  --/
root@debian:/# 
root@debian:/# apt-get update
Hit:1 http://deb.debian.org/debian-ports sid InRelease
Hit:2 http://deb.debian.org/debian-ports unreleased InRelease
Err:1 http://deb.debian.org/debian-ports sid InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
Err:2 http://deb.debian.org/debian-ports unreleased InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
Reading package lists... Done
W: http://deb.debian.org/debian-ports/dists/sid/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/debian-ports-archive-2023.gpg are ignored as the file has an unsupported filetype.
W: http://deb.debian.org/debian-ports/dists/sid/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/debian-ports-archive-2024.gpg are ignored as the file has an unsupported filetype.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.debian.org/debian-ports sid InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: http://deb.debian.org/debian-ports/dists/unreleased/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/debian-ports-archive-2023.gpg are ignored as the file has an unsupported filetype.
W: http://deb.debian.org/debian-ports/dists/unreleased/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/debian-ports-archive-2024.gpg are ignored as the file has an unsupported filetype.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.debian.org/debian-ports unreleased InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: Failed to fetch http://deb.debian.org/debian-ports/dists/sid/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: Failed to fetch http://deb.debian.org/debian-ports/dists/unreleased/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B523E5F3FC4E5F2C NO_PUBKEY 8D69674688B6CB36
W: Some index files failed to download. They have been ignored, or old ones used instead.
root@debian:/# 

提示/etc/apt/trusted.gpg.d/*.gpg are ignored as the file has an unsupported filetype 本人也不知怎解决

四.后记 1.参考 https://wiki.debian.org/CategoryPorts https://wiki.debian.org/LoongArch/sbuildQEMU

2.debootstrap参数运用

1)去掉 --variant=minbase,构建比较完整的根,用于LXC容器 2)加 --keyring= 宿主必须安装debian-ports-archive,安装后文件*.gpg在/etc/apt/trusted.gpg.d/ 3)加 --include=debian-ports-archive-keyring 额外安装软件包 4)国内镜像 南京大学镜像站https://mirrors.nju.edu.cn/debian-ports/ 提高下载速度

5)首先当你认为宿主是可信时,加上小节2)和3)整条安装链(源站、软件包)就是可信任的、安全的

root@debian:~# debootstrap  --keyring=/etc/apt/trusted.gpg.d/debian-ports-archive-2023.gpg   --arch=loong64    --extra-suites=unreleased --include=debian-ports-archive-keyring sid /home/linlin/vm/debloong64/ http://mirrors.nju.edu.cn/debian-ports
I: Can't verify that target arch works
I: Retrieving InRelease
I: Checking Release signature
I: Valid Release signature (key id D0C987D7BEC3EDDF89486CC2B523E5F3FC4E5F2C)  <= 验证*2023.gpg结果
I: Retrieving Packages
I: Validating Packages
I: Retrieving InRelease
I: Checking Release signature
I: Valid Release signature (key id D0C987D7BEC3EDDF89486CC2B523E5F3FC4E5F2C)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://mirrors.nju.edu.cn/debian-ports...       <= 国内镜像
I: Checking component main on http://mirrors.nju.edu.cn/debian-ports...
I: Retrieving adduser 3.137
I: Validating adduser 3.137
I: Retrieving apt 2.7.6
I: Validating apt 2.7.6
...
I: Retrieving debconf-i18n 1.5.82
I: Validating debconf-i18n 1.5.82
I: Retrieving debian-archive-keyring 2023.4
I: Validating debian-archive-keyring 2023.4
I: Retrieving debian-ports-archive-keyring 2023.02.01  <= 移植版密钥
I: Validating debian-ports-archive-keyring 2023.02.01
I: Retrieving debianutils 5.14
I: Validating debianutils 5.14
...
I: Retrieving systemd 254.5-1
I: Validating systemd 254.5-1
...
I: Retrieving libc-bin 2.37-9+loong64
I: Validating libc-bin 2.37-9+loong64
I: Retrieving libc6 2.37-9+loong64                     <= C运行时库
I: Validating libc6 2.37-9+loong64
...
I: Retrieving util-linux 2.38.1-5+loong64
I: Validating util-linux 2.38.1-5+loong64
I: Retrieving util-linux-extra 2.38.1-5+loong64
I: Validating util-linux-extra 2.38.1-5+loong64
I: Chosen extractor for .deb packages: dpkg-deb
I: Extracting apt...
I: Extracting base-files...
...
I: Extracting util-linux-extra...
I: Installing core packages...
I: Unpacking required packages...
I: Unpacking apt...
...
I: Unpacking util-linux-extra...
I: Configuring required packages...
I: Configuring debian-archive-keyring...
...
I: Configuring libc-bin...
I: Unpacking the base system...
I: Unpacking apt-utils...
...
I: Unpacking fdisk...
I: Configuring the base system...
I: Configuring cpio...
...
I: Configuring libc-bin...
I: Base system installed successfully.
root@debian:~#

2.至2023-10-13,buildd.debian.org上loong64的软件包状态如下:

软件包               源码包          状态                           
-----------------------------------------------------------------
base-passwd         base-passwd     No entry in loong64 database
gpgv                gnupg2          No entry in loong64 database
libc6               glibc           Build-Attempted
libc-bin            glibc           Build-Attempted
libdebconfclient0   cdebconf        Installed    
libgcrypt20         libgcrypt20     Installed 
libgpg-error0       libgpg-error    Installed 
sed                 sed             No entry in loong64 database

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论