In this exercise, we will replace these two binaries with assembly language versions that do not have such an interpreter dependency.
The first step is to edit your grub defaults, /etc/default/grub, so that you have a bit more time to react; I suggest changing your timeout to 10 (or more) seconds:
Now reboot, and hit "e" to edit. Add "break=premount" after the "ro" bit, to force the kernel to stop before it mounts any file systems, and thus you will be in the initial RAM filesystem rather than your ordinary root filesystem:
If you do a "cd" into /bin, you should see that while there are lots of items in the directory list, these are largely hard links to busybox (try "ls -li".)
In particular, do an "ls -li" of "true" and "false":
Note that these are currently some 600 bytes each.
Now do an "exit", and let your system boot up.
Become root. Create a subdirectory something like "initrd-new"; I used "/root/initrd-new", but you can use "/tmp" if you like (but if you have to redo anything, then you will have to redo everything since the contents of "/tmp" disappears on each reboot.)
Now you can "cd initrd-new && zcat < /boot/initrd-SOMEVERS | cpio -i -d" to extract your current initrd to your subdirectory.
Now it's time to work with the subsitute code. Change directory to somewhere that you can assemble your new code, and then pull it in:
(Or feel free to write your own assembly, if you don't like mine. ;-)
Now you will need "yasm", so install it:
Now assemble, link, and strip your binaries:
Now create a new gzipped initrd, using "cpio" with both "-o" and "--format='newc'" (the man page for cpio's various format is here) and piping to gzip:
Copy the old version to an "ORIG" file, and then install your new version over the old one:
And now reboot, again specifying "break=premount". Change directory into "/bin", and, voila, you should see your shiny new "true" and "false" programs: