[Bug 837815] Re: Grub 0.97-29ubuntu62 gives error "Error 6: Mismatched or corrupt version of stage1/stage2"

Colin Watson cjwatson at canonical.com
Sun Sep 25 23:16:26 UTC 2011


I think this is down to GCC 4.5 vs. 4.6; compiling with gcc-4.5 seems to
avoid this.  From the GCC 4.6 release notes:

  * A new inter-procedural static profile estimation pass detects
functions that are executed once or unlikely to be executed. Unlikely
executed functions are optimized for size. Functions executed once are
optimized for size except for the inner loops.

  * On most targets with named section support, functions used only at
startup (static constructors and main), functions used only at exit and
functions detected to be cold are placed into separate text segment
subsections. This extends the -freorder-functions feature and is
controlled by the same switch. The goal is to improve the startup time
of large C++ programs.

    Proper function placement requires linker support. GNU ld 2.21.51 on
ELF targets was updated to place those functions together within the
text section leading to better code locality and faster startup times of
large C++ programs. The feature is also supported in the Apple linker.
Support in the gold linker is planned.

Using -fno-reorder-functions also appears to avoid the problem, so I
suspect that will be the answer.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub in Ubuntu.
https://bugs.launchpad.net/bugs/837815

Title:
  Grub 0.97-29ubuntu62 gives error "Error 6: Mismatched or corrupt
  version of stage1/stage2"

Status in “grub” package in Ubuntu:
  Triaged
Status in “grub” source package in Oneiric:
  Triaged

Bug description:
  On the Oneiric testing system, I ran grub-install to reinstall grub
  for Debian Lenny.

  $ cat /etc/lsb-release
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=11.10
  DISTRIB_CODENAME=oneiric
  DISTRIB_DESCRIPTION="Ubuntu oneiric (development branch)"

  The version of grub:
  $  dpkg -l |grep grub
  ii  grub                            0.97-29ubuntu62                         GRand Unified Bootloader (Legacy version)
  ii  grub-common                     1.99-11ubuntu1                          GRand Unified Bootloader (common files)

  
  Debian Lenny is on /dev/sda:
  $ parted -s /dev/sda print
  Model: ATA VMware Virtual I (scsi)
  Disk /dev/sda: 17.2GB
  Sector size (logical/physical): 512B/512B
  Partition Table: msdos

  Number  Start   End     Size    Type      File system     Flags
   1      32.3kB  354MB   354MB   primary   ext3            boot
   2      354MB   8587MB  8234MB  extended
   5      354MB   3381MB  3027MB  logical   ext3
   6      3381MB  4836MB  1456MB  logical   ext3
   7      4836MB  5338MB  502MB   logical   linux-swap(v1)
   8      5338MB  5601MB  263MB   logical   ext3
   9      5601MB  8587MB  2986MB  logical   ext3

  The root partition of Debian Lenny is /dev/sda1, therefore:
  1. mount /dev/sda1 /mnt/
  2. ls -alFd /mnt/boot/grub/
  drwxr-xr-x 2 root root 1024 2011-08-31 03:12 /mnt/boot/grub/

  3. grub-install --no-floppy --root-directory=/mnt/ /dev/sda        
  Installing GRUB to /dev/sda as (hd0)...

         [ Minimal BASH-like line editing is supported.   For
           the   first   word,  TAB  lists  possible  command
           completions.  Anywhere else TAB lists the possible
           completions of a device/filename. ]
  grub> root (hd0,0)
  grub> setup  --stage2=/mnt//boot/grub/stage2 --prefix=/boot/grub (hd0)
   Checking if "/boot/grub/stage1" exists... yes
   Checking if "/boot/grub/stage2" exists... yes
   Checking if "/boot/grub/e2fs_stage1_5" exists... yes
   Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  21 sectors are embedded.
  succeeded
   Running "install --stage2=/mnt//boot/grub/stage2 /boot/grub/stage1 (hd0) (hd0)1+21 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... failed

  Error 6: Mismatched or corrupt version of stage1/stage2
  grub> quit

  
  After downgrading to the grub version on Natty, i.e. grub_0.97-29ubuntu61, it works:
  $ dpkg -i grub_0.97-29ubuntu61_i386.deb
  dpkg: warning: downgrading grub from 0.97-29ubuntu62 to 0.97-29ubuntu61.
  (Reading database ... 21423 files and directories currently installed.)
  Preparing to replace grub 0.97-29ubuntu62 (using grub_0.97-29ubuntu61_i386.deb) ...
  Unpacking replacement grub ...
  Setting up grub (0.97-29ubuntu61) ...

  root at oneiric:~# grub-install --no-floppy --root-directory=/mnt/ /dev/sda        
  Installing GRUB to /dev/sda as (hd0)...
  Installation finished. No error reported.
  This is the contents of the device map /mnt//boot/grub/device.map.
  Check if this is correct or not. If any of the lines is incorrect,
  fix it and re-run the script `grub-install'.

  (hd0)   /dev/sda
  (hd1)   /dev/sdb

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub/+bug/837815/+subscriptions




More information about the foundations-bugs mailing list