Skip to content

[Bug]: ABL postinst scripts use wildcard expansion for kernel/initrd paths, breaking mkbootimg when multiple kernels exist #10108

Description

@xiaobaoaaaaaa

What happened?

On a Xiaomi Pad 5 Pro (xiaomi-elish, Snapdragon 870 / SM8250), kernel installation fails during the postinst hook with:

ValueError: Unrecognized arguments: ['/boot/initrd.img-6.18.35-current-sm8250']
run-parts: /etc/kernel/postinst.d/zz-update-abl-kernel exited with return code 1

The device uses Qualcomm's ABL (Android Bootloader) boot chain, which requires generating an Android boot image via mkbootimg after each kernel update. This is handled by the BSP's postinst script /etc/kernel/postinst.d/zz-update-abl-kernel.

The script locates the kernel and initrd using shell wildcards:

/boot/vmlinuz-*-sm8250
/boot/initrd.img-*-sm8250

When multiple kernel versions are present in /boot , the wildcard expands to multiple files — for example:

/boot/initrd.img-6.18.10-current-sm8250
/boot/initrd.img-6.18.35-current-sm8250

This passes two positional arguments where mkbootimg expects only one, and argparse rejects the extra one as unrecognized.

The bug is masked after a fresh install (when only one kernel version exists), but surfaces on the second or later kernel upgrade.

Other affected BSPs (same script, same logic)

BSP Device
ayn-thor AYN Odin
oneplus-kebab OnePlus 8T
ayn-odin2 AYN Odin 2
ayn-odin2mini AYN Odin 2 Mini
ayn-odin2portal AYN Odin 2 Portal

How to reproduce?

On xiaomi-elish (or any listed device):

  1. Install Armbian from a fresh image.
  2. Run the first kernel upgrade — this will succeed (only one kernel in /boot).
  3. Run a second kernel upgrade — this will fail with the error above, because /boot now contains both the old and new kernel versions.

Or manually:

ls /boot/vmlinuz-*-sm8250   # shows two or more versions
run-parts /etc/kernel/postinst.d/

Suggested fix
Replace wildcard expansion with the kernel version parameter ($1) passed by the Debian kernel hook mechanism:

version="$1"
kernel="/boot/vmlinuz-${version}"
ramdisk="/boot/initrd.img-${version}"

Optionally:

[ -f "$kernel" ] || { echo "Kernel not found: $kernel" >&2; exit 1; }
[ -f "$ramdisk" ] || { echo "Ramdisk not found: $ramdisk" >&2; exit 1; }

This fix applies identically to all six BSPs.

Branch

main (main development branch)

On which host OS are you running the build script and observing this problem?

Other

Are you building on Windows WSL2?

  • Yes, my Ubuntu/Debian/OtherOS is running on WSL2

Relevant log URL

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working as it shouldGood first issueFeel free to contribute :)Not framework bugBug in 3rd party component

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions