What is initramfs in Linux?
Table of Contents
What is initramfs in Linux?
Initramfs is used as the first root filesystem that your machine has access to. It is used for mounting the real rootfs which has all your data. The initramfs carries the modules needed for mounting your rootfs. But you could always compile your kernel to have these modules.
How do you make initramfs?
Create the New Initramfs or Initrd
- Create a backup copy of the current initramfs: cp -p /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak.
- Now create the initramfs for the current kernel: dracut -f.
What is an initramfs image?
The basic initramfs is the root filesystem image used for booting the kernel provided as a compressed cpio archive. This basic initramfs image may be prepended with an uncompressed cpio archive holding the microcode data loaded very early in the boot process.
How do I stop initramfs?
Disable the initramfs
- while editing /boot/grub/menu. list, locate the “# kopt=root=” line and make the same change as you did for the “kernel” line.
- run “upgrade-grub”
- edit /etc/kernel-img. conf and either add or modify the line so it contains “do_initrd = no”
How do I exit initramfs?
How to exit from initramfs busybox in Ubuntu
- Step 1: Type exit command. Copy. $ exit.
- Step 3: above any command want permission then press simply. Copy. y.
- Step 4: after modifying the structure of a file system. Copy. reboot.
- Some cases work exit instead of reboot. Copy. exit.
How do I rebuild initramfs?
To repair the initramfs image after booting into the rescue environment, you can use the dracut command. If used with no arguments, this command creates a new initramfs for the kernel currently loaded.
Is initramfs necessary?
For many users, an initramfs system is of no concern. Their system uses a simple partitioning schema with no exotic drivers or setups (like encrypted file systems), so the Linux kernel is entirely capable of handing over control to the init binary on their system. But for many systems, an initramfs is mandatory.
How do I unpack initramfs?
How to Fix
- First, create a temporary work directory and switch into it. This will be the location where the initramfs contents will be unpacked into and viewed: mkdir /tmp/initrd cd /tmp/initrd.
- Uncompress and extract the contents of the image in the /boot/ directory: /usr/lib/dracut/skipcpio /boot/initramfs-$(uname -r).
How do I fix initramfs in Linux?
Three commands must be run at the command prompt.
- Run the exit Command. First enter exit at the initramfs prompt. (initramfs) exit.
- Run the fsck Command. Use the fsck command with the file system path determined above.
- Run the reboot Command. Finally enter the reboot command at the (initramfs) command prompt.