Hi,
In order to work around a known upstream bug I needed to add a udev rule to pxeboot initrd.img on CentOS 7.
The process is straightforward: 1 - extract the pxeboot initrd.img to a new directory 2 - add the udev rule needed to fix the bug 3 - pack and compress it back in initrd.img format
The resulting updated image works, it fixes the upstream bug and life is good. But although it works, it's not the same format as the original initrd.img that ships with the distro. I would like to know the proper incantation used to package initrd.img
Now for the specifics. The original image: http://mirror.steadfast.net/ centos/7.4.1708/os/x86_64/isolinux/initrd.img is extracted: /usr/lib/dracut/skipcpio initrd.img | xzcat | cpio -i -d and after adding the needed udev rule, it gets packed and compressed as follows:
find . 2>/dev/null | cpio --quiet -c -o | xz -9 --format=lzma >"~/patched-initrd.img"
Now for the difference. FIrst the original distro image: # file initrd.img initrd.img: xz compressed data
# file patched-initrd.img patched-initrd.img: LZMA compressed data, streamed Without the --format=lzma flag it fails to boot.
Does anyone know how this is done properly ?
Thanks, -Mike
Don't archive as lzma if you don't want lzma, remove the "--format=lzma" parameter.
hth Lucian
-- Sent from the Delta quadrant using Borg technology!
Nux! www.nux.ro
----- Original Message -----
From: "Mircea Husz" mirceahusz@yahoo.com To: "CentOS mailing list" centos@centos.org Sent: Wednesday, 31 January, 2018 16:51:20 Subject: [CentOS] How is initrd.img packed and compressed?
Hi,
In order to work around a known upstream bug I needed to add a udev rule to pxeboot initrd.img on CentOS 7.
The process is straightforward: 1 - extract the pxeboot initrd.img to a new directory 2 - add the udev rule needed to fix the bug 3 - pack and compress it back in initrd.img format
The resulting updated image works, it fixes the upstream bug and life is good. But although it works, it's not the same format as the original initrd.img that ships with the distro. I would like to know the proper incantation used to package initrd.img
Now for the specifics. The original image: http://mirror.steadfast.net/ centos/7.4.1708/os/x86_64/isolinux/initrd.img is extracted: /usr/lib/dracut/skipcpio initrd.img | xzcat | cpio -i -d and after adding the needed udev rule, it gets packed and compressed as follows:
find . 2>/dev/null | cpio --quiet -c -o | xz -9 --format=lzma >"~/patched-initrd.img"
Now for the difference. FIrst the original distro image: # file initrd.img initrd.img: xz compressed data
# file patched-initrd.img patched-initrd.img: LZMA compressed data, streamed Without the --format=lzma flag it fails to boot.
Does anyone know how this is done properly ?
Thanks, -Mike
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
I have already tried, without --format=lzma it fails to boot. -Mike On Wed, 2018-01-31 at 17:10 +0000, Nux! wrote:
Don't archive as lzma if you don't want lzma, remove the " --format=lzma" parameter.
hth Lucian
-- Sent from the Delta quadrant using Borg technology!
Nux! www.nux.ro
----- Original Message -----
From: "Mircea Husz" mirceahusz@yahoo.com To: "CentOS mailing list" centos@centos.org Sent: Wednesday, 31 January, 2018 16:51:20 Subject: [CentOS] How is initrd.img packed and compressed? Hi,
In order to work around a known upstream bug I needed to add a udev rule to pxeboot initrd.img on CentOS 7.
The process is straightforward: 1 - extract the pxeboot initrd.img to a new directory 2 - add the udev rule needed to fix the bug 3 - pack and compress it back in initrd.img format
The resulting updated image works, it fixes the upstream bug and life is good. But although it works, it's not the same format as the original initrd.img that ships with the distro. I would like to know the proper incantation used to package initrd.img
Now for the specifics. The original image: http://mirror.steadfast. net/ centos/7.4.1708/os/x86_64/isolinux/initrd.img is extracted: /usr/lib/dracut/skipcpio initrd.img | xzcat | cpio -i -d and after adding the needed udev rule, it gets packed and compressed as follows:
find . 2>/dev/null | cpio --quiet -c -o | xz -9 --format=lzma >"~/patched-initrd.img"
Now for the difference. FIrst the original distro image: # file initrd.img initrd.img: xz compressed data
# file patched-initrd.img patched-initrd.img: LZMA compressed data, streamed Without the --format=lzma flag it fails to boot.
Does anyone know how this is done properly ?
Thanks, -Mike
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Mircea Husz wrote:
In order to work around a known upstream bug I needed to add a udev rule to pxeboot initrd.img on CentOS 7.
The process is straightforward: 1 - extract the pxeboot initrd.img to a new directory 2 - add the udev rule needed to fix the bug 3 - pack and compress it back in initrd.img format
Instead of re-creating a new initrd.img, why not just create an 'updates' image that contains your new udev rule and use the 'inst.updates=' pxeboot cmdline option?
I use this to add things to the install image - no need to alter the existing initrd image - if you need more info, let me know
James Pearson
On Wed, 2018-01-31 at 19:46 +0000, James Pearson wrote:
Mircea Husz wrote:
In order to work around a known upstream bug I needed to add a udev rule to pxeboot initrd.img on CentOS 7.
The process is straightforward: 1 - extract the pxeboot initrd.img to a new directory 2 - add the udev rule needed to fix the bug 3 - pack and compress it back in initrd.img format
Instead of re-creating a new initrd.img, why not just create an 'updates' image that contains your new udev rule and use the 'inst.updates=' pxeboot cmdline option?
I use this to add things to the install image - no need to alter the existing initrd image - if you need more info, let me know
James Pearson
I would very much like your idea to work for us. I just tried it and found that inst.updates gets loaded later in the boot process than when it's in initrd.img, and for this particular bug that's too late. The udev rule we're adding deals with renaming the network interface, which happens earlier in the boot process.
-Mike