Fails to load compressed kernels on arm64

Bug #1661363 reported by dann frazier
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kexec-tools (Ubuntu)
Fix Released
Medium
Manoj Iyer
Xenial
Fix Released
Medium
Unassigned
Yakkety
Fix Committed
Medium
Unassigned

Bug Description

[Impact]
kexec-tools will not load a compressed kernel on arm64. Ubuntu ships compressed kernel images on arm64 starting with 16.10 (and hwe kernels for 16.04). A workaround is to manually decompress the kernel before loading it, but this is not supported by the use-kexec-for-reboot-by-default feature of the kexec-tools package.

[Test Case]
ubuntu@ubuntu:~$ sudo file /boot/vmlinuz-4.9.0-15-generic
/boot/vmlinuz-4.9.0-15-generic: gzip compressed data, max compression, from Unix
ubuntu@ubuntu:~$ sudo kexec -d -l /boot/vmlinuz-4.9.0-15-generic -t Image
arch_process_options:141: command_line: (null)
arch_process_options:143: initrd: (null)
arch_process_options:144: dtb: (null)
kernel: 0xffff8ff61010 kernel_size: 0x6ee18b
get_memory_ranges_iomem_cb: 0000000040000000 - 00000000ffffbfff : System RAM
get_memory_ranges_iomem_cb: 0000000100000000 - 000000013858ffff : System RAM
get_memory_ranges_iomem_cb: 0000000138750000 - 000000013bc1ffff : System RAM
get_memory_ranges_iomem_cb: 000000013c000000 - 000000013fffffff : System RAM
image_arm64_probe: Bad arm64 image header.
elf_arm64_probe: Not an ELF executable.
image_arm64_probe: Bad arm64 image header.
Cannot determine the file type of /boot/vmlinuz-4.9.0-15-generic

[Regression Risk]
kexec-tools did not support arm64 until zesty so, assuming the fix is localized to arm64 code, regression risk is negligible.

dann frazier (dannf)
description: updated
Revision history for this message
Manoj Iyer (manjo) wrote :

The debian/control file lists gnu-efi and libz-dev only for ia64, since amd64, and arm64 (may be other archs) also need these dependencies for it to support compressed kernel we need something like the following change for it to work on those archs.

-Build-Depends: debhelper (>= 7.0.0), dh-autoreconf, gnu-efi (>=3.0a-4)[ia64], libz-dev[ia64], po-debconf
+Build-Depends: debhelper (>= 7.0.0), dh-autoreconf, gnu-efi (>=3.0a-4)[amd64 arm64 ia64], libz-dev[amd64 arm64 ia64], po-debconf

I will upload a patch to zesty shortly.

Changed in kexec-tools (Ubuntu):
assignee: nobody → Manoj Iyer (manjo)
status: New → In Progress
Revision history for this message
dann frazier (dannf) wrote :

As mentioned on IRC, we shouldn't include amd64 in this unless we know that it actually improves amd64 support. My guess is that this doesn't help x86 - IIRC, those images decompress themselves at runtime.

Revision history for this message
Manoj Iyer (manjo) wrote :

ARM64 builds needs build dependency on libz-dev inorder to support compressed kernels. The attached patch adds that support. Note. amd64 and i386 do not have this dependency, I tested the current zesty version of the kexec-tools on amd64 and i386 and it works. The patch only apply to ARM64 build.

[TEST]
== Before Patch ==
ubuntu@test:~$ sudo kexec -l /boot/vmlinuz-4.9.0-15-generic --initrd=/boot/initrd.img-4.9.0-15-generic --append="root=LABEL=cloudimg-rootfs vt.handoff=7"
Cannot determine the file type of /boot/vmlinuz-4.9.0-15-generic
ubuntu@test:~$

== After Patch ==
ubuntu@test:~$ sudo kexec -l /boot/vmlinuz-4.9.0-15-generic --initrd=/boot/initrd.img-4.9.0-15-generic --append="root=LABEL=cloudimg-rootfs vt.handoff=7"
ubuntu@test:~$ sudo kexec -e

Ubuntu Zesty Zapus (development branch) test ttyAMA0

