initird0.img "No init found" on add updated /lib/modules/ kernel folder ?
by Ed Sutton
I want to build a livecd that containing a new kernel containing security updates. The kickstart installs the updated kernel RPM. When I compare the extracted original initrd0.img to the extracted files from the modified initrd0.img I cannot see in obvious differences. The init script exists. Livecd-creator was run as su. The initrd0.img was made as normal user.
I assume my problem is in the extraction of the original initrd0.img source files or the re-compression to make the new one. The first thing I tried was to change isolinux.cfg to use the new kernel and original initrd0.img file that is missing the updated /lib/modules/ kernel folder. The point was to see how far the boot would get:
1 - Added new /isolinux/vmlinuz1
2 - Modified /isolinux/isolinux.cfg to use vmkinuz1
kernel vmlinuz1
append initrd=initrd0.img root=CDLABEL=sbc-dds-livecd-i386 rootfstype=iso9660 ro liveimg rhgb
3 - I made no changes to initrrd0.img
4 - On boot I get an expected error message complaining about missing /lib/modules/:
"FATAL: Could not load /lib/modules/2.6.18-238.9.1.el5PAE/modules.dep No such file or directory"
Next I tried to fix this by adding the missing updated /lib/modules/ kernel folder and rebuild the initrd0.img and the ISO:
1 - Extract the initrd0.img files
2 - Copy missing /lib/modules/2.6.18-238.9.1.el5PAE/ folder
3 - Recompress initrd source files
rpm2cpio kernel-PAE-2.6.18-238.9.1.el5.i686.rpm | cpio -imdu \*lib/modules/*
find . | cpio --create --format='newc' > /home/esutton/projects/livecd/Installation_Files/src_live_root/isolinux/initrd0
gzip -f /home/esutton/projects/livecd/Installation_Files/src_live_root/isolinux/initrd0
mv /home/esutton/projects/livecd/Installation_Files/src_live_root/isolinux/initrd0.gz /home/esutton/projects/livecd/Installation_Files/src_live_root/isolinux/initrd0.img
4 - On boot I get:
Failed to execute /init
Kernel panic - not syncing: No init found. Try passing init= option to kernel
Thanks in advance for any direction or tips on debugging or building initrd images.
-Ed
12 years, 8 months
2 commits - tools/livecd-iso-to-disk.sh
by Brian C. Lane
tools/livecd-iso-to-disk.sh | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit a624a4668ca950126d6503d561d7e9cefdabf485
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Mon Aug 8 16:21:09 2011 -0700
Turn on the legacy_boot flag for EFI (#680563)
This allows gptmbr to be able to boot on both EFI and BIOS.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index ff326a5..209f858 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -341,6 +341,8 @@ resetMBR() {
echo "Could not find gptmbr.bin (syslinux)"
exitclean
fi
+ # Make it bootable on EFI and BIOS
+ parted -s $device set $partnum legacy_boot on
else
if [ -f /usr/lib/syslinux/mbr.bin ]; then
cat /usr/lib/syslinux/mbr.bin > $device
commit 1b9e30c0bc295b4f61b07e739a5bb9851546fb71
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Mon Aug 8 16:20:20 2011 -0700
Don't ask about replacing MBR when formatting
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 46e4abb..ff326a5 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -365,9 +365,11 @@ checkMBR() {
mbrword=$(hexdump -n 2 $bs |head -n 1|awk {'print $2;'})
rm -f $bs
if [ "$mbrword" = "0000" ]; then
- echo "MBR appears to be blank."
- echo "Press Enter to replace the MBR and continue or ctrl-c to abort"
- read
+ if [ -z "$format" ]; then
+ echo "MBR appears to be blank."
+ echo "Press Enter to replace the MBR and continue or ctrl-c to abort"
+ read
+ fi
resetMBR $1
fi
12 years, 8 months
2 commits - tools/livecd-iso-to-disk.sh
by Brian C. Lane
tools/livecd-iso-to-disk.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit a162dd4c0e8745ea37185742e9cd2e86565e1227
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Mon Aug 8 15:27:24 2011 -0700
Make MBR replacement message more clear
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 077e74f..46e4abb 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -366,8 +366,7 @@ checkMBR() {
rm -f $bs
if [ "$mbrword" = "0000" ]; then
echo "MBR appears to be blank."
- echo "Do you want to replace the MBR on this device?"
- echo "Press Enter to continue or ctrl-c to abort"
+ echo "Press Enter to replace the MBR and continue or ctrl-c to abort"
read
resetMBR $1
fi
commit 8e3e899aafcea71f9ba4452a33cd5dbae945abff
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Mon Aug 8 15:18:06 2011 -0700
Ensure previous filesystems are wiped when formatting (#712553)
Add wipefs step before partitioning the device. This will remove any
previous filesystem signatures as well as iso9660's signature which
has been known to cause problems.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index d5c3f65..077e74f 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -418,6 +418,7 @@ createGPTLayout() {
echo "Press Enter to continue or ctrl-c to abort"
read
umount ${device}* &> /dev/null || :
+ wipefs -a ${device}
/sbin/parted --script $device mklabel gpt
partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep ^$device:)
size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
@@ -441,6 +442,7 @@ createMSDOSLayout() {
echo "Press Enter to continue or ctrl-c to abort"
read
umount ${device}* &> /dev/null || :
+ wipefs -a ${device}
/sbin/parted --script $device mklabel msdos
partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep ^$device:)
size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
@@ -468,6 +470,7 @@ createEXTFSLayout() {
echo "Press Enter to continue or ctrl-c to abort"
read
umount ${device}* &> /dev/null || :
+ wipefs -a ${device}
/sbin/parted --script $device mklabel msdos
partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep ^$device:)
size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
12 years, 8 months
livecd-creator image type undocumented option
by dashesy
Hi,
I was looking for an easy way to get a chrootable rootfs right from my
kickstart file that is originally designed to be written to a live USB
or CD. I basically needed the image to have a build environment with
older gcc version of that particular image, and iso is readonly.
I was amazed by the fact that livecd-creator already has an option for
that! great! one can easily use the "--image-type=image" switch to get
the ext4 rootfs.
At first I wanted to mount the created iso then mount the squashfs,
and use the ext3 file inside!
I am more amazed that such a useful option is undocumented. Is there
any reason for that? maybe it is planned to be taken out :( ?
thanks for the great tool
dashesy
12 years, 8 months
WARNING: Cannot find root file system, when mksiofs from good livecd ISO files ?
by Ed Sutton
I made an ISO using mkisofs with *unmodified* source files from a known working livecd ISO image. When I boot the ISO, after waiting 60 seconds, I get the following message, and then it drops to a emergency bash shell:
WARNING: Cannot find root file system!
I assume this is a problem with my mkisofs options, or perhaps the way I copy the files from the mounted ISO. Here's what I did:
1 - Started with a good bootable livecd ISO.
2 - Mounted ISO and copied all files
3 - Without modifying any files, I rebuilt using following mkisofs command
mkisofs -o image/cloned-livecd-i386.iso \
-v \
-R -J -T \
-b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
unmodified-iso-files/.
My eventual goal is to debug why an ISO made using livecd-creator cannot boot with a modified /isolinux/initrd.img containing the /lib/modules/ from an updated kernel. To simplify the problem, I am trying to recreate an ISO from the source of a known good livecd ISO. Any tips or suggestions are much appreciated.
Thanks in advance,
-Ed
12 years, 8 months