Bug 859569 - anaconda loads stage2 install.img twice when booting into rescue mode from CD/DVD
anaconda loads stage2 install.img twice when booting into rescue mode from CD...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: anaconda (Show other bugs)
6.3
Unspecified Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Brian Lane
Ladislav Jozsa
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-21 19:25 EDT by Timo Kokkonen
Modified: 2013-11-21 04:54 EST (History)
3 users (show)

See Also:
Fixed In Version: anaconda-13.21.200-1
Doc Type: Bug Fix
Doc Text:
Cause: Rescue mode unmounted the source iso before checking for .discinfo. Consequence: stage2 would be loaded twice, increasing the time to boot. Fix: Skip the check for .discinfo in rescue mode, it isn't needed for rescue anyway. Result: stage2 is only loaded once.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 04:54:54 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Timo Kokkonen 2012-09-21 19:25:57 EDT
Description of problem:

When booting into rescue mode from CD/DVD, anaconda will load install.img twice from the install media, causing noticeable delay unnecessarily. 

Version-Release number of selected component (if applicable):

anaconda-13.21.176


How reproducible:

Every time.

Steps to Reproduce:
1. Boot into rescue mode from CD/DVD
2. check /tmp/anaconda.log
3.
  
Actual results:

# cat /tmp/anaconda.log
14:42:27,548 INFO    : kernel command line: initrd=initrd.img rescue BOOT_IMAGE=vmlinuz

14:42:27,548 DEBUG   : readNetInfo /tmp/s390net not found, early return
14:42:27,548 INFO    : anaconda version 13.21.176 on x86_64 starting
14:42:30,709 DEBUG   : Saving module ipv6
14:42:30,709 DEBUG   : Saving module iscsi_ibft
14:42:30,709 DEBUG   : Saving module iscsi_boot_sysfs
14:42:30,709 DEBUG   : Saving module pcspkr
14:42:30,709 DEBUG   : Saving module edd
14:42:30,709 DEBUG   : Saving module iscsi_tcp
14:42:30,709 DEBUG   : Saving module libiscsi_tcp
14:42:30,709 DEBUG   : Saving module libiscsi
14:42:30,709 DEBUG   : Saving module scsi_transport_iscsi
14:42:30,709 DEBUG   : Saving module squashfs
14:42:30,709 DEBUG   : Saving module cramfs
14:42:30,710 DEBUG   : probing buses
14:42:30,728 DEBUG   : waiting for hardware to initialize
14:42:34,845 INFO    : Trying to detect vendor driver discs
14:42:35,207 DEBUG   : probing buses
14:42:35,226 DEBUG   : waiting for hardware to initialize
14:42:38,611 INFO    : trying to mount CD device /dev/sr0 on /mnt/stage2
14:42:38,614 INFO    : drive status is CDS_DISC_OK
14:42:38,679 INFO    : transferring /mnt/stage2/images/install.img to /tmp
14:43:25,451 INFO    : mounted loopback device /mnt/runtime on /dev/loop0 as /tmp/install.img
14:43:25,451 INFO    : Looking for updates in /mnt/stage2/images/updates.img
14:43:25,451 INFO    : Looking for product in /mnt/stage2/images/product.img
14:43:25,769 INFO    : mounted loopback device /tmp/product-disk on /dev/loop7 as /mnt/stage2/images/product.img
14:43:26,467 INFO    : umounting loopback /tmp/product-disk /dev/loop7
14:43:26,526 DEBUG   : This appears to be a boot.iso.
14:43:26,527 INFO    : umounting loopback /mnt/runtime /dev/loop0
14:43:41,272 DEBUG   : going to set language to en_US.UTF-8
14:43:41,272 INFO    : setting language to en_US.UTF-8
14:43:41,280 INFO    : 53 keymaps are available
14:43:44,551 INFO    : starting STEP_METHOD
14:43:56,653 INFO    : starting STEP_STAGE2
14:43:56,653 INFO    : trying to mount CD device /dev/sr0 on /mnt/stage2
14:43:56,656 INFO    : drive status is CDS_DISC_OK
14:43:56,861 INFO    : transferring /mnt/stage2/images/install.img to /tmp
14:44:43,634 INFO    : mounted loopback device /mnt/runtime on /dev/loop0 as /tmp/install.img
14:44:43,634 INFO    : Looking for updates in /mnt/stage2/images/updates.img
14:44:43,634 INFO    : Looking for product in /mnt/stage2/images/product.img
14:44:43,928 INFO    : mounted loopback device /tmp/product-disk on /dev/loop7 as /mnt/stage2/images/product.img
14:44:44,613 INFO    : umounting loopback /tmp/product-disk /dev/loop7
14:44:44,672 INFO    : got stage2 at url cdrom:///dev/sr0:/mnt/stage2
14:44:44,723 INFO    : Loading SELinux policy
14:44:45,188 INFO    : getting ready to spawn shell now
14:44:45,492 INFO    : Running anaconda script /usr/bin/anaconda
14:44:48,125 INFO    : using only installclass Red Hat Enterprise Linux Server
14:44:48,132 INFO    : created new libuser.conf at /tmp/libuser.v_4WVb with instPath="/mnt/sysimage"




Expected results:

Stage2 image (install.img) is only loaded once...


Additional info:

Problem would seem to be in loader.c, where the call to "findAnacondaCD("/mnt/stage2")" will unmount the CD before returning, if rescue mode is selected. 
So, the check for ".discinfo" file will fail causing unmount of the /mnt/runtime, and the install.img to get loaded again from the CD...

