Yesterday was a fearful day ... when I switched on my laptop, it was totally stuck during the boot process, leaving me with a scary initramfs prompt.
Obviously, this has happened just after I had finished mounting 3 hours of video with OpenShot Video Editor and unloaded almost 100 pix from my digital camera !
I was able to get the grub menu, but whatever kernel version I was selecting, I was always ending up with the following screen :
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory
Target filesystem doesn't have /sbin/init.
No init found. Try passing init=bootarg.
BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash)
Enter 'help' for a list of built-in commands.
I first though that my hard disk had died. But after a second though, as I was getting grub menu and ending on a initramfs prompt, the boot sector has been read properly. So hard disk was not in a completely pathetic condition.
In fact, the problem was coming from a corruption of my root filesystem. Because of that corruption, the root filesystem couldn't be mounted at boot.
This short article explains how to recover from such a scary situation and how to get your computer back to a working condition.
Even if tested on Ubuntu, it should be applicable to any Linux based computer with a ext3 or ext4 root filesystem.