Bug 39743 - needRedHatCD variable in loader.c wrongly used for ks.cfg on cdrom
needRedHatCD variable in loader.c wrongly used for ks.cfg on cdrom
Status: CLOSED DUPLICATE of bug 22285
Product: Red Hat Linux
Classification: Retired
Component: anaconda (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Brent Fox
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2001-05-08 19:41 EDT by Fred Feirtag
Modified: 2007-04-18 12:33 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-05-10 16:24:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Fred Feirtag 2001-05-08 19:41:00 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.3-diskless i686)

Description of problem:
When setupCdrom is called with needRedHatCD set to zero,
the cd should not be unmounted before returning.
This is needed where the distribution is on NFS, but
the ks.cfg file is local (like on floppy). Here is patch:
--- loader.c    Tue May  1 16:17:57 2001
+++ loader.c.fixed      Tue May  1 16:32:08 2001
@@ -1004,8 +1004,8 @@
            devMakeInode(kd->known[i].name, "/tmp/cdrom");
            if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", 1, 0,
                          NULL)) {
-               if (!needRedHatCD ||
-                   !access("/mnt/source/RedHat/base/stage2.img", R_OK)) {
+               if (!needRedHatCD) return (char*)1;
+               if (!access("/mnt/source/RedHat/base/stage2.img", R_OK)) {
                                       "/mnt/runtime", "loop0")) {
                        buf = malloc(200);

How reproducible:

Steps to Reproduce:
1.create bootable cdrom from kickstart floppy
2.use "append ks=cdrom:/ks.cfg initrd=initrd.img network devfs=nomount" in
3.include ks.cfg in cdrom top level directory
4.kickstart install won't find ks.cfg, because the cdrom was prematurely

Actual Results:  no ks.cfg file found

Expected Results:  that the local ks.cfg file be used

Additional info:

vmlinuz kernel on cdrom also needed IDE-CDROM compiled in
Comment 1 Brent Fox 2001-05-10 16:24:28 EDT

*** This bug has been marked as a duplicate of 22285 ***
Comment 2 Forrest 2001-06-08 14:35:50 EDT
How do I implement this patch on my system?
Comment 3 Brent Fox 2001-06-11 16:12:38 EDT
Well, the easiest way to get kickstart files on the cdrom to work is to put the
kickstart file inside the initrd.img before you burn the cd.  
Applying the patch would be a pretty lengthy procedure.  You'd have to apply the
patch to the loader in anaconda, and recompile it.  Then you'd have to strip the
debug info out of the loader binary.  Then you need to replace the loader in the
initrd.img with the new loader that you compiled.  Then, you would need to burn
a cd with the ISO that contains the modified initrd.
Comment 4 Forrest 2001-06-12 15:18:35 EDT
So how do I put the kickstart file inside the initrd.img?

I have already applied the patch and recomiled anaconda.  How do I get the 
debug info out of the loader binary and replace the loader in initrd.img with 
the new one?
Comment 5 Fred Feirtag 2001-06-12 15:37:37 EDT
> ...How do I get the
> debug info out of the loader binary

After patching loader.c (found within the anaconda source rpm, as I recall),
"make loader" (some libraries may need to be compiled, too), then
"strip loader."  Then copy it into the image.  The script I wrote (below)
is very helpful for manipulating boot images.

I gather the alternative is to copy your ks.cfg into the initrd image
(also use script for that) and having the syslinux.cfg file contain:
append ks=file:/ks.cfg initrd=initrd.img network devfs=nomount
where file:/ is the top level directory of the initrd image--haven't
tried that, though it would seem simpler.

cat rhimgedit
#!/bin/csh -f
# This work is released by Integrity Linux, a division
# of Integrity Networking Systems, Albuquerque, New Mexico
# under the terms of the GNU GPL, version 2.

if ( ! -o / ) then
  echo Error must be root to run
  exit 1

if ($#argv == 0) then
  echo Usage:  $0 RedHat-floppy.img
  exit 1
onintr cleanup
cp $1 /tmp/$$.img
rm -rf /tmp/$$-mount >& /dev/null
mkdir /tmp/$$-mount
mount -t msdos -o loop /tmp/$$.img /tmp/$$-mount
if ($status) then
  echo Error: Failed to mount image as msdos loopback
  goto cleanup
(cd /tmp/$$-mount ; xterm) &
cp /tmp/$$-mount/initrd.img /tmp/$$-initrd.img.gz
gunzip /tmp/$$-initrd.img.gz
rm -rf /tmp/$$-imount >& /dev/null
mkdir /tmp/$$-imount
mount -t ext2 -o loop /tmp/$$-initrd.img /tmp/$$-imount
if ($status) then
  echo Error: Failed to mount initrd image as ext2 loopback
  goto cleanup
(cd /tmp/$$-imount ; xterm) &
mkdir /tmp/$$-modules
set sourcemods = /tmp/$$-imount/modules/modules.cgz
(cd /tmp/$$-modules ; gunzip -c $sourcemods | cpio -i --make-directories ;
(cd /tmp/$$-modules ; /bin/ls -1 */*.o | cpio --quiet -Hcrc -o | gzip -9 >
umount /tmp/$$-imount
gzip -best /tmp/$$-initrd.img
cp /tmp/$$-initrd.img.gz /tmp/$$-mount/initrd.img
umount /tmp/$$-mount
/bin/echo -n 'save changes? y/[n]  '
set save = $<
if ("$save" == 'y' || "$save" == 'Y') then
  cp /tmp/$$.img $1
rm /tmp/$$.img
rm -rf /tmp/$$-mount     >& /dev/null
rm -rf /tmp/$$-imount    >& /dev/null
rm -rf /tmp/$$-modules   >& /dev/null
rm /tmp/$$-initrd.img.gz >& /dev/null
rm /tmp/$$-mount.img     >& /dev/null

Note You need to log in before you can comment on or make changes to this bug.