Skip to content

make iiab-android proot-safe (deterministic chroot/reboot handling)#22

Merged
luisguzman-adfa merged 1 commit into
mainfrom
tool/make_iiab-android_proot-safe
Jun 19, 2026
Merged

make iiab-android proot-safe (deterministic chroot/reboot handling)#22
luisguzman-adfa merged 1 commit into
mainfrom
tool/make_iiab-android_proot-safe

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Building / running the IIAB installer under proot relies on chroot/container detection that is environment-dependent and unreliable. On a phone it usually resolves "chroot/proot" so the install works; but in headless /
async builds
— building the rootfs on an ARM64 board (Rock 5B+), via GitHub Actions, or as a server maintenance routine on iiab.switnet.org — the same checks can flip the other way, and IIAB then attempts systemd / reboot
actions that don't exist under proot, breaking the build at a different spot each time (the "it breaks for any little thing" symptom).

There are three independent detections, at three layers:

  1. Ansible fact ansible_facts.is_chroot — gates systemd-only tasks, e.g. roles/0-init/tasks/hostname.yml: command: hostnamectl ... with when: not ansible_facts.is_chroot. Under proot, when the fact is wrongly False, hostnamectl runs and fails (hostnamectl: not found).

    The fact is driven by the debian_chroot env var (or a /proc heuristic).

  2. Native /usr/sbin/iiab bash IS_CHROOTischroot -t || systemd-detect-virt --container -q. When False, the installer ends with reboot (absent under proot → rc 127), which aborts this wrapper before its Android tail (install_iiaboa_dashboard, readiness flags).

  3. Missing binaries under proot: reboot, hostnamectl.

Fixed by,

  • (1) Forces ansible_facts.is_chroot = True deterministically: exports debian_chroot, persists it in /etc/environment (pam_env), and keeps it across sudo via /etc/sudoers.d/99-iiab-proot-chroot (Defaults env_keep += "debian_chroot"). install.txt runs the installer via sudo, whose default env_reset would otherwise strip it.
  • (2) Installs a proot-correct ischroot (exit 0) and a no-op reboot in /usr/local/sbin, so the native installer takes its IS_CHROOT=true path ("IIAB Done", no reboot, no tty prompt) and the wrapper continues to the Android tail. These are also correct to keep in the rootfs (under proot we are chroot-like and must never drive the host init).
  • (3) Safety-net hostnamectl shim (writes /etc/hostname).

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator Author

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, comment @claude review on this pull request to trigger a review.

@luisguzman-adfa luisguzman-adfa merged commit bf44f3f into main Jun 19, 2026
1 check passed
@luisguzman-adfa luisguzman-adfa deleted the tool/make_iiab-android_proot-safe branch June 23, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant