Skip to content

Android init inside privileged redroid container overwrites host kernel.modprobe, silently breaking host module autoloading #932

Description

@cda2

Is your feature request related to a problem? Please describe.

Yes. AOSP's init.rc runs write /proc/sys/kernel/modprobe \n on
early-init ("Android doesn't need kernel module autoloading"). That is fine
on real devices — but this sysctl is not namespaced, so inside a
privileged redroid container the write escapes to the host and silently
disables module autoloading system-wide. Anything that needs a
not-yet-loaded kernel module after the container starts will fail, with
misleading symptoms.

In my case: while a redroid container was running, the host's Wi-Fi (WPA2)
failed its 4-way handshake with nl80211: key addition failed, and
NetworkManager kept reporting a wrong password. Kernel tracing showed
mac80211's ieee80211_key_alloc() returning -ENOENT — the host kernel could
not autoload the ccm crypto module because /proc/sys/kernel/modprobe had
been emptied.

Reproduced with redroid:14.0.0_64only-latest; the line is present in
redroid's own fork (remote-android/platform_system_core, branch
redroid-14.0.0_r2, rootdir/init.rc:22). The latest redroid 16 is
affected as well: it builds from stock AOSP android-16.0.0_r2, whose
rootdir/init.rc:22 still contains the write, and none of the
redroid-patches/android-16.0.0_r2 patches touch it.

Describe the solution you'd like

Neutralize this write in redroid's build so a container never touches the
host's kernel.modprobe. I'd be happy to send a PR against
platform_system_core (or a patch in redroid-patches) if that's the
preferred route.

Describe alternatives you've considered

Host-side workarounds that I currently use:

  • Preload modules that may be needed later (e.g. ccm, gcm in
    /etc/modules-load.d/)
  • Restore the sysctl after container start:
    sysctl -w kernel.modprobe=/sbin/modprobe (I run this from a systemd
    timer)

These work, but every redroid user has to rediscover them the hard way —
documenting the caveat in redroid-doc would also help.

Additional context

This may sound like an unusual setup, but I'm writing it down for anyone who
runs into the same problem someday. I develop on an ASUS ROG Flow Z13
(Strix Halo) laptop running CachyOS. After a reboot, Wi-Fi that had always
worked suddenly became unusable — NetworkManager kept insisting my password
was wrong. I assumed the usual suspects ("Arch being Arch again", or "the
MediaTek chip acting up") and wrestled with the wireless stack for hours:
kernel, firmware, and supplicant changes made no difference. It was beyond
what I could solve on my own, so I went through a long network-debugging
session with Claude (Fable), and the trail led somewhere unexpected: the
privileged redroid container. Once I cleaned it up and rebooted, Wi-Fi came
back as if nothing had ever happened.

Environment: kernel 7.1.3 (CachyOS/Arch), Docker with --privileged,
redroid:14.0.0_64only-latest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions