0

I am attempting to follow the instructions here https://superuser.com/questions/1134160/how-to-get-old-linux-versions-to-boot-after-p2v-on-vmware for getting another P2Vd old Linux system to boot, but this time the distro in question is RedHat 7.3. Having tracked down a suitable install ISO I've successfully installed a fresh RH7.3 and am now trying to extract the files from its initrd, to be combined with the ones from the failing-to-boot P2V version and build a new initrd.

However when I run

gunzip < initrd-2.4.18-3.smp.img |cpio -i -m

It responds with

cpio: warning: skipped 485423 bytes of junk
cpio: warning: archive header has reverse byte-order
cpio: premature end of file

and then writes a file named ?lyyPjye?" (except the ys and e are extended ASCII characters) with file permissions c--S--S---

Assuming this would be a fairly straightforward gotcha I tried googling, and searching here, various combinations of cpio, initrd, reverse byte order, but other than references to problems extracting rhel6 rpms on rhel5 systems I didn't find any mentions. This is rhel7.3 trying to extract its own initrd file so version mismatches shouldn't come into it.

How do I resolve this, and will any special technique be needed to rebuild the initrd afterwards?

Pyromancer
  • 129
  • 3
  • 11

1 Answers1

1

I think your kernel is using an actual (and obsolete) initrd: init RAM DISK. Not a modern initramfs that kept the old name only. So it's not a cpio archive but a complete disk image of a filesystem.

You could try gunzip-ing it and try to mount --loop it somewhere. The filesystem could be anything (ext2, cramfs ...)

If it's r/w it's easy to edit it, if it's r/o that would be tougher.

It's described there: https://www.kernel.org/doc/Documentation/initrd.txt

A.B
  • 9,037
  • 2
  • 19
  • 37
  • Yes, that is the answer - the one thing I'd not done was run `file` on the unzipped file, a colleague who offered to help did and it revealed itself to be an ext2 file system, we mounted it via loop and were able to access. I've seen a few variations on this question so hopefully this answer will be helpful to others too. – Pyromancer Nov 30 '16 at 16:42