Ubuntu - Boot failure ending with initramfs prompt

Contents[Hide]

Ubuntu

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.
(initramfs)

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.

1. Boot from Ubuntu Alternate

As ext3 and ext4 are quite robust, it should be repaired quite easily with a tool like fsck run from a live CD. The main constraint is that the live CD should allow not to mount the root filesystem of the host computer.

After a quick search, I realised that Ubuntu Alternate allows to do that.

So, first step is to download Ubuntu Precise PC (Intel x86) alternate install CD and to :

  • either write the ISO file to a CD-ROM
  • or generate a USB key with unetbootin or startup disk boot creator under Ubuntu

Next step is to boot from your CD-ROM or USB Key on your computer with a corrupted filesystem.

From the main menu, select the last choice Rescue a broken system.

ubuntu-boot-failure-alternate

After selecting your keyboard, follow all the steps till the Filesystem Mount menu.

Select the last menu Do not use root file system.

Next, select the menu Execute a shell in the installer environment.

You will get a busybox prompt.

2. Repair Corrupted Root Filesystem

From the prompt, type :

# fdisk -l
Périphérique Amorce Début Fin Blocs Id Système
/dev/sda1 * 1 3647 29294496 83 Linux
/dev/sda2 3648 121601 947465505 5 Etendue
/dev/sdb3 120582 121601 8193150 82 Linux swap / Solaris

Here, the root filesystem is the first one : /dev/sda1. It is of Linux type.

To repair it, we just need to run fsck with the force option :

# fsck.ext3 -f /dev/sda1

At the end of the fdisk command, your filesystem should be repaired.

At this stage, you should already be able to succesfully reboot your computer.

3. Search your Hard Disk for Bad Sectors

Please note that this step is not compulsory at all.

In case you feel that your hard disk may be in an unhealty condition, you may want to search for bad sectors.

To search for bad sectors on your hard disk, you can need to run fdisk with the check option.

# fsck.ext3 -c /dev/sda1

This action may take a very long time to complete.

 

Once you root filesystem has been repaired, you just need to reboot ... and your Ubuntu system should be back to life !

Hope it helps.

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it. . Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus