scaleway / initrd

:wrench: Initrd builder with qemu nbd metadata for Scaleway boot (armhf + x86_64)
https://www.scaleway.com/docs
MIT License
51 stars 23 forks source link

Iterate over possible /sbin/init alternative paths #129

Open moul opened 8 years ago

moul commented 8 years ago
muhmuhten commented 8 years ago

/lib/systemd/systemd probably isn't a serious concern as the list of init paths the kernel tries doesn't include it and hasn't changed in over a decade, which means that any sane distribution is going to have to provide a binary named init.

It looks like the init existence check is possibly misleading though, since there's no particular reason it can't be an absolute symlink. The obvious way to get the test right requires the test to occur in a chroot, or after switch_root, but that's tricky with dependencies on the contents of the new root.

moul commented 8 years ago

Hi @muhmuhten,

Thank you for your feedback about the kernel history, it's a good idea to keep the same list they provide (/sbin/init, /etc/init, /bin/init, /bin/sh).

And yes, about the symlink check, you hit the point, I wanted to do the test from within a chroot, but it is too dependent on the target image, so for now, I just transformed the fatal in a warning, so it's not blocking anymore.

The solution we have in mind is to write a small C program that will follow the symlink while ignoring the /newroot prefix.