Skip to content

[BUG] bundled bootctl doesn't support AIDL boot control HAL #3573

Description

@primalkz

Please check before submitting an issue

  • I have searched the issues and haven't found anything relevant
  • I will upload bugreport file in KernelSU Manager - Settings - Report log
  • I know how to reproduce the issue which may not be specific to my device

Describe the bug

the bootctl bin that ships with ksud only links the HIDL boot control HAL (1.0/1.1/1.2), no AIDL. on devices that only have the AIDL boot control HAL it can't bind to anything and fails.

it's used in post_ota, which runs bootctl for hal-info, get-current-slot, set-active-boot-slot and mark-boot-successful, so that whole step breaks on these devices:

pub(super) fn post_ota() -> Result<()> {
use crate::assets::BOOTCTL_PATH;
use crate::defs::ADB_DIR;
let status = Command::new(BOOTCTL_PATH).arg("hal-info").status()?;
if !status.success() {
return Ok(());
}
let current_slot = Command::new(BOOTCTL_PATH)
.arg("get-current-slot")
.output()?
.stdout;
let current_slot = String::from_utf8(current_slot)?;
let current_slot = current_slot.trim();
let target_slot = i32::from(current_slot == "0");
Command::new(BOOTCTL_PATH)
.arg(format!("set-active-boot-slot {target_slot}"))
.status()?;
let post_fs_data = Path::new(ADB_DIR).join("post-fs-data.d");
utils::ensure_dir_exists(&post_fs_data)?;
let post_ota_sh = post_fs_data.join("post_ota.sh");
let sh_content = format!(
r"
{BOOTCTL_PATH} mark-boot-successful
rm -f {BOOTCTL_PATH}
rm -f /data/adb/post-fs-data.d/post_ota.sh
"
);
std::fs::write(&post_ota_sh, sh_content)?;
std::fs::set_permissions(post_ota_sh, std::fs::Permissions::from_mode(0o755))?;
Ok(())
}

bin:
https://github.com/tiann/KernelSU/blob/ccfee6dc67d79a1404eb71c67b67b4f6c7b65a4a/userspace/ksud/bin/aarch64/bootctl

To Reproduce

  1. on a device that uses the AIDL boot control HAL (APEX)
  2. run the bundled bootctl
  3. it can't find the HAL and errors out

Expected behavior

bootctl should work on AIDL boot control HAL devices so post_ota can switch the slot

Screenshots

No response

Logs

cancunf:/data/local/tmp $ ./bootctl
Error getting bootctrl v1.0 module.

Device info

  • Device: Motorola (cancunf)
  • OS Version:
  • KernelSU Version:
  • Kernel Version:

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions