Fixing your laptop through init
Today, I ran into a pretty annoying problem with my laptop.
I booted up, and got one of these once-in-every-24-mounts fsck’s of my root
partition. Nothing to worry about, unless it turns out that there is a
non-trivially fixable problem which shows the well-known "enter your root
password to fix or press ctrl-D to continue" line. Again, nothing to worry
about… until you realise that your keboard isn’t available yet at that point
of time in the boot-process! (I don’t have USB support compiled into my kernel,
and Mac connects it’s laptop keyboards through USB.)
Important to note: I was at the airport at that moment, with no other hardware
or cables or whatever with me to help me out. And knowing that you’ll be away
for 4 days (I’m at Open Nordic now), you
really want your laptop to work.
After thinking about it for a while, I got the solution. For some reason, my
keyboard does work while in the GRUB menu. I found out that I could pass about
any script or command to the init kernel parameter.
kernel /vmlinuz root=/dev/sda3 init=/sbin/fsck -y /dev/sda3
did the trick. :-)
Note that there are no quotes around the parameter value.
init="/sbin/fsck -y /dev/sda3"
won’t work!
I’m compiling USB support into my kernel right now.