initrd and initramfs
The kernel binary executable is typically called vmlinuz9 and is usually found in the /boot/ directory. It may also be a symlink to a filename with version information (for example, vmlinuz-5.4.0-21-generic). You will typically find a companion file called initrd or initramfs (sometimes with the *.img extension). These files may also be symlinks to filenames with version information (for example, initrd.img-5.4.0-21-generic or initramfs-5.4-x86_64.img).
The initrd and initramfs files solve a chicken-or-egg problem when the kernel boots. The kernel needs various files, utilities, and modules to mount the root filesystem, but those items are located on the root filesystem that can’t be mounted yet. To solve this problem, the bootloader loads a temporary minimal root filesystem containing all the required files into memory and provides it to the kernel as a RAM disk. This is called the initial RAM disk, and it comes in two forms: initrd and initramfs (see the initrd(4) man page for more information). The initial RAM disk file is created with scripts, usually run by bootloader tools (mkinitramfs, mkinitcpio, or dracut) during installation or when the kernel is changed or upgraded.
The initramfs is a very basic kernel, which helps boot the full kernel. By default, the initramfs is a gzip compressed file and one can not directly look into it without unzipping it. lsinitramfs is a command that lists the contents of the initramfs/initrd file without unzipping it. It only gives a list of the files and can not help in looking into the contents of the file. For example:
$ lsinitramfs /boot/initrd.img-2.6.32 /boot/initrd.img-2.6.32 . bin bin / reboot bin / readlink bin / sleep bin / wget bin / busybox bin / dd bin / live-preseed bin / insmod bin / live-reconfigure bin / gunzip bin / kill bin / ipconfig bin / nfsmount bin / run-init bin / eject bin / mknod bin / losetup bin / sh bin / pivot_root bin / mkdir bin / cat bin / sh.shared bin / minips bin / fstype bin / nuke bin / umount bin / cpio bin / resume bin / sync bin / dmesg bin / ls bin / gzip bin / ln bin / false bin / chroot bin / mount bin / true bin / mkfifo bin / halt bin / poweroff bin / rsync bin / md5sum bin / uname sbin sbin / modprobe sbin / dmsetup sbin / blockdev sbin / losetup sbin / blkid sbin / udevadm sbin / udevd sbin / rmmod etc etc / modprobe.d etc / modprobe.d / linux-sound-base_noOSS.conf etc / modprobe.d / i915-kms.conf etc / modprobe.d / fbdev-blacklist.conf etc / modprobe .d / aliases.conf etc / modprobe.d / alsa-base.conf etc / modprobe.d / alsa-base-blacklist.conf etc / modprobe.d / radeon-kms.conf etc / modprobe.d / blacklist.conf etc / udev etc / udev / udev.conf lib lib / libacl.so.1.1.0 lib / libattr.so.1.1.0 lib / libpopt.so.0 lib / ld-linux.so.2 lib / libpthread.so .0 lib / libuuid.so.1 lib / libblkid.so.1 lib / libm.so.6 lib / live-boot lib / modules lib / modules / 2.6.32 lib / modules / 2.6.32 / modules.alias.bin lib / modules / 2.6.32 / modules.dep lib / modules / 2.6.32 / modules.softdep lib / modules / 2.6.32 / kernel lib / modules / 2.6. 32 / kernel / drivers lib / modules / 2.6.32 / kernel / drivers / scsi lib / modules / 2.6.32 / kernel / drivers / scsi / scsi_wait_scan.ko lib / modules / 2.6.32 / modules.order lib / modules / 2.6.32 / modules.dep.bin lib / modules / 2.6.32 / modules.alias lib / modules / 2.6.32 / modules.symbols lib / modules / 2.6.32 / modules.devname lib / modules / 2.6.32 / modules.symbols.bin lib / klibc-wbwbg7GBhllIGBCTEv0okjVELWk.so lib / libattr.so.1 lib / udev lib / udev / input_id lib / udev / usb_id lib / udev / rules.d lib / udev / rules.d / 60-persistent-storage-dm.rules lib / udev / rules.d / 50-udev-default.rules lib / udev / rules.d / 80-drivers.rules lib / udev / rules .d / 60-persistent-storage.rules lib / udev / rules.d / 55-dm.rules lib / udev / rules.d / 91-permissions.rules lib / udev / ata_id lib / udev / edd_id lib / udev / scsi_id lib / udev / cdrom_id lib / udev / v4l_id lib / udev / firmware.agent lib / udev / hotplug.functions lib / udev / path_id lib / librt.so.1 lib / libdl.so.2 lib / libudev.so. 0 lib / libselinux.so.1 lib / libblkid.so.1.1.0 lib / libuuid.so.1.3.0 lib / libacl.so.1 lib / libc.so.6 lib / libdevmapper.so.1.02.1 init conf conf / modules conf / initramfs.conf conf / arch.conf conf / conf.d conf / conf.d / resume scripts scripts / live-functions scripts / live-premount scripts / live-premount / readonly scripts / live-premount / select_eth_device scripts / live-premount / ORDER scripts / live-premount / modules scripts / live-bottom scripts / live-bottom / 24preseed scripts / live-bottom / 12fstab scripts / live-bottom / ORDER scripts / live-bottom / 30accessibility scripts / live-bottom / 08persistence_excludes scripts / live-bottom / 23networking scripts / live scripts / init-top scripts / init-top / all_generic_ide scripts / init-top / ORDER scripts / init-top / udev scripts / init-top / keymap scripts / init-top / blacklist scripts / live-helpers scripts / local scripts / init-bottom scripts / init-bottom / ORDER scripts / init-bottom / udev scripts / local-premount scripts / local-premount / ORDER scripts / local-premount / resume scripts / nfs scripts / functions usr usr / lib usr / lib / libz.so.1 usr / lib / libcrypto.so.0.9.8 usr / lib /libssl.so.0.9.8 usr / share usr / share / live-boot usr / share / live-boot / languagelist
We can also view the long listing using the option “-l” with the command.
$ lsinitramfs -l /boot/initrd.img-2.6.32
For more information, please check the man page:
# man lsinitramfs