3

I am trying to unpack initrd image:

# file /boot/initrd.img-4.11.0-14-generic
/boot/initrd.img-4.11.0-14-generic: ASCII cpio archive (SVR4 with no CRC)
# mkdir /tmp/initrd; cd /tmp/initrd
# cpio -i -d -H newc --no-absolute-filenames -F /boot/initrd.img-4.11.0-14-generic
194 blocks
# ls -R
.:
kernel

./kernel:
x86

./kernel/x86:
microcode

./kernel/x86/microcode:
GenuineIntel.bin

So cpio extracts only ./kernel subdirectory of archive. But lsinitramfs show much more files inside it:

# lsinitramfs /boot/initrd.img-4.11.0-14-generic
/boot/initrd.img-4.11.0-14-generic
kernel
kernel/x86
kernel/x86/microcode
kernel/x86/microcode/GenuineIntel.bin
.
lib
lib/libnss_files.so.2
lib/cryptsetup

...

bin/egrep
init
run

How can I get all the archive contents?

Selivanov Pavel
  • 2,126
  • 3
  • 23
  • 47

1 Answers1

6

When you have intel-microcode (you have) and/or amd64-micrcocode installed, the initrd consists of two concatenated images. The first image contains just the microcode. The second contains everything else. Your cpio command just extracts the first one.

The easiest way is to use unmkinitramfs from initramfs-tools >= 0.126, which is included in Ubuntu 18.04 (bionic) and newer. On xenial you can just clone https://salsa.debian.org/kernel-team/initramfs-tools and call unmkinitramfs from this directory.

Benjamin Drung
  • 101
  • 1
  • 3