6

I'm reading up on Wake on Lan on Debian wiki and there is a part that says:

If your kernel uses an initramfs image (eg. Debian stock kernels), also run update-initramfs -u (or update-initramfs -u -k all if necessary) to rebuild kernel initial ramdisk(s).

How do I determine if my kernel uses initramfs?

I installed LMDE v2, 64-bit, Mate.

2
  • 5
    Your computer boots.
    – mikeserv
    Commented Jun 22, 2015 at 2:50
  • 1
    "Your computer boots" - true for most mainstream distros, but not universally true. I had a gentoo box with no initrd/initramfs for a decade and it worked flawlessly. Of course this limits the choices around filesystem, encryption, lvm etc. But it is still seen in the wild. Commented Feb 15, 2022 at 13:29

3 Answers 3

4

While terse, mikeserv is essentially correct - Linux has used initramfs for a long time, since the 2.6 days. If you use GRUB (which, assuming you have a default LMDE installation, you do), then checkout /boot/grub/grub.cfg:

$ grep initr /boot/grub/grub.cfg 
    initrd  /boot/initrd.img-3.13.0-53-generic
    initrd  /boot/initrd.img-3.13.0-53-generic
    initrd  /boot/initrd.img-3.13.0-52-generic
    initrd  /boot/initrd.img-3.13.0-52-generic
    initrd  /boot/initrd.img-3.13.0-24-generic
    initrd  /boot/initrd.img-3.13.0-24-generic

Even though the name is initrd, it is an initramfs archive, which you can test by virtue of initramfs being a CPIO archive:

$ file - < /boot/initrd.img-3.13.0-24-generic
/dev/stdin: gzip compressed data, from Unix, last modified: Tue Sep 30 20:07:43 2014
$ gunzip < /boot/initrd.img-3.13.0-24-generic | file -
/dev/stdin: ASCII cpio archive (SVR4 with no CRC)

(The name for the initramfs image is distro-dependent. Arch Linux, for example, simply calls it initramfs-linux.img.)

7
  • 2
    It's not just typical - initramfs is a filesystem. The image which accompanies most kernels is unpacked into that fs at boot. If there is no external image file, then it is because the required image has been compiled into the kernel itself. In both cases the kernel mounts its first root as an initramfs at boot. This has been the case since the 2.6 kernel series - it is a requirement for every linux kernel since.
    – mikeserv
    Commented Jun 22, 2015 at 4:15
  • @mikeserv Odd. Everything I've read (wiki.ubuntu.com/Initramfs, wiki.debian.org/initramfs/More, kernel.org/doc/Documentation/filesystems/…) seems to indicate that the primary quality of initramfs is that it is not a filesystem image, unlike initrd. Probably just a technical difference.
    – muru
    Commented Jun 22, 2015 at 4:17
  • 2
    Well. Yes and no - it's not an image of a filesystem, because initramfs is one whereas the initrd is a filesystem image laid down on a ram disk - a block dev. But initramfs is basically tmpfs - it's fs cache incarnate - so there's no underlying block layer at all, and the initramfs image (or archive may be more correct to say) can just be a simple cpio stream archive. But my point was that external archive/image file or no - initramfs is not optional.
    – mikeserv
    Commented Jun 22, 2015 at 4:22
  • @mikeserv Done. But in case the initramfs is compiled into the kernel, how do we detect it?
    – muru
    Commented Jun 22, 2015 at 4:34
  • 1
    Detect it? I guess you wouldn't - unless you stuck a debugger in there and did like init=bin/gdb on the kernel commandline. It's there though - it's the kernel's first root every time. See this for the whole story.
    – mikeserv
    Commented Jun 22, 2015 at 4:36
1

Almost all Linux desktop uses initramfs at least with default configuration including LMDE v2 and initramfs feature is kernel inbuilt.

Some OS like Slitaz and many embedded system OS like OpenWRT do not use initramfs image, they skips the initramfs image during boot, by a kernel boot argument noinitrd. you can check it at your bootloader(GRUB) menu or after booting, run

cat /proc/cmdline if you see a noinitrd word then it do not use initramfs image. There is a near 100% chance you will not see noinitrd word.

0

If an initramfs (or initrd for that matter) has been used during boot, the logs should have a bunch of initrd related entries.

Examples from my Arch Linux box:

$ sudo dmesg -T | grep "initrd"
[Tue Feb 15 12:58:58 2022] Freeing initrd memory: 31360K

or, using journalctl

$ journalctl -b --no-hostname | grep "initrd"                                                                                                                                                                                                                                                                                                                          
Feb 15 12:58:22 kernel: Freeing initrd memory: 31360K
Feb 15 12:58:29 systemd[1]: initrd-parse-etc.service: Deactivated successfully.
Feb 15 12:58:29 systemd[1]: initrd-cleanup.service: Deactivated successfully.
Feb 15 12:58:29 systemd[1]: initrd-udevadm-cleanup-db.service: Deactivated successfully.
Feb 15 12:58:30 systemd[1]: initrd-switch-root.service: Deactivated successfully.
Feb 15 13:00:00 systemd[1]: Startup finished in 16.502s (firmware) + 5.955s (loader) + 751ms (kernel) + 7.451s (initrd) + 1min 30.238s (userspace) = 2min 900ms.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .