2

I am trying to update a process used to remaster the Ubuntu 18.04 install image for 20.04 and running into a problem with extracting the initrd archive. The command used is cpio -id --no-absolute-filenames. When I use this same command to extract the initrd image from the 20.04 image, it extracts kernel/x86/microcode/AuthenticAMD.bin and stops.

Inspecting initrd file contents I can see a "TRAILER" section showing that there are multiple archives in the file. As suggested in other threads about cpio archives, I tried to extract the compound archive as such: cat initrd | while cpio -id --no-absolute-filenames; do :; done. In this case, the first entry extracts but then it has a bunch of "0 blocks" and doesn't extract anything else.

Does anyone know how this archive was created or how to extract it?

1

Same problem here -- the solution was to not unpack with Ubuntu version 20.04 using unmkinitramfs.

I created a bootable USB and booted my machine into Ubuntu 20 -- unmkinitramfs was then able to unpack the initrd. I'm still finding my way around building a new bootable USB that doesn't autologin (and works correctly with casper-rw).

If you want to see more about what unmkinitramfs does, it's a bash script. In a comparison between Bionic and Focal, Bionic does not supprt lz4 compression.

3
  • So is the point here that the version of unmkinitramfs shipped with versions previous to 20.04 not compatible with the format used? – virullius May 15 '20 at 16:08
  • That is indeed the issue. I needed the version shipped with 20.04. – virullius May 15 '20 at 19:34
  • when tried I got unmkinitramfs command not found message even though I have initram tools – incompetent May 3 at 19:13
1

/usr/sbin/update-initramfs calls /usr/sbin/mkinitramfs, which calls

cpio --quiet -R 0:0 --reproducible -o -H newc | lz4 -9 -l

where the lz4 is coming from /etc/initramfs-tools/initramfs.conf

reversing that into

cat /boot/initrd.img-5.4.0-26-generic | unlz4 -9 -l | cpio -i -H newc

fails though.

cat /boot/initrd.img-5.4.0-26-generic | file -
    /dev/stdin: ASCII cpio archive (SVR4 with no CRC)

keeps persisting it's a cpio archive, but

cat /boot/initrd.img-5.4.0-26-generic | cpio -i -H newc

still ends up in the same AuthenticAMD.bin. Maybe somebody else can build on this?

Edit: nope. According to https://unix.stackexchange.com/a/511224/44864 The answer is

 unmkinitramfs -v initrd.img-5.4.0-26-generic .
5
  • unmkinitramfs also extracted GenuineIntel.bin and a junk directory named .enuineIntel.align.0123456789abc, seemingly misunderstanding some metadata. It then errors with premature end of archive. – virullius Apr 27 '20 at 14:48
  • I suggest you look into the checksum of your downloaded copy of ubuntu-20.04-live-server-amd64.iso as I just downloaded it, and successfully unpacked the initrd.img from it with unmkinitramfs. – JdeHaan Apr 27 '20 at 14:59
  • is the file you're looking at called "initrd.img"? I am looking at /casper/initrd. – virullius Apr 28 '20 at 17:36
  • Yes: pastebin.com/MqDVq6P8 – JdeHaan Apr 29 '20 at 6:38
  • I suggest you download nl.archive.ubuntu.com/ubuntu/pool/main/i/initramfs-tools/… and extract it with mkdir initramfs-tools-core cd initramfs-tools-core dpkg -x ../initramfs-tools/initramfs-tools-core_0.136ubuntu6_all.deb . dpkg -e ../initramfs-tools/initramfs-tools-core_0.136ubuntu6_all.deb ls -al ./usr/bin/unmkinitramfs -rwxr-xr-x 1 me me 3595 Feb 18 02:19 ./usr/bin/unmkinitramfs – JdeHaan Apr 29 '20 at 6:45

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.