Home Fedora How To Solve Initramfs Error In Fedora

How To Solve Initramfs Error In Fedora

By sk
Published: Last Updated on 8K views

Ubuntu and its derivatives often affected by the initramfs issue. As far as I know, it occurs usually on the disks that are formatted with ext4 filesystem. I haven't had this problem in BTRFS though. Until today, I thought only the Ubuntu-based systems are affected by this issue. I was wrong! Today, I encountered with the initramfs issue in my Fedora 34 desktop system. I already knew how to fix Initramfs error on Ubuntu Linux. In this guide, I will show you how to solve initramfs error in Fedora.

This was the actual error message that I encountered after switching on my Fedora 34 desktop.

[...]
Generating "/run/initramfsrdsosreport.txt"

Entering emergency mode. Exit the shell to continue.
Type "journelctl" to view the system logs.
You might want to save "/run/initramfsrdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.

Give root password for maintenance mode
(or press Control-D to continue):
:/root#
Entering emergency mode in Fedora
Emergency mode in Fedora

As you see in the above output, Fedora has entered into emergency mode. If you look a bit above in the screenshot, file system check on one of the disk partitions is failed.

To solve initramfs error in Fedora, we need to check and repair the file system in the problematic partition using fsck command. In my case, the /dev/sda2 partition is corrupted.

# fsck /dev/sda2 -y 

Replace /dev/sda2 in the above command with your partition name. In your system, the partition could be different like /dev/sda1, /dev/sdb1, /dev/sdc1 etc. To find the Linux partition details, you use either cat /proc/partitions or blkid command. If you're not sure which partition to repair, run fsck on all partitions.

Now the fsck command will check for the bad blocks in the given partition's filesystem and fix them automatically. This will take a minute or two depending upon the size of the disk and the number of bad blocks in it.

[...]
/dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda2: 662372/4507520 files (0.4% non-contiguous), 7510236/10350080 blocks
Solve initramfs error in Fedora
Solve initramfs error in Fedora

Once fsck command repaired all bad blocks in the partition, type reboot or exit and press ENTER to start booting your Fedora system:

# reboot

Or,

# exit

Now your system should boot normally.

The above solution worked just fine for me. Just in case if it doesn't help, follow the instructions provided by one of our reader in an another article.

  1. Boot the system from a rescue CD/DVD/USB-memory stick with the same GNU/Linux distribution version
  2. And then first check hardware (dmesg shows for example whether hard disks are operational or producing failing messages)
  3. Next, run fsck on all of the [unmounted] file system partitions to verify if they are functioning properly.

If that does not fix the boot up problem, then it is possible from the rescue booted system to do further repairs and even to reinstall any essential corrupted software.

Good luck!

You May Also Like

4 comments

jonas kopek October 6, 2022 - 6:21 pm

You just saved my system! Fedora 36, just ran an update that included kernel 5.19.13, and rebooted. Maybe I rebooted too quickly after the update was complete — not giving akmods enough time to finish… I don’t know what the problem was. But, after this, not even the recovery image would finish loading. I saw that it was trying to fsck, but would never run to completion, then complained about missing initramfs.

Googling “fedora missing initramfs” brought me here, I ran ‘fsck /dev/mapper/fedora-root -y’, and now I’m back up and running. Thank you.

Reply
sk October 6, 2022 - 8:15 pm

Glad it worked. Happy to help.

Reply
Lee December 2, 2022 - 12:19 am

Hey there fellas. My name is Lee. I am experiencing a problem after my toddler was found in my office unattended. Fedora won’t boot and I keep getting the error message “Generating “/run/initramfs/rdsosreport.txt” it then continues “Entering emergency mode. Exit the shell to continue. Type ‘journalctl’ to view system logs. You might want to save ‘/run/initramfs/rdsosreport.txt’ to a USB stick or /boot after mounting them and attach it to a bug report. Press Enter for maintenance (or press Control-D to continue).”

Now I read through the above post and I pressed enter which took me to an sh-5.1# command prompt. I also tried Control-D which took me to a GRUB command prompt. At the sh-5.1# command line I tried “fsck/dev/mapper/fedora-root -y” and it returned “No such file or directory” and took me back to “sh-5.1#.”

Guys Im truly stumped here. I was operating Fedora Server 37 before all of this. Please advise, I truly appreciate your expertise.

Reply
sk December 2, 2022 - 12:10 pm

Probably you’re trying to fix wrong a partition. Please run blkid command to list the partitions and then fsck /actual/path/of/partition/ -y (E.g. fsck /dev/sdx1 -y, fsck /dev/sdx2 -y …).

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More