はじめに
次のようにして Ubuntu (18.04等) 上で QEMU を使って arm64 向けの Debian11(bullseye) Root File System を ビルドする場合
shell$ mkdir debian11-rootfs
shell$ sudo chown root debian11-rootfs
shell$ sudo debootstrap --arch=arm64 --foreign bullseye debian11-rootfs
:
:
shell$ sudo cp /usr/bin/qemu-aarch64-static debian11-rootfs/usr/bin
shell$ sudo cp /etc/resolv.conf debian11-rootfs/etc
以下のようなエラーが発生する場合があります。
現象1
debootstrap の second-stage で次のようなエラーが発生する。
shell$ sudo chroot debian11-rootfs
I have no name!@ubuntu:/# distro=bullseye
I have no name!@ubuntu:/# export LANG=C
I have no name!@ubuntu:/# /debootstrap/debootstrap --second-stage
W: Failure trying to run: /sbin/ldconfig
W: See //debootstrap/debootstrap.log for details
現象2
python3-minimal をインストールする時、segmentation error が起きる。
原因と対策
いずれの場合も、qemu-user-static のバージョンが古い場合に起きます。
現象1を避けるためには buster-backports 以降で提供されている 5.2 以降が必要です。
現象2を避けるためには 6.1 以降が必要です。
どちらも避けたい場合は、6.1 以降を使ってください。私は qemu-user-static_6.1+dfsg-8_amd64.deb を探してきて、dpkg -i でインストールして使いました。
参考資料
- Bug#982422: debootstrap: segmentation fault around ldconfig during debootstrapping bullseye/arm64 on a buster/amd64 host
- Bug#988174: /usr/bin/qemu-aarch64-static: Segfaults sometimes on python3-minimal on arm64
- AMD64 マシン用 qemu-user-static_5.2+dfsg-9~bpo10+1_amd64.deb のダウンロードページ
- https://debian.pkgs.org/sid/debian-main-amd64/qemu-user-static_6.1+dfsg-8_amd64.deb.html