I managed to create a small and fully functional live Linux CD which contains only kernel (compiled with default options) and BusyBox (compiled with default options + static, all applets present, including /sbin/init). I had no issues to create initrd and populate /dev, /proc and /sys and also I had no issues at all with my /init shell script.
Recently I read that BusyBox supports /etc/inittab configurations (at least to some level) and I very much would like to do either of the following:
- Forget about my
/initshell script and rely entirely on/etc/inittabconfiguration. - Use both
/initshell script and/etc/inittabconfiguration.
Now the actual problem - it seems that /etc/inittab is completely ignored when my distro boots up. The symptoms are:
- When I remove
/initand leave only/etc/inittabI end up with kernel panic. My assumption is that kernel doesn't execute/sbin/initat all, or that/sbin/initdoesn't find (or read)/etc/inittab. - I read that BusyBox should work fine even without
/etc/inittab. So, I removed both/initand/etc/inittaband guess what - kernel panic again. - I tried to execute
/sbin/initfrom my shell and after several guesses which includedexec /sbin/init,setsid /sbin/initandexec setsid /sbin/initI ended up with kernel panic. Both with and without /etc/inittab being present on the file system.
Here is the content of my /init shell script:
#!/bin/sh
dmesg -n 1
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys
setsid cttyhack /bin/sh
At this point I don't care what the content of the /etc/inittab would be, as long as I have a way to know that the configuration there actually works. I tried several /etc/inittab configurations, all based on the information which I found here.
As a bare minimum my /etc/inittab contained just this one line:
::sysinit:/bin/sh
Again - I ended up with kernel panic and it seems that /etc/inittab was ignored.
Any suggestions how to force my little live distro to work fine with BusyBox's /etc/inittab are highly appreciated!
Update:
- Just to make it clear - I do not have kernel panic troubles with my current
/initshell script both with and without/etc/inittab. It all works fine, my/bin/ashconsole works great and I don't experience any unexpected troubles. The only issue is that/etc/inittabis completely ignored, as I described above. - I examined 3 different live Linux distributions: Slax, Finnix and SysResCD. All of them have
/initand none of them have/etc/inittab. In addition this Wiki article concludes my suspicion that/sbin/initis not invoked at all.