...
   /* Before anything else, see if there's a CD/DVD with a stage2 image on
     * it.  However if stage2= was given, use that value as an override here.
     * That will also then bypass any method selection UI in loader.
     */
    if (!FL_ASKMETHOD(flags)) {
        url = findAnacondaCD("/mnt/stage2");
        if (url) {
            /* This is specific to RHEL, which does not have the mirror system
             * set up like Fedora does.  If the CD/DVD doesn't have packages,
             * then it's a boot.iso and we still need to prompt for the
             * installation source.
             */

            if (!access("/mnt/stage2/.discinfo", R_OK) || FL_RESCUE(flags)) {
                skipLangKbd = 1;
                flags |= LOADER_FLAGS_NOPASS;

                setStage2LocFromCmdline(url, loaderData);
                skipMethodDialog = 1;

                logMessage(INFO, "Detected stage 2 image on CD (url: %s)", url);
                winStatus(50, 3, _("Media Detected"),
                          _("Found local installation media"), 0);
                sleep(3);
                newtPopWindow();
            }
            else {
                logMessage(DEBUGLVL, "This appears to be a boot.iso.");
                umountStage2();
                free(url);
                url = NULL;
            }
        }
...
Comment 2 Timo Kokkonen 2012-09-21 20:23:58 EDT
Following patch to loader.c would seem to fix the issue (not sure if this is "correct" way to fix the problem though...)

--- anaconda-13.21.176/loader/loader.c.orig     2012-06-12 12:40:09.000000000 -0700
+++ anaconda-13.21.176/loader/loader.c  2012-09-21 15:34:14.941896296 -0700
@@ -1309,7 +1309,7 @@ static char *doLoaderMain(struct loaderD
              * installation source.
              */

-            if (!access("/mnt/stage2/.discinfo", R_OK)) {
+            if (!access("/mnt/stage2/.discinfo", R_OK) || FL_RESCUE(flags)) {
                 skipLangKbd = 1;
                 flags |= LOADER_FLAGS_NOPASS;





When booting with initrd.img that contains the patched /sbin/loader, I get following log output:

# cat /tmp/anaconda.log
17:13:15,550 INFO    : kernel command line: initrd=initrd.img rescue BOOT_IMAGE=vmlinuz

17:13:15,550 DEBUG   : readNetInfo /tmp/s390net not found, early return
17:13:15,550 INFO    : anaconda version 13.21.176 on x86_64 starting
17:13:18,707 DEBUG   : Saving module ipv6
17:13:18,707 DEBUG   : Saving module iscsi_ibft
17:13:18,707 DEBUG   : Saving module iscsi_boot_sysfs
17:13:18,707 DEBUG   : Saving module pcspkr
17:13:18,707 DEBUG   : Saving module edd
17:13:18,707 DEBUG   : Saving module iscsi_tcp
17:13:18,707 DEBUG   : Saving module libiscsi_tcp
17:13:18,707 DEBUG   : Saving module libiscsi
17:13:18,707 DEBUG   : Saving module scsi_transport_iscsi
17:13:18,707 DEBUG   : Saving module squashfs
17:13:18,707 DEBUG   : Saving module cramfs
17:13:18,708 DEBUG   : probing buses
17:13:18,727 DEBUG   : waiting for hardware to initialize
17:13:22,793 INFO    : Trying to detect vendor driver discs
17:13:23,163 DEBUG   : probing buses
17:13:23,179 DEBUG   : waiting for hardware to initialize
17:13:26,563 INFO    : trying to mount CD device /dev/sr0 on /mnt/stage2
17:13:26,566 INFO    : drive status is CDS_DISC_OK
17:13:26,639 INFO    : transferring /mnt/stage2/images/install.img to /tmp
17:14:13,417 INFO    : mounted loopback device /mnt/runtime on /dev/loop0 as /tmp/install.img
17:14:13,417 INFO    : Looking for updates in /mnt/stage2/images/updates.img
17:14:13,417 INFO    : Looking for product in /mnt/stage2/images/product.img
17:14:13,734 INFO    : mounted loopback device /tmp/product-disk on /dev/loop7 as /mnt/stage2/images/product.img
17:14:14,421 INFO    : umounting loopback /tmp/product-disk /dev/loop7
17:14:14,480 INFO    : Detected stage 2 image on CD (url: cdrom:///dev/sr0:/mnt/stage2)
17:14:21,128 DEBUG   : going to set language to en_US.UTF-8
17:14:21,128 INFO    : setting language to en_US.UTF-8
17:14:21,137 INFO    : 53 keymaps are available
17:14:24,283 INFO    : starting STEP_METHOD
17:14:24,283 DEBUG   : loaderData->method is set, adding skipMethodDialog
17:14:24,283 DEBUG   : skipMethodDialog is set
17:14:24,283 INFO    : stage2 url is cdrom:///dev/sr0:/mnt/stage2
17:14:24,333 INFO    : Loading SELinux policy
17:14:24,793 INFO    : getting ready to spawn shell now
17:14:25,099 INFO    : Running anaconda script /usr/bin/anaconda
17:14:27,742 INFO    : using only installclass Red Hat Enterprise Linux Server
17:14:27,746 INFO    : created new libuser.conf at /tmp/libuser.e8JvJD with instPath="/mnt/sysimage"
Comment 3 RHEL Product and Program Management 2013-05-06 17:17:50 EDT
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.
Comment 4 Martin Banas 2013-08-01 02:22:52 EDT
Reproduced on RHEL6.4 GA, qa_ack+
Comment 9 Ladislav Jozsa 2013-10-18 08:14:56 EDT
Verified with anaconda-13.21.213-1.el6. install.img is transferred only once in rescue mode from CD/DVD.
Comment 11 errata-xmlrpc 2013-11-21 04:54:54 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1588.html

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