Closed sshock closed 3 years ago
I've worked around the problem for now using a tiny program called sleep_then_init.c that looks like this:
#include <unistd.h>
int main(int argc, char* argv[])
{
sleep(3);
execv("/init", argv);
return 0;
}
I built that for ARM (linking statically), then placed it inside the initrd inside the boot image, then also modified the kernel cmdline in the inside the boot image config to include rdinit=/sleep_then_init
.
But it would be nice if hardkernel linux could be fixed to avoid needing this workaround, e.g., by waiting to call init until after the sd card has been probed and /sys/dev/block fully populated.
This was fixed in magisk. See https://github.com/topjohnwu/Magisk/issues/2487
The kernel runs /init (from the initrd in the boot partition) before waiting for the sd card to be fully probed (meson-mmc driver) and available (i.e., before /sys/dev/block is fully populated).
This may not turn into a problem for the regular init, but for magiskinit this race condition results in magisk randomly not working. See https://github.com/topjohnwu/Magisk/issues/2487.
See the magisk issue for full dmesg logs, but the relevant section (that randomly occurs before/after/concurrently with init), is this: