17

The initial ramdisk (initrd) is typically a stripped-down version of the root filesystem containing only that which is needed to mount the actual root filesystem and hand off booting to it. The initrd exists because in modern systems, the boot loader can't be made smart enough to find the root filesystem reliably. There are just too many possibilities for ...


17

The entire kernel is loaded into memory at boot, typically along with an initramfs nowadays. (It is still possible to set up a system to boot without an initramfs but that's unusual on desktops and servers.) The initramfs's role is to provide the functionality needed to mount the "real" filesystems and continue booting the system. That involves kernel ...


14

I found a wonderful explanation here. However, let me try to put in a shorter format of what I understood in the answer. Shorter Version While the system boots, it needs an early userspace. It can be achieved using either initramfs or initrd. initrd is loaded into ramdisk which is an actual FILE SYSTEM. initramfs is not a file system. For initrd ...


13

To configure the initramfs in Debian, you can modify /etc/initramfs/initramfs.conf, or add configuration files and hooks to /etc/initramfs/conf.d and /etc/initramfs/conf-hooks.d. To rebuild the initramfs, run update-initramfs as root with the appropriate options (update-initramfs -u to update the initramfs of the newest kernel). All this is in the ...


12

As you stated, the purpose of initramfs is to get the "real" root filesystem mounted (it can do other things too, but this is the common task). Without an initramfs, the kernel will normally mount a partition up as read-only and then pass control over to /sbin/init. An initramfs just takes over this task from the kernel, usually when the root filesystem isn'...


12

If you know the array UUID, then mdadm --assemble /dev/md0 --uuid <uuid> (note the slight difference in parameter order) will do what you want: scan all unused volumes for ones that have md metadata for the given UUID. Other options: mdadm --assemble /dev/md0 --name <name> (does the same thing as --uuid, but with an array name instead of a UUID....


11

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.


10

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 ...


10

The size increase of having an initramfs is not due to the ramfs driver (it's only a few kB, and needed for other things anyway) but to the initramfs itself. The initramfs contains programs that are necessary to assemble and mount the real root filesystem. Initramfs makes it a lot easier, and in some cases possible (e.g. encrypted /), to boot the system. It ...


10

There is some information about this in the gentoo wiki: https://wiki.gentoo.org/wiki/Custom_Initramfs#Salvaging It recommends the usage of binwalk which works exceedingly well. I'll give a quick walk-through with an example: first extract the bzImage file with binwalk: > binwalk --extract bzImage DECIMAL HEXADECIMAL DESCRIPTION -------------...


10

My solution to LUKS and keyboard layout problems is to add the passphrase twice. So the same sequence of key presses will be accepted in both US/qwerty layout and whatever you usually use (in my case, DE/qwertz). If you use more than one keyboard layout you can add more passphrases for them; LUKS supports up to 8 in total, and most people never use more ...


9

OK, so I do have a working read-only system on an SD card that allows the read/write switch to be set to read-only mode. I'm going to answer my own question, since I have a feeling I'll be looking here again for the steps, and hopefully this will help someone else out. While setting various directories in /etc/fstab as read-only on a Red Hat Enterprise ...


9

It's very reliable and supported by all kernel versions that support initrd, AFAIK. It's a feature of the cpio archives that initramfs are made up of. cpio just keeps on extracting its input....we might know the file is two cpio archives one after the other, but cpio just sees it as a single input stream. Debian advises use of exactly this method (...


9

You can do this with GNU cpio: $ find . | cpio -o -H newc > /tmp/file 40 blocks $ file /tmp/file /tmp/file: ASCII cpio archive (SVR4 with no CRC)


8

Quoting Documentation/filesystems/ramfs-rootfs-initramfs.txt: Why cpio rather than tar? This decision was made back in December, 2001. The discussion started here: http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1538.html And spawned a second thread (specifically on tar vs cpio), starting here: http://www.uwsg.iu.edu/...


8

You can find the answer in the wiki: the idea is that one does not use /etc/modprobe.d/blacklist.conf. Instead, say you want to blacklist pcspkr. You create a pcspkr.conf file in /etc/modprobe.d and put blacklist pcspkr inside. Then run depmod -ae && update-initramfs -u


8

thank you for all your answers. I solved the problem by using ps faux and identified that sync does nothing/waits forever. As i had an usb drive which somehow died and got disconnected the drive still showed up as being mounted. I renamed /bin/sync to /bin/sync2, copied /bin/ls to /bin/sync and ran apt-get upgrade. It was successful so I renamed the files, ...


7

The initramfs OpenWRT/LEDE kernel builds are including the rootfs image into initramfs, attaching it to the kernel so it will put the filesystem in a ramdisk during bootup and utilize it as /. You don't need such builds if the regular flash-based storage works for you, as it won't allow any persistent configuration by default. Such a configuration is useful ...


6

You can boot without initrd on any hardware. I never use it myself on desktops/laptops and home servers, because it just adds to boot time. The only situation where I've found it really necessary so far, is when your root filesystem is on an LVM (but I may be in error - there might be some way to go about this also). If you want your setup to be fast and ...


6

It is given at boot time by your bootloader, for example Grub. To see with which arguments your kernel was started, do this: $ cat /proc/cmdline For me, this ouputs: BOOT_IMAGE=/vmlinuz-3.5.0-13-generic root=/dev/mapper/crypt-precise--root ro So the initrd/initramfs will try to mount my /dev/mapper/crypt-precise--root (encrypted LVM) logical volume as /....


6

A read-only /etc is increasingly common on embedded devices. A rarely-changing /etc is also increasingly common on desktop and server installations, with files like /etc/mtab and /etc/resolv.conf located on another filesystem and symbolically linked in /etc (so that files in /etc need to be modified when installing software or when the computer's ...


6

The bootloader stores the initrd into a location in memory, and tells the kernel the memory address of the initrd image. Most modern linux systems use the initramfs scheme using dracut, which is actually a cpio archive (rather than a disk image) that is unpacked into a tmpfs filesystem created by the kernel shortly after execution.


6

EDIT: Answer updated/corrected. Although the kernel documentation about this topic says that "Rootfs is a special instance of ramfs (or tmpfs, if that's enabled) [...]", it is in reality still a ramfs, as a short look in the code shows (rootfs is not mentioned in mm/shmem.c). Some patches (see e.g. here and here) were sent to the Linux kernel mailing list ...


5

In general there has to be some kind of protocol because typically it is not enough to just load a file into memory and jump at a specific location but you have to either pass additional arguments like kernel parameters, i.e. accessing memdisk arguments from DOS. As this is hardware dependent (arm is different than x86 for instance) you have to find the ...


5

The first error is because you're passing both -H newc and -c. You have to make up your mind on the format of the archive you want to generate. The "Operation not permitted" is a bug in GNU cpio, it's passing wrong arguments to the function that outputs that error message and should exit there. The other errors are because you're not running that command as ...


5

The entire kernel (but not its modules) will be loaded into memory. If there are modules which the kernel will need before any filesystems are available (this usually means the drivers for the filesystems and their devices), then those modules will be in the initramfs (in memory), and the kernel will load them from there. Other modules can be loaded later ...


Only top voted, non community-wiki answers of a minimum length are eligible