Ask Your Question
1

How to coorectly extract initrd0.img from fedora21 beta liveCD?

asked 2014-11-13 07:33:17 -0600

dearfriend gravatar image

updated 2014-11-13 07:39:16 -0600

Trying to do this:

[root@localhost f21]# lsinitrd -f /mnt/dvd/isolinux/initrd0.img 
[root@localhost f21]# ls -lh /mnt/dvd/isolinux/initrd0.img
-r--r--r--. 1 root root **38M** Oct 29 15:26 /mnt/dvd/isolinux/initrd0.img
[root@localhost f21]# file /mnt/dvd/isolinux/initrd0.img
/mnt/dvd/isolinux/initrd0.img: ASCII cpio archive (SVR4 with no CRC)
[root@localhost f21]# cpio -id < /mnt/dvd/isolinux/initrd0.img
1251 blocks
[root@localhost f21]# ls -al
total 16
drwxr-xr-x. 3 root root 4096 Nov 13 08:26 .
drwxr-xr-x. 6 root root 4096 Oct 16 06:22 ..
-rw-r--r--. 1 root root    2 Nov 13 08:26 early_cpio
drwxr-xr-x. 3 root root 4096 Nov 13 08:26 kernel
[root@localhost f21]# du -sh ./
**648K**    ./

Source file is 38M, but folder size after extract image is only 648k. What am i doing wrong?

edit retag flag offensive close merge delete

Comments

out of curiosity, what is your end goal here?

randomuser gravatar imagerandomuser ( 2014-11-13 16:09:17 -0600 )edit

I just trying to boot from network. See bug https://bugzilla.redhat.com/show_bug.cgi?id=1154670

dearfriend gravatar imagedearfriend ( 2014-11-14 03:17:57 -0600 )edit

is there a file $ISOROOT/os/images/pxeboot/initrd.img ? That seems like a likely candidate for network boots.

randomuser gravatar imagerandomuser ( 2014-11-14 08:50:29 -0600 )edit

isolinux/initrd0.img from LiveCD F20 and F21 alpha are possible to network boot, but problem in F21 beta.

dearfriend gravatar imagedearfriend ( 2014-11-14 22:04:47 -0600 )edit

@dearfriend good catch - have you filed a bug yet?

randomuser gravatar imagerandomuser ( 2014-11-14 22:21:43 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-11-13 15:56:43 -0600

baoboa gravatar image

updated 2014-11-13 16:20:12 -0600

this one is not fun , i did it previously like that but recently there is a possibility to put early microcode into the initramfs which make impossible to do it in one step.

solution:

sudo yum install binwalk

mkdir temp

mkdir temp/ramdisk

cd temp

binwalk /mnt/dvd/isolinux/initrd0.img .

DECIMAL HEXADECIMAL DESCRIPTION

... skip

11264 0x2C00 gzip compressed data, maximum compression, from Unix, last modified: Sun Oct 5 01:12:23 2014

  • catch the position where start the compressed part (here 11264)

dd if=/mnt/dvd/isolinux/initrd0.img of=initramfs.gz bs=11264 skip=1

gunzip initramfs.gz

file initramfs

initramfs: ASCII cpio archive (SVR4 with no CRC)

  • now it looks ok

cd ramdisk

cpio -i -d -H newc --no-absolute-filenames < ../initramfs

  • then you got it

for more about custom initramfs link

edit flag offensive delete link more

Comments

Thanks a lot. Gentoo wiki knows everything. :)

dearfriend gravatar imagedearfriend ( 2014-11-14 03:03:18 -0600 )edit

You are blessed. Thanks.

nixomose gravatar imagenixomose ( 2015-08-12 11:32:39 -0600 )edit

Many Thanks for this detailed solution. I used from many years a manual way to rebuild my initrd.img or initramfs.img in my specific live CD. I did not nead to do that from Fedora 20, where initrd.img was still a classical CPIO archive. And now with Fedora 29 its was impossible to follow the same way !

And of course this detailed solution, include implicitly the way to rebuild it, after the cpio.gz has been rebuilt, by inversing of and if in the dd command. I do not need currently to modify the early_cpio part with its kernel microcode,

ylec gravatar imageylec ( 2019-01-17 13:28:25 -0600 )edit

I just need to modify the ./usr/bin/dracut-pre-pivot to insert command to copy all LiveOS/squashfs.img in a RAMDISK, and the umount /dev/sr0 (or other device), to get finally a whole LiveCD in RAMDISK. (very usefull for maintanance system embedded in a server partition: no needs to search external CD, to boot in maintenance and make a clonrzilla of the whole disk, included this "live OS" partition !!!) Disapointed that livecd-dreator has NOT shuch option. So thanks again for these precious informations. Yes as SSIEB mentioned below, skipcpio extract the infos, but after that how you rebuild !

ylec gravatar imageylec ( 2019-01-17 13:43:58 -0600 )edit
0

answered 2015-09-14 16:44:14 -0600

ssieb gravatar image

There's a little program that comes as part of dracut called skipcpio.

See https://www.centos.org/forums/viewtop... for more info.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-13 07:33:17 -0600

Seen: 2,683 times

Last updated: Nov 13 '14