I am using cpio to look at and extract a initrd initramfs.
i run:
cpio -i -t -c --make-directories --no-absolute-filenames < /boot/initramfs-3.10.0-123.20.1.el7.x86_64.img
.
early_cpio
kernel
kernel/x86
kernel/x86/microcode
kernel/x86/microcode/GenuineIntel.bin
42 blocks
If you run lsinitrd on that file it shows a lot more files.
file /boot/initramfs-3.10.0-123.20.1.el7.x86_64.img
/boot/initramfs-3.10.0-123.20.1.el7.x86_64.img: ASCII cpio archive (SVR4 with no CRC)
ls -al /boot/initramfs-3.10.0-123.20.1.el7.x86_64.img
-rw-r--r--. 1 root root 16113666 Mar 8 11:51 /boot/initramfs-3.10.0-123.20.1.el7.x86_64.img
I also tried mounting this file in various ways and I still did not see what is in the whole archive.
All my initramfs are like that even the one that I boot from.
cpio does not show the whole initramfs archive
Re: cpio does not show the whole initramfs archive
I think that I am close to the answer. It seems that there is a file within a file or an archive within a file.
https://git.centos.org/blob/rpms!dracut ... l11dzaay27
This is a patch and is probably not documented as well.
https://git.centos.org/blob/rpms!dracut ... l11dzaay27
This is a patch and is probably not documented as well.
Re: cpio does not show the whole initramfs archive
Here is the command that got me the rest of the "archive"
/usr/lib/dracut/skipcpio /boot/initramfs-3.10.0-123.20.1.el7.x86_64.img |zcat| cpio -id --no-absolute-filenames
It was found in this source file ./dracut-initramfs-restore.sh
It seems that there are several ways the archive could be packed:
"[ -f .need_shutdown -a -f "$IMG" ] || exit 1
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
else
# something failed, so we clean up
echo "Unpacking of $IMG to /run/initramfs failed" >&2
rm -f -- /run/initramfs/shutdown
exit 1
"
/usr/lib/dracut/skipcpio /boot/initramfs-3.10.0-123.20.1.el7.x86_64.img |zcat| cpio -id --no-absolute-filenames
It was found in this source file ./dracut-initramfs-restore.sh
It seems that there are several ways the archive could be packed:
"[ -f .need_shutdown -a -f "$IMG" ] || exit 1
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
else
# something failed, so we clean up
echo "Unpacking of $IMG to /run/initramfs failed" >&2
rm -f -- /run/initramfs/shutdown
exit 1
"