← Back to issue list

Snapcraft unable to compile ARM64 kernel

View original Github issue

Metadata

Project
snapcraft
Number
#5219
Type
issue
State
open
Author
RuhanSA079
Labels
Created
Updated
Closed

Current evaluation

Cross-compiling an ARM64 kernel with snapcraft 7.5.8/8.5.1 fails when the kernel plugin runs 'apt-get download snapd:arm64' for snap bootstrap, because the Focal build environment has no snapd arm64 candidate. No maintainer response; reporter reproduced the apt error on Ubuntu 20/22 in Jan 2025.

Suggested action: needs triage

Reason: No labels, no assignee, and no maintainer comments — only the reporter's own follow-up (2025-01-29) reproducing 'E: Can't select candidate version from package snapd:<arch>' via apt-get download on Ubuntu 20/22. The failure is in the kernel plugin's snap-bootstrap step (apt-get download snapd:arm64), which is a real bug in the plugin's package sourcing, but it has never been triaged. The current main branch's kernel/initrd plugins were substantially reworked (e.g. #6254, #6306), so a maintainer needs to determine whether the snapd-deb download path still exists or was replaced before deciding to close or fix.

Impact: 40 Quick Win: 18.0 Staleness: 78 Complexity: 55 Confidence: 55 Support Request: 25

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

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 40
Quick Win: 18.0
Staleness: 78
Complexity: 55
Confidence: 55
Support Request: 25
needs triage Cross-compiling an ARM64 kernel with snapcraft 7.5.8/8.5.1 fails when the kernel plugin runs 'apt-get download snapd:arm64' for snap bootstrap, because the Focal build environment has no snapd arm64 candidate. No maintainer response; reporter reproduced the apt error on Ubuntu 20/22 in Jan 2025.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 45
Confidence: 90
Support Request: 85
close not a bug Cross-compiling ARM64 kernels with snapcraft fails when downloading snapd:arm64. Inactive for over 1.5 years with no maintainer response. Author identified the root cause as an external apt repository issue rather than a snapcraft defect.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 15
Confidence: 85
Support Request: 90
close not a bug Cross-compiling ARM64 kernel fails due to apt-get download snapd:arm64 error. Author identifies it as an apt repository configuration issue rather than a snapcraft bug.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 30
Confidence: 80
Support Request: 20
close stale Snapcraft ARM64 kernel cross-compilation fails because apt lacks a snapd:arm64 candidate package. The issue remains open and unassigned. The author identified the root cause as an apt repository configuration problem.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#6254 (confidence 50%)

    Major kernel/initrd plugin rework that stabilized the plugins; may have changed or removed the snapd-deb bootstrap download path that fails in this issue.

  • Related To: snapcraft#6306 (confidence 40%)

    Fixes use of custom-built ubuntu-core-initramfs debs in the kernel/initrd plugins, adjacent to the initrd bootstrap download logic failing here.

Related issues

Issue Project State Summary Similarity
#1641123 snapcraft does not properly detect the architecture when kernel is 64 bits but userspace is 32 snapcraft (launchpad) closed Closed without resolution. Snapcraft incorrectly identified arm64 architecture in 64-bit kernel/32-bit userspace chroots, generating mismatched snaps. The report was abandoned due to inactivity.
75%
#1987627 Cannot build snaps in a 32-bit armhf container when running an arm64 kernel snapcraft (launchpad) closed Snapcraft failed to build armhf snaps in armhf containers on arm64 hosts due to unsupported armv8l architecture detection. The issue was resolved in Snapcraft 9.1 by adding native armv8l support, enabling successful builds in this configuration.
72%
#1569280 Snapcraft fails to strip go binaries on arm snapcraft (launchpad) closed Closed without resolution. Snapcraft failed to strip Go binaries on ARM during Launchpad builds, causing failures despite amd64 success. No fix or comments were provided.
72%
#5132 push of locally built snap fails on arm64 device snapcraft closed Resolved via PR #5147 and merged in #5136. A bug in the bundled unsquashfs 4.5 caused push failures on arm64 and x86_64. The fix is included in Snapcraft 8.6, targeting the candidate release on Jan 20, 2025.
70%
#4627 Cannot build snaps in a 32-bit armhf container when running an arm64 kernel snapcraft closed Closed without a public fix. An internal Jira ticket (CRAFT-2567) was created to track the architecture detection error, but no resolution or update was provided, leaving the issue deferred.
70%
#1757094 snapcraft in edge channel (2.39.2+git46.c22d7e2) fails to cross-compile kernel snapcraft (launchpad) closed Closed without comments. The cross-compilation failure was likely resolved in later stable releases or abandoned due to inactivity. The stable channel served as a functional workaround.
70%
#1570414 Snapcraft doesn't check if cross-compiling before trying to install necessary tools snapcraft (launchpad) closed Closed without resolution or comments, likely abandoned or superseded. Snapcraft failed to conditionally install cross-compilation tools, triggering armhf build errors.
70%