Today I got a systemd-242.0-3 update (plus some related). After installing that package, terminal shows initramfs is build from scratch. The output is like this:

:: Running post-transaction hooks...
(1/9) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 5.0.9-arch1-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful

According to LFS:

At boot time, the boot loader loads the kernel and the initramfs image into memory and starts the kernel. The kernel checks for the presence of the initramfs and, if found, mounts it as / and runs /init. The init program is typically a shell script. Note that the boot process takes longer, possibly significantly longer, if an initramfs is used.

I open the /boot/initramfs-linux.img with gzip and cpio tools and it contains whole /usr/lib/systemd folder. Shouldn't it contain only the kernel? Why does systemd also present in initramfs? Will not it be faster to place kernel in RAM and loads systemd from disk?


2 Answers 2


Direct reason is really some package(I believe it's the kernel package, not related to systemd) has a install script. Which is reasonable because your initramfs may contain some hook/binary/kernel module/whatever from that package, so it needs to be rebuild or you're gonna use old version(Notice that most initramfs contain nessceary kernel module to mount the real root, of which old version can't run with new kernel) on next boot.

Initramfs doesn't contain (although it can contain any file, but meaningless) a kernel, the kernel is already loaded into RAM by bootloader, initramfs is only used as the very first mounted filesystem.

On a typical system, the job of initramfs is providing the init program (possibly including other dependencies libraries or script interpreter) to run the very first PID=1 process, which mount the "real root filesystem (the normal root filesystem you use on a hard-disk partition)" then pivot_root to it, exec the init on the real root filesystem.

Systemd, as a program designed to run as PID=1, provide both the functionality of running as init in initramfs and init in real root filesystem.


The kernel is placed into RAM and it unpacks the separate initramfs into its rootfs (=ramfs), a first file system for the kernel.

Initramfs could be used as a mini linux system, e.g. for embedded applications.

If systemd-init is used, systemd files will be in initramfs.

HOOKS in mkinitcpio.conf contains hook scripts, that put files into initramfs (kernel modules, programs, boot scripts, ...), but not the hook scripts themselves. There are systemd-init hooks as an alternative to busybox hooks.

pacman -Syu linux updates the newest kernel in /boot, but also triggers recreation of initramfs.

pacman -Syu systemd can be made to also trigger re-creation of initramfs (last link), but it is not automatically done, as with the kernel installation. This is, because systemd-init is an alternative to busybox. Archlinux uses busybox files, and the according hooks, per default.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.