Snapcraft unable to compile ARM64 kernel
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
I am trying to cross-compile a kernel for a ARM64 device, and it seems on both 7.x/stable and 8.x/stable channels that the snapcraft application fails to download the snapd:arm64 package, with the error: E: Can't select candidate version from package snapd:arm64 as it has no candidate
Failed to build 'kernel'.
This build-process happens on a Ubuntu Focal Multipass instance running on a AMD64 machine.
Snapcraft versions: 7.x/stable (7.5.8) and 8.x/stable (8.5.1)
This has worked last time I tried to compile a kernel, a few months back.
### To Reproduce
Not sure how to replicate, try to cross-compile a kernel?
Multipass instance compile options: (Manual compile commands)
`snapcraft --target-arch=arm64 --destructive-mode --enable-experimental-target-arch --enable-experimental-plugins`
### Environment
Running Multipass snap, version 1.15.0 on Ubuntu Bionic machine
Mutipass container version: Ubuntu 20.04.6 LTS
### snapcraft.yaml
```yaml
name: my-kernel
version: "20-8"
adopt-info: kernel
summary: Generic Linux kernel description: |
Kernel for testing
grade: stable
confinement: strict
type: kernel
architectures:
- build-on: amd64
run-on: arm64
build-base: core20
parts:
kernel:
plugin: kernel
source: github-link-removed
source-type: git
source-branch: lf-5.10.y
source-depth: 1
kernel-kdefconfig: [imx8_var_defconfig, snappy/generic.config, snappy/security.config, snappy/systemd.config, snappy/snappy.config, snappy/containers.config ]
kernel-kconfigs:
- CONFIG_LOCALVERSION="-v0.8"
- CONFIG_SYSFS=y
- CONFIG_GPIO_SYSFS=y
- CONFIG_GPIO_GENERIC=y
- CONFIG_HW_RANDOM_TPM=m
- CONFIG_TCG_TPM=m
- CONFIG_TCG_TIS_CORE=m
- CONFIG_TCG_TIS_SPI=m
- CONFIG_SECURITYFS=y
- CONFIG_LSM="yama,integrity,apparmor"
- CONFIG_SECURITY_APPARMOR=y
- CONFIG_AUDIT=y
- CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE=1
- CONFIG_DEFAULT_SECURITY_APPARMOR=y
- CONFIG_SYN_COOKIES=y
- CONFIG_STRICT_DEVMEM=y
- CONFIG_DEBUG_RODATA=y
- CONFIG_CC_STACKPROTECTOR=y
- CONFIG_CC_STACKPROTECTOR_STRONG=y
- CONFIG_DEBUG_SET_MODULE_RONX=n
- CONFIG_ENCRYPTED_KEYS=y
- CONFIG_SQUASHFS_XATTR=y
- CONFIG_SQUASHFS_XZ=y
- CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
- CONFIG_TMPFS_XATTR=y
- CONFIG_TMPFS_POSIX_ACL=y
override-pull: |
snapcraftctl pull
set -e
echo "Applying Ubuntu Core AppArmor patches to the kernel..."
git apply -v ../../../patches/apparmor-patch-510.patch
git apply -v ../../../patches/configs-patch-510.patch
snapcraftctl set-version "20-8"
kernel-initrd-compression: lz4
kernel-initrd-firmware:
- firmware/imx/sdma/sdma-imx7d.bin
kernel-device-trees: [ freescale/imx8mp-device-tree-for-kernel ]
kernel-image-target: Image
kernel-with-firmware: false
kernel-add-ppa: true
kernel-initrd-stage-firmware: true
organize:
kernel.img: Image
after: [ firmware ]
build-packages:
- cpio
- libc6-dev
- bison
- flex
- lzop
- libssl-dev
- on amd64 to arm64:
- gcc-aarch64-linux-gnu:amd64
#TODO Strip most firmwares out to make kernel smaller.
firmware:
plugin: nil
source: linux-firmware
override-build: |
mkdir -p $SNAPCRAFT_PART_INSTALL/firmware
cp -av ../../../linux-firmware/* $SNAPCRAFT_PART_INSTALL/firmware/
build-packages:
- zstd
- bison
- device-tree-compiler
- dpkg-dev
- flex
- initramfs-tools-core
- libfdt-dev
- libssl-dev
- lzop
- python3-crypto
- python3-pycryptodome
- python3-pyelftools
- python3-serial
- u-boot-tools
- wget
- libjson-c-dev
- binutils-${SNAPCRAFT_ARCH_TRIPLET}
- gcc-${SNAPCRAFT_ARCH_TRIPLET}
```
### Relevant log output
```shell
+ '[' -d /home/ubuntu/kernel/parts/kernel/src/kernel ']'
+ KERNEL_SRC=/home/ubuntu/kernel/parts/kernel/src
+ echo PATH=/snap/snapcraft/13058/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PATH=/snap/snapcraft/13058/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ echo KERNEL_SRC=/home/ubuntu/kernel/parts/kernel/src
KERNEL_SRC=/home/ubuntu/kernel/parts/kernel/src
+ initrd_installed_kernel_modules=
+ initrd_configured_kernel_modules=
+ echo 'Getting ubuntu-core-initrd....'
Getting ubuntu-core-initrd....
+ '[' '!' -e /home/ubuntu/kernel/parts/kernel/build/ubuntu-core-initramfs ']'
+ download_core_initrd arm64 /home/ubuntu/kernel/parts/kernel/build/ubuntu-core-initramfs
+ apt-get download ubuntu-core-initramfs:arm64
Get:1 http://ppa.launchpad.net/snappy-dev/image/ubuntu focal/main arm64 ubuntu-core-initramfs arm64 51.15 [18.2 MB]
Fetched 18.2 MB in 48s (381 kB/s)
W: Download is performed unsandboxed as root as file '/home/ubuntu/kernel/parts/kernel/build/ubuntu-core-initramfs_51.15_arm64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
+ dpkg -x ubuntu-core-initramfs_51.15_arm64.deb /home/ubuntu/kernel/parts/kernel/build/ubuntu-core-initramfs
+ echo 'Getting snapd deb for snap bootstrap...'
Getting snapd deb for snap bootstrap...
+ '[' '!' -e /home/ubuntu/kernel/parts/kernel/build/ubuntu-core-initramfs/usr/lib/snapd ']'
+ download_snap_bootstrap arm64 /home/ubuntu/kernel/parts/kernel/build/ubuntu-core-initramfs
+ apt-get download snapd:arm64
E: Can't select candidate version from package snapd:arm64 as it has no candidate
Failed to build 'kernel'.
Recommended resolution:
Check the build logs and ensure the part's configuration and sources are correct.
```
### Additional context
_No response_
Evaluation history
No evaluation history available.