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?

    Why two init images? Can you please put this on an actual disk and try to boot it? Qemu and EFI have issues - for instance, if you do not use an EFI boot firmware image, you won't get very far at all.

    And if all you want is a bash prompt you could always include bash in your initramfs...

    In fact, I'm remembering looking at LARGE GPT partitions in Ubuntu and them registering as completely empty. After I held shift at reboot to get grub's selection for their live disk I was able to select the Efi option, after which I had a disk.

  • Alex

    Alex Correct answer

    7 years ago

    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.

    Adding `root=/dev/sdaX `improves the situation, there is no longer an `(initramfs)` but a `bash` login prompt instead.

    Beside manually adding `root=/dev/sdaX` to kernel boot, I need to update `/mnt/etc/default/extlinux` and change `EXTLINUX_ROOT=""` to the suggested `EXTLINUX_ROOT="/dev/sdaX"` and run `extlinux-update` again.

    If your installation uses dm-crypt, you might need to use the mapper such as `root=/dev/mapper/sdaX_crypt`. Note that `sdaX_crypt` might be different if you renamed it when setting up the crypt. At the `initramfs` prompt (after a failed boot), you can use `ls /dev` and tab completion to inspect the folder structure.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM