[arch-general] How to cross-pacstrap for other architecture
Hi folks, I was wondering if it is possible to cross-pacstrap an Arch installation for a different architecture. In my case I wanted to prepare a boot medium for a Raspberry Pi 4 on my x86_64 machine. Why cross-pacstrap? The Arch Linux Arm homepage unfortunately does not provide any information about the software packages that the prepared installation archives contain and I'd like to install my Raspi from scratch. But a real cross-build is needless as the packages are all available in the various repos. I've tried running 'pacstrap -C pacman.aarch64.conf /mnt base' where pacman.aarch64.conf is extracted from the Arch Linux Arm installation archive but after the packages are extracted, pacman tries to run something inside the installation environment which fails due to the mismatch in architectures. Any ideas regarding how to cross-pacstrap? Thanks, Uwe
On 24.04.21 17:41, Uwe Sauter via arch-general wrote:
I've tried running 'pacstrap -C pacman.aarch64.conf /mnt base' where pacman.aarch64.conf is extracted from the Arch Linux Arm installation archive but after the packages are extracted, pacman tries to run something inside the installation environment which fails due to the mismatch in architectures.
You can setup QEMU to allow running foreign arch stuff, see [1]. I'm not sure if that will allow you to pacstrap an AArch64 root directly from the host. If it fails, you can grab the Arch Linux ARM AArch64 image and run pacstrap from within the extracted root dir, e.g. `arch-chroot </path/to/aarch64/root> pacstrap …`. [1] <https://wiki.archlinux.org/index.php/QEMU#Chrooting_into_arm/arm64_environment_from_x86_64>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On Sat, 24 Apr 2021, Stefan Göbel via arch-general wrote:
On 24.04.21 17:41, Uwe Sauter via arch-general wrote:
I've tried running 'pacstrap -C pacman.aarch64.conf /mnt base' where pacman.aarch64.conf is extracted from the Arch Linux Arm installation archive but after the packages are extracted, pacman tries to run something inside the installation environment which fails due to the mismatch in architectures.
You can setup QEMU to allow running foreign arch stuff, see [1].
I'm not sure if that will allow you to pacstrap an AArch64 root directly from the host. If it fails, you can grab the Arch Linux ARM AArch64 image and run pacstrap from within the extracted root dir, e.g. `arch-chroot </path/to/aarch64/root> pacstrap …`.
[1] <https://wiki.archlinux.org/index.php/QEMU#Chrooting_into_arm/arm64_environment_from_x86_64>
This method is good for recovering an unbootable raspi (that's, what I do in this case). IIRC, pacstrap from the host even works, too (mkinitcpio obviously fails in autodetect hooks and such stuff). However, I did not yet get all the files necessary for boot into the right place (bootloader, device tree, etc.) to actually pacstrap onto a previously empty microsd card. In case, that you are successful pacstrapping into an empty partition and makeing it bootable on a raspi, I would be really interested in the additional steps necessary. However, I think, this is rather a topic for the arch-ports mailing list, because it is too detached from x86_64 arch linux :-) regards, Erich -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE3p92iMrPBP64GmxZCu7JB1Xae1oFAmCETV8ACgkQCu7JB1Xa e1r2Ug//XiEa1kyUksJtw66bY2HdyR9Jk0KvK4n+txi2kFunxdhZsefeSUKvUkuN eX2dfp5Ur8mvCqHdnPnaOoFpOYeEnxKdgPFm6aEjXCafGIuOWmRYzpW//ihFPUHA z6u3/mNbRA273ItFCj3Z3mMq8KqTJRUSrmB0bEwccBAHR9lRdiA0C9G+/weZKf+I DEKmbrQNeP/t7QwnmTkOtedP5w4E5vtfi436+ySOrRmDP2fJJvmg7Fec2enelcB2 cVJ+79ZpRK+jMKbUU4EW7hMEN4pdww4JpqqYOfR/4/WkBRZkZUCtrZgToOhA+dCm qEUZE/dpnrupV/wzgdImVoXJP1WqFkjjNrNFjkACoNnumOgOitqn4in5uqjN45UY 5B1ny6B8EPndvRGNN5gS+hUjR+MSkl999/8isr4R+7oBIU4Fg42uUU1ZxvspTwa0 +3Mq87nwTS0cP9/yof/DRyCRErNxiwTyRcF7TlCKWSsqBVCInqu+UkFntomKwVPq B4HQGFsX2HanycFPe0c/RC5zMvwgLqifehnwHyZuB0qGXWvU2u/Tg2csVPhlNWGx veXwvTZ9oPQB6z1JU5p7fc2NPJ/hHyxjtpwPqggUpJtJ3qM3KdIeU2TXQDcLScrn 2CgGT5BxLrMN0YTP/TqFuvQbGs6ieOCK6JuZ2CUVxBN+w7y/vLw= =oKmG -----END PGP SIGNATURE-----
Stefan, Erich, thank you for your suggestions. Am 24.04.21 um 18:54 schrieb Erich Eckner via arch-general:
On Sat, 24 Apr 2021, Stefan Göbel via arch-general wrote:
On 24.04.21 17:41, Uwe Sauter via arch-general wrote:
I've tried running 'pacstrap -C pacman.aarch64.conf /mnt base' where pacman.aarch64.conf is extracted from the Arch Linux Arm installation archive but after the packages are extracted, pacman tries to run something inside the installation environment which fails due to the mismatch in architectures.
You can setup QEMU to allow running foreign arch stuff, see [1].
I'm not sure if that will allow you to pacstrap an AArch64 root directly from the host. If it fails, you can grab the Arch Linux ARM AArch64 image and run pacstrap from within the extracted root dir, e.g. `arch-chroot </path/to/aarch64/root> pacstrap …`.
[1] <https://wiki.archlinux.org/index.php/QEMU#Chrooting_into_arm/arm64_environment_from_x86_64>
This method is good for recovering an unbootable raspi (that's, what I do in this case). IIRC, pacstrap from the host even works, too (mkinitcpio obviously fails in autodetect hooks and such stuff).
However, I did not yet get all the files necessary for boot into the right place (bootloader, device tree, etc.) to actually pacstrap onto a previously empty microsd card.
In case, that you are successful pacstrapping into an empty partition and makeing it bootable on a raspi, I would be really interested in the additional steps necessary. However, I think, this is rather a topic for the arch-ports mailing list, because it is too detached from x86_64 arch linux :-)
I decided to try out running an Aarch64 Qemu VM in which I can run pacstrap for the same architecture as my target and was able to get the Raspi to boot. @Erich: you may contact me off-list if you'd like to discuss further. Regards, Uwe
regards, Erich
participants (3)
-
Erich Eckner
-
Stefan Göbel
-
Uwe Sauter