How to fix boot into initramfs prompt and “mount: can’t read ‘/etc/fstab’: No such file or directory” and “No init found”?

Installing a new system using a GPT partitioned disk dedicated to a single partition, ext4 formatted, extlinux (version 4.05) as bootloader, Ubuntu Core version 13.10 amd64 as rootfs, and Ubuntu linux-image-3.11.0-18-generic as kernel, and extlinux-update to generate bootloader configuration.

The result after reboot (still inside a KVM based virtual machine) is an (initramfs) prompt and these messages:

mount: can't read '/etc/fstab': No such file or directory
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory
The filesystem doesn't have requested /sbin/init.
No init found. Try passing init= bootarg.

BusyBox is v1.20.2.

Regression:

  • the file system has been checked with fsck.ext4

Check for root existence

(initramfs) ls -l /dev/[hs]da*
ls: /dev/[hs]da*: No such file or directory

Root boot argument

(initramfs) cat /proc/cmdline
initrd=/boot/initrd.img-3.11.0-18-generic ro quiet BOOT_IMAGE=/boot/vmlinuz-3.11.0-18-generic

Check loaded modules

(initramfs) cat /proc/modules
e1000 145368 0 - Live 0xffffffffa0000000

/boot folder content

$ sudo ls -l boot
-rw------- 1 root root 3296162 Feb 18 22:37 System.map-3.11.0-18-generic
-rw-r--r-- 1 root root 1007681 Feb 18 22:37 abi-3.11.0-18-generic
-rw-r--r-- 1 root root  163258 Feb 18 22:37 config-3.11.0-18-generic
drwxr-xr-x 2 root root    4096 Mar 17 20:13 extlinux
-rw-r--r-- 1 root root 4995000 Mar 16 23:35 initrd.img-3.11.0-18-generic
-rw------- 1 root root 5634192 Feb 18 22:37 vmlinuz-3.11.0-18-generic

How to make this system boot to the expected default bash prompt?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Modify your kernel boot parameter by setting the root=/dev/sdaX option. sdaX would be your / or root partition. Upon booting the next time, you will see that your initramfs tries to mount the partition before trying to access /etc/fstab and mounting the file systems.

See question “Does initramfs use /etc/fstab?” for more details.

Method 2

What you need to understand about initramfs is that it is a filesystem. Since kernel 2.6 it is, basically, the only kernel-imposed filesystem ( leaving aside VFS, which is arguably also a filesystem ) on your machine. Your initramfs image is a disk image.

Within your initramfs image will be whatever files your distribution decided were crucial enough to require before your root disk is found. Usually that’s Busybox and whatever kernel modules you need to find and mount your root device. This is isn’t working for you.

There’s no real mystery here though, all things considered. If you can find your way around a terminal prompt you can navigate the initramfs. But first you’ve gotta demystify it.

First and foremost and once again – this is just /. It’s Linux root doing Linux root type things. In fact, if it is in a separate file from your kernel, it’s actually already your second root device. Every Linux kernel contains a basically empty / all its own which it first mounts before pulling in your initramfs.

What’s more initramfs is the real root. It is where the Linux kernel initializes userspace by execing init and subsequently renouncing all responsibility for any problem you might encounter thereafter. Your init seems to be Busybox, as are many, which means controlling its actions should be as simple as editing its accompanying shell scripts.

Then why the error about not finding init? Almost definitely this is referring to a program named init which your actual init has been instructed via shell script to exec itself into.

Most striking to me is that the kernel pseudo file systems – dev sys proc – do not mount. This is either very troubling or a very good clue. You mention KVM which leads me to question kernel capabilities, but before we go down that dark and rutted road, can we first try something else?

cd /root || mkdir /root

It strikes me that the error message is repeatedly:

No such file or directory

Failing that you need to rebuild your initramfs image. Boot to a live disc to do so and run whatever tool your distribution provides to accomplish that end. Oh, and please ensure that this live disk is loaded in EFI mode.

So here’s the only truly out-of-the-ordinary thing about initramfs - switchroot.

The Linux kernel provides a very special syscall intended for early userspace and handling the move from initramfs to your root disk device. It works by first mounting your root disk into a mountpoint in initramfs and then pivoting the root filesystem into it. I assume your initramfs's target mount point is root based on the way it keeps moaning about it. Why not make sure it’s there?

For further investigation you’re going to need to get a little gritty. Adjust your bootloader to pass …

init=/bin/sh

… as a kernel parameter.

Method 3

I had the same problem. What Alex said is correct.
First I adjusted my fstab but that didn’t help.
So, I checked my GRUB. If you have the possibility to access GRUB menu.

  • Select the Linux, what you want to start and which makes trouble.
  • Press ‘e’ and look for ‘boot_image’ or ‘boot…root’.
  • Check the ‘uuid‘.
  • In my case, it was wrong. I make a picture in initramfs by typing ‘blkid‘ and take the uuid on which partition my linux is installed.
  • Paste the correct uuid from blkid to grub -> boot_image.

That solved my problem. After reboot my Linux needed longer time to start to check the disk. But now it works again.

I hope I could help you.

Regards


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x