Debootstrap armhd Buster:无法获取本地颁发者证书

Debootstrap armhd Buster:无法获取本地颁发者证书

我有一个 Bash 脚本,它可以创建一个 .img 文件,该文件将被复制到 ARM 设备的 SD 卡上。

执行debootstrap命令安装最小的Debian Stretch系统(armhf),然后在chroot中执行脚本(软件安装、用户创建……)。

最近,由于需要升级 Buster,我将 debootstrap 命令分发参数更改为“buster”。但是,当我尝试安装软件时,出现错误bundle install:SSL 错误:无法获取本地颁发者证书。结果发现,即使curl在 HTTPS 网站上也会出现类似的错误。

我检查了什么

  • ca-certificates 已安装,update-ca-certificates并运行。
  • /etc/ssl/certs 内容看起来与我的电脑类似。

我尝试过

  • openssl s_client -connect ifconfig.me:443失败,unable to get local issuer certificate
  • curl -k显然有效
  • curl --cacert /etc/ssl/certs/ca-certificates.crt作品
  • 我尝试在 amd64 上使用 Buster 生成 .img 文件,curl并且bundle install成功了

如何重现该问题

touch buster_arm.img
truncate --size=2G buster_arm.img # 1G might not be enough
losetup --show --find --partscan --nooverlap buster_arm.img # should be /dev/loop0
parted --align optimal --script /dev/loop0 mklabel msdos mkpart primary 0% 100%
mkfs.ext4 /dev/loop0p1
mount /dev/loop0p1 /mnt/buster_arm
# replace buster by stretch and curl will work
# replace armhf by amd64 and curl will work
debootstrap --arch armhf --variant=minbase buster /mnt/buster_arm https://deb.debian.org/debian/
mount --bind /dev/ /mnt/buster_arm/dev
mount --bind /dev/pts /mnt/buster_arm/dev/pts
cp "$(command -v qemu-arm-static)" /mnt/buster_arm/usr/bin/qemu-arm-static # bypass architecture (my computer is not on armhf)
chroot /mnt/buster_arm /bin/bash
apt-get update && apt-get install ca-certificates curl apt-transport-https && update-ca-certificate
curl https://google.fr

我真的很困惑,有人遇到过这种问题吗?

感谢您的帮助 !

答案1

我发现了问题所在。

它与 update-ca-certificates 执行的 openssl rehash 命令相关,该命令应该在 /etc/ssl/certs 中创建额外的链接。

就我而言,它无法创建“哈希链接”(https://www.mail-archive.com/[电子邮件保护]/msg1725724.html)。

我必须手动运行 /usr/bin/c_rehash。

一旦系统在 ARM 设备上运行,在 chroot 之外,这可能就不是问题了。我会尽快更新此答案。

相关内容