Bug 55224

Summary: GRUB 0.90 bootloader confuses Windows APM driver
Product: [Retired] Red Hat Linux Reporter: Erich Boleyn <erich>
Component: grubAssignee: Jeremy Katz <katzj>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-10-27 17:02:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Erich Boleyn 2001-10-27 17:01:58 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011012

Description of problem:
There is APM detection code in the GRUB bootloader version 0.90 which
leaves it in an inconsistent state before booting, and this confuses the
Windows APM driver, therefore disabling it.

I have not tested it on every machine/Windows combination, but on my
machines it is entirely reproducible.

In any case, the code was incorrect.  I debugged this for the GRUB folks (I
am the original author getting back into the development again), and
thought you might like the patch, included below...  I don't know if you
follow the development list.

You may even want to grab the 0.91 version that's coming out in a few
days/week.


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


How reproducible:
Always

Steps to Reproduce:
1. Install RH 7.2 on a system with Windows (98/ME) installed.
2. Boot into Windows.
3. Note that in the "System" control panel, the Advanced Power Management
driver is marked as not functioning.


Additional info:

-------------------------(start patch here)-----------------------
--- grub.orig/stage2/apm.S      Tue Oct 24 23:16:16 2000
+++ grub/stage2/apm.S           Fri Oct 26 11:45:04 2001
@@ -91,12 +91,12 @@
   xorw   %cx, %cx
   int     $0x15
   /* error -> should not happen, tidy up */
-  jc apm_disconnect
+  jc done_apm_bios
 
        /* check for "PM" signature */
        cmpw     $0x504d, %bx
        /* no signature -> should not happen, tidy up */
-       jne   apm_disconnect
+       jne   done_apm_bios
 
        /* record the APM BIOS version */
        movw      %ax, ABS(EXT_C(apm_bios_info))
@@ -104,19 +104,17 @@
   movw    %cx, ABS(EXT_C(apm_bios_info)) + 12
   jmp     done_apm_bios
 
-apm_disconnect:
-       /* Disconnect */
-       movw          $0x5304, %ax
-       xorw          %bx, %bx
-       /* ignore return code */
-       int     $0x15
-       jmp     done_apm_bios
-
 no_32_apm_bios:
        /* remove 32 bit support bit */
        andw     $0xfffd, ABS(EXT_C(apm_bios_info)) + 12
 
 done_apm_bios:
+       /* Some paranoia here: Always Disconnect from APM */
+       movw    $0x5304, %ax
+       xorw    %bx, %bx
+       /* ignore return code */
+       int     $0x15
+
        DATA32  call    EXT_C(real_to_prot)
        .code32
 
-------------------------(end patch here)-----------------------

Comment 1 Jeremy Katz 2001-10-27 17:45:25 UTC
Yep, I grabbed the patch off of the list yesterday and have a test package up at
http://people.redhat.com/~katzj/RPMS/grub-0.90-12.i386.rpm... waiting for
confirmation from the other filed bugs that this fixes the problem. 

*** This bug has been marked as a duplicate of 54375 ***

Comment 2 Erich Boleyn 2001-10-27 20:03:31 UTC
Err, I just tried your RPM, and it hung my test system!  (a Pentium 4 machine)

Hmm.  In trying to isolate this a bit further, it seems that all of them
including your new one runs fine from a floppy.  Further, the problem existed
when I changed back to the old version of GRUB, but it worked with the original
install from the CD obviously.  It *does* work with a stage2 from the CVS
version of GRUB.

Argh, I found the problem.  You're going to absolutely *love* this (not)...  the
problem is that the disk cache is incoherent with the raw device!!!!

So, when "grub-install" copies the stage2 over, Ext3 hasn't updated all of it's
state enough so that the raw device reflects it.

The *real* problem is that there was no "sync" command in the "grub-install"
script in places where the grub shell was being called.

I am posting a patch to the "bug-grub" list momentarily...

But, after that patch, all works well.  ;-)