2

I am not understand why I get the error about initrd.img ( this initrd.img is the original file from clonezilla ISO file

cp initrd.img /tmp
zcat /tmp/initrd.img | cpio -idm
zcat: initrd.img: not in gzip format
cpio: premature end of archive

the full steps that I did are as the following:

I download the clonezilla-live-2.1.2-43-i686-pae.zip file from the site: http://clonezilla.org/livepxe.php

Then I Performed the following in order to get the initrd.img file as the following:

unzip -j clonezilla-live-2.1.2-43-i686-pae.zip live/vmlinuz live/initrd.img live/filesystem.squashfs -d /tftpboot/nbi_img

Then I copied the

cp /tftpboot/nbi_img/initrd.img   /tmp

All the last steps are according to the site. Please advice what wrong here?

I also tried this but not successfully with that -:(

Link: http://www.thegeekstuff.com/2009/07/how-to-view-modify-and-recreate-initrd-img/

mv initrd.img.gz  initrd.gz
gunzip initrd.gz 

gunzip: initrd.gz: not in gzip format
4

As zcat said, it isn't in gzip format. Run file on it to see if it recognizes the format. It is probably lzma, in which case you would need to use lzcat instead of zcat.

0

I know this is an old topic but came across it while I was looking for a way to add gpg keys to an openSUSE iso that was remastered to include several custom packages. I had some issues finding the information that I needed so I figured I would add some detailed instructions just in case someone else finds them useful. Different parts of these instructions were found on other sites. I just placed them together to form a detailed list. They do work which is what really matters.

I wrote them for modifying a local initrd instead of an initrd from an iso image but the process is the same.

Note: The instructions below are what I used for my system which is using /boot/initrd-3.16.7-24-desktop for its' initrd. The commands will need to be modified if your current initrd file is not /boot/initrd-3.16.7-24-desktop.

This is the procedure:

  1. Do a long listing on /boot/initrd to see which file it is pointing to:

    root@host:~ # ls -l /boot/initrd
    lrwxrwxrwx 1 root root 24 Sep 10 10:08 /boot/initrd -> initrd-3.16.7-24-desktop
    
  2. Create some directories to work in:

    root@host:~ #  mkdir -p -m 755 mod-initrd/new-initrd
    
  3. Copy the current initrd to the working directory:

    root@host:~ #  cp /boot/initrd-3.16.7-24-desktop mod-initrd/initrd.xz
    
  4. cd to the directory where the initrd will be extracted:

    root@host:~/mod-initrd #  cd mod-initrd/new-initrd
    
  5. Extract the initrd:

    root@host:~/mod-initrd/new-initrd #  xzcat ../initrd.xz | cpio -d -i -m
    
  6. Make the changes that you want to make.

  7. Save a copy of the original initrd:

    root@host:~/mod-initrd/new-initrd # mv ../initrd.xZ ../initrd-original
    
  8. Compress the modified intird:

    root@host:~/mod-initrd/new-initrd # find . | cpio -o -H newc | xz --check=crc32 --x86 --lzma2=dict=512KiB > ../initrd.xz
    
  9. Replace the current initrd with the modified initrd. This will make the modified version active upon reboot.

    root@host:~/mod-initrd/newinitrd # mv ../initrd.xz /boot/initrd-3.16.7-24-desktop
    
  10. Reboot to test the changes that you made.

    root@host:~/mod-initrd/new-initrd # init 6
    

Do not delete the extracted initrd until your changes have been tested. This way, if any adjustments need to be made steps 6, 8, 9, and 10 are all that are required.

For anyone trying to add their own GPG key to an openSUSE image so the key will be trusted automatically, this is one way it can be done:

Get the ID of your GPG key by running:

    gpg --list-keys

One of the lines should begin with something like this: pub 2048R/BB6D5E99

In the example above, the ID would be "BB6D5E99"

Export the public GPG key by running:

    gpg --export -a "BB6D5E99" > "file-name-for-the-exported-key"

Add the gpg key to the extracted initrd by running:

    echo "file-name-for-the-exported-key" | cpio -o -H newc -A -F "full-path-of-directory-holding-extracted-initrd"
  • This is an interesting contribution but it doesn't answer the question at hand as much as it answers the question, "How can I add my own GPG keys to openSUSE initramfs?". IMO, It deserves its own How-To article at LinuxJournal or nixCraft (no affiliation) rather than just getting lost here. – harperville Jun 7 '18 at 18:43

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.