test login: [ 7616.705779] kexec_core: Starting new kernel
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.0-15-generic (buildd@bos01-arm64-009) (gcc version 6.3.0 20161229 (Ubuntu/Linaro 6.3.0-2ubuntu1) ) #16-Ubuntu SMP Fri Jan 20 15:29:58 UTC 2017 (Ubuntu 4.9.0-15.16-generic 4.9.5)
[ 0.000000] Boot CPU: AArch64 Processor [510f8000]
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: EFI v2.50 by EDK II
[ 0.000000] efi: SMBIOS=0x5bdb0000 SMBIOS 3.0=0x58660000 PROP=0x5f714518 ACPI=0x58690000 ACPI 2.0=0x58690014
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x000000005

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kexec-tools - 1:2.0.14-1ubuntu2

---------------
kexec-tools (1:2.0.14-1ubuntu2) zesty; urgency=medium

  [ Manoj Iyer ]
  * Enable compressed kernel support for ARM64 (LP: #1661363).

  [ dann frazier ]
  * ppc64-Reduce-number-of-ELF-LOAD-segments.patch: Cherry-pick
    from upstream, fixing kexec on some large memory configurations
    (LP: #1661168).

 -- dann frazier <email address hidden> Fri, 03 Feb 2017 14:49:31 -0700

Changed in kexec-tools (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello dann, or anyone else affected,

Accepted kexec-tools into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/kexec-tools/1:2.0.10-2ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in kexec-tools (Ubuntu Yakkety):
status: New → Fix Committed
tags: added: verification-needed
Changed in kexec-tools (Ubuntu Xenial):
status: New → Fix Committed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello dann, or anyone else affected,

Accepted kexec-tools into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/kexec-tools/1:2.0.10-1ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Mathew Hodson (mhodson)
Changed in kexec-tools (Ubuntu):
importance: Undecided → Medium
Changed in kexec-tools (Ubuntu Xenial):
importance: Undecided → Medium
Changed in kexec-tools (Ubuntu Yakkety):
importance: Undecided → Medium
Revision history for this message
Manoj Iyer (manjo) wrote :

Ubuntu 16.04.2 LTS kosberg ttyAMA0

kosberg login: [ 2610.177390] kexec_core: Starting new kernel
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.10.0-20-generic (buildd@bos01-arm64-006) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) ) #23~lp1688158+sru3-Ubuntu SMP Thu May 11 20:54:26 UTC 2017 (Ubuntu 4.10.0-20.23~lp1688158+sru3-generic 4.10.8)
[ 0.000000] Boot CPU: AArch64 Processor [430f0a11]
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: EFI v2.40 by American Megatrends
[ 0.000000] efi: ESRT=0x1ffce3ce18 SMBIOS 3.0=0x1ffce3cb18 ACPI 2.0=0x1ffeafd000
[ 0.000000] esrt: Reserving ESRT space from 0x0000001ffce3ce18 to 0x0000001ffce3ce50.

Revision history for this message
Manoj Iyer (manjo) wrote :

sudo file /boot/vmlinuz-4.10.0-20-generic
/boot/vmlinuz-4.10.0-20-generic: gzip compressed data, max compression, from Unix

tags: added: verification-done
removed: verification-needed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I don't see any mention of 16.10 being tested - switching to 'only xenial tested'.

tags: added: verification-done-xenial
removed: verification-done
Revision history for this message
Manoj Iyer (manjo) wrote :
Download full text (8.5 KiB)

Testing on Yakkety (16.10)

$ cat /etc/issue
Ubuntu 16.10 \n \l

$ uname -a
Linux myvm 4.8.0-54-generic #57-Ubuntu SMP Wed May 24 10:21:41 UTC 2017 aarch64 aarch64 aarch64 GNU/Linux

$ sudo file /boot/vmlinuz-4.10.0-22-generic
/boot/vmlinuz-4.10.0-22-generic: gzip compressed data, max compression, from Unix

$ sudo kexec -d -l /boot/vmlinuz-4.10.0-22-generic --initrd=/boot/initrd.img-4.10.0-22-generic --reuse-cmdline
arch_process_options:141: command_line: root=LABEL=cloudimg-rootfs ro quiet splash vt.handoff=7
arch_process_options:143: initrd: /boot/initrd.img-4.10.0-22-generic
arch_process_options:144: dtb: (null)
Try gzip decompression.
kernel: 0xffffaf279010 kernel_size: 0x12bc200
get_memory_ranges_iomem_cb: 0000000040000000 - 000000005855ffff : System RAM
get_memory_ranges_iomem_cb: 00000000585c0000 - 00000000585ebfff : System RAM
get_memory_ranges_iomem_cb: 0000000058750000 - 000000005bc1ffff : System RAM
get_memory_ranges_iomem_cb: 000000005c000000 - 000000005fffffff : System RAM
elf_arm64_probe: Not an ELF executable.
image_arm64_load: kernel_segment: 0000000040000000
image_arm64_load: text_offset: 0000000000080000
image_arm64_load: image_size: 00000000013cf000
image_arm64_load: phys_offset: 0000000040000000
image_arm64_load: vp_offset: ffffffffffffffff
image_arm64_load: PE format: yes
read_1st_dtb: found /sys/firmware/fdt
initrd: base 4144f000, size 1af840fh (28279823)
dtb_set_initrd: start 1095036928, end 1123316751, size 28279823 (27617 KiB)
dtb: base 42f48000, size 1c49h (7241)
sym: sha256_starts info: 12 other: 00 shndx: 1 value: e80 size: 58
sym: sha256_starts value: 42f4ae80 addr: 42f4a014
machine_apply_elf_rel: CALL26 5800065394000000->580006539400039b
sym: sha256_update info: 12 other: 00 shndx: 1 value: 2df0 size: c
sym: sha256_update value: 42f4cdf0 addr: 42f4a030
machine_apply_elf_rel: CALL26 eb16027f94000000->eb16027f94000b70
sym: sha256_finish info: 12 other: 00 shndx: 1 value: 2e00 size: 1bc
sym: sha256_finish value: 42f4ce00 addr: 42f4a048
machine_apply_elf_rel: CALL26 aa1603e194000000->aa1603e194000b6e
sym: memcmp info: 12 other: 00 shndx: 1 value: 604 size: 34
sym: memcmp value: 42f4a604 addr: 42f4a058
machine_apply_elf_rel: CALL26 340003a094000000->340003a09400016b
sym: printf info: 12 other: 00 shndx: 1 value: 524 size: 80
sym: printf value: 42f4a524 addr: 42f4a068
machine_apply_elf_rel: CALL26 5800042094000000->580004209400012f
sym: printf info: 12 other: 00 shndx: 1 value: 524 size: 80
sym: printf value: 42f4a524 addr: 42f4a070
machine_apply_elf_rel: CALL26 5800043694000000->580004369400012d
sym: printf info: 12 other: 00 shndx: 1 value: 524 size: 80
sym: printf value: 42f4a524 addr: 42f4a084
machine_apply_elf_rel: CALL26 f100827f94000000->f100827f94000128
sym: printf info: 12 other: 00 shndx: 1 value: 524 size: 80
sym: printf value: 42f4a524 addr: 42f4a0a0
machine_apply_elf_rel: CALL26 5800032094000000->5800032094000121
sym: printf info: 12 other: 00 shndx: 1 value: 524 size: 80
sym: printf value: 42f4a524 addr: 42f4a0a8
machine_apply_elf_rel: CALL26 38736a8194000000->38736a819400011f
sym: printf info: 12 other: 00 shndx: 1 value: 524 size: 80
sym: printf value...

Read more...

tags: added: verification-done-yakkety
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kexec-tools - 1:2.0.16-1ubuntu1~16.04.1

---------------
kexec-tools (1:2.0.16-1ubuntu1~16.04.1) xenial; urgency=low

  * Backport latest kexec-tools from bionic to xenial (LP: #1743529).

 -- Thadeu Lima de Souza Cascardo <email address hidden> Fri, 23 Feb 2018 12:11:36 -0300

Changed in kexec-tools (Ubuntu Xenial):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.