openSUSE 12.2 grub2 problem

Yesterdays kernel update from 3.4.11 to 3.4.28 left me unable to boot. - The PC was stuck at the boot screen. It was unable to find the 3.4.11 kernel. I did get it to boot by booting the install DVD, used the Rescue System, chroot, and then:

# grub2-mkconfig -o /boot/grub2/grub.cfg 

I did try to use yast when I was in the chroot but when I went into >system >>bootloader I received this:

Error:   because of the partitioning the bootloader cannot be installed properly


The PC has only 1 operating system openSUSE 12.2 64 bit. - I did a new installation from the install DVD. - The PC had openSUSE 12.1 on it but I did not perform an upgrade.

I do remember having issues right after I installed the system with getting the PC to boot, but I can’t find my notes with how I “fixed it” then.

The disk layout is:

 baird-suse:~ # fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c7d83

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    37752831    18875392   83  Linux
/dev/sda2        37752832    46139391     4193280   82  Linux swap / Solaris
/dev/sda3        46139392   312580095   133220352   83  Linux

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bef49

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048   488396799   244197376   83  Linux  
baird-suse:~ # cat /etc/fstab
/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WCAV26464221-part2 swap                 swap       defaults              0 0
/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WCAV26464221-part1 /                    ext4       acl,user_xattr        1 1
/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WCAV26464221-part3 /home                ext4       acl,user_xattr        1 2
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
/dev/disk/by-id/ata-WDC_WD2500AAJS-55M0A0_WD-WCAV2W720129-part1 /mnt/share           ext4       acl,user_xattr        1 2

I did look through this forum thread https://forums.opensuse.org/english/get-technical-help-here/install-boot-login/478220-trouble-installing-12-2-grub2-efi.html . This is similar to my problem but this is a desktop PC without efi.

 baird-suse:~ # findgrub
Find Grub Version 4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> Grub2 (1.99) found in sda MBR     => sda?   0x?? (openSUSE)
 - reading bootsector  /dev/sda1   *  (LINUX)         ... --> Grub2 (1.99) found in /dev/sda1   => sda?   0x?? (openSUSE)
 - skipping partition  /dev/sda2      (swap)         
 - reading bootsector  /dev/sda3      (LINUX)         ...

 - reading MBR on disk /dev/sdb                       ... --> Grub2 (1.99) found in sdb MBR     => sda?   0x?? (openSUSE)
 - reading bootsector  /dev/sdb1   *  (LINUX)         ...


Press <enter> to Exit findgrub...
 baird-suse:~ # findgrub -M
Find Grub Version 4.1 - Written for openSUSE Forums

--- DEVICE.MAP: sda is ata drive hd0
--- DEVICE.MAP: looking for /dev/sda in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sda -> hd0
--- DEVICE.MAP: - /dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WCAV26464221
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_WDC_WD1600AAJS-_WD-WCAV26464221
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x50014ee1aca9145c
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:0
--- DEVICE.MAP: - /devices/pci0000:00/0000:00:11.0/ata1/host0/target0:0:0/0:0:0:0/block/sda
--- DEVICE.MAP: => sda - found in device.map - is now hd0
--- DEVICE.MAP:
--- DEVICE.MAP: sdb is ata drive hd1
--- DEVICE.MAP: looking for /dev/sdb in /boot/grub/device.map:
--- DEVICE.MAP: - /dev/sdb -> hd1
--- DEVICE.MAP: - /dev/disk/by-id/ata-WDC_WD2500AAJS-55M0A0_WD-WCAV2W720129
--- DEVICE.MAP: - /dev/disk/by-id/scsi-SATA_WDC_WD2500AAJS-_WD-WCAV2W720129
--- DEVICE.MAP: - /dev/disk/by-id/wwn-0x50014ee158c0589d
--- DEVICE.MAP: - /dev/disk/by-path/pci-0000:00:11.0-scsi-1:0:0:0
--- DEVICE.MAP: - /devices/pci0000:00/0000:00:11.0/ata2/host1/target1:0:0/1:0:0:0/block/sdb
--- DEVICE.MAP: => sdb - found in device.map - is now hd1
--- DEVICE.MAP:
--- DEVICE.MAP: !invalid drive in device.map: /dev/fd0 

How do I correct the problem so the next kernel update doesn’t leave me unable to boot again?

Thanks

Mark

On 2013-02-10 22:06, chiefpete wrote:
> How do I correct the problem so the next kernel update doesn’t leave me
> unable to boot again?

Configure for having multiple versions of a kernel installed, so that
the previous version is not immediately deleted.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

I had forgot about the ability to keep older kernel versions.

Thanks
Mark

I am not seeing anything wrong in your listing. I am thinking that the partition took a data hit for some reason. If this was me I would just reinstall. But, select custom partitioning, for experts only. Select all existing partitions and mount them exactly the same as before. Allow the root / partition and swap to be formatted, but mount only /home and /mnt/share but I would not use any preexisting partition names like mnt. I use primary folder names like /Software, /DataSafe, /MultiMedia & /Windows but nothing created by openSUSE in its default installation. I normally make sure the Partition I create has the chmod of 777 and usable by all even though the fstab sets the rest. Unmount the mount long enough to check change its chmod number and restart when done. Carlos makes a good point on saving multiple kernels.

For permissions, have a look at this bash script:

S.A.F.P. - SUSE Automated File Permissions - Version 1.0.4: https://forums.opensuse.org/blogs/jdmcdaniel3/s-f-p-suse-automated-file-permissions-version-1-0-4-113/

Thank You,

I do: all the boot loaders are invalid.

findgrub should not have problem to find the core of Grub2 (1.99). It might still fail with some boot loaders of Grub2 (2.00), under some distros, but not openSUSE (at least, we got that one).

Try findgrub -c. It should find the core and look like the example below (which includes openSUSE 12.1 Grub2 core):

# findgrub -c
Find Grub Version 4.4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> Grub2 (1.99) found in sda MBR     => sda6   0x83 using core (Ubuntu)
 - searching partition /dev/sda1      (FAT16)         ... --> Windows NT/2K/XP Loader found in /dev/sda1

 - skipping partition  /dev/sda2      (FreeBSD)      
 - skipping partition  /dev/sda3      (FreeBSD)      
 - reading bootsector  /dev/sda4   *  (Extended)      ... --> Legacy GRUB  found in /dev/sda4   => sda9   0x83 at offset 582502656 (openSUSE)
                                                                                                => inode: 393986   Path: (hd0)/boot/grub/stage2
 - skipping partition  /dev/sda5      (swap)         
 - reading bootsector  /dev/sda6      (LINUX)         ...
 - reading bootsector  /dev/sda7      (LINUX)         ...
 - reading bootsector  /dev/sda8      (LINUX)         ...
 - reading bootsector  /dev/sda9      (LINUX)         ... --> Legacy GRUB  found in /dev/sda9   => sda9   0x83 at offset 582502656 (openSUSE)
                                                                                                => inode: 393986   Path: (hd0)/boot/grub/stage2
 **- reading bootsector  /dev/sda10     (LINUX)         ... --> Grub2 (1.99) found in /dev/sda10  => sda9   0x83 at offset 616960472 (openSUSE)
                                                                                                => inode: 394914   Path: (hd0)/boot/grub2/core.img
 **- reading bootsector  /dev/sda11     (LINUX)         ... --> Grub2 (1.99) found in /dev/sda11  => sda11  0x83 at offset 655821248 (Ubuntu/Mint)
                                                                                                => inode: 1052453  Path: (hd0)/boot/grub/core.img
 - reading bootsector  /dev/sda12     (LINUX)         ...
 - reading bootsector  /dev/sda13     (LINUX)         ... --> Legacy GRUB  found in /dev/sda13  => sda13  0x83 at offset 705130602 (Mandriva/ArchLinux/Debian)
                                                                                                => inode: 23920    Path: (hd0)/boot/grub/stage2
 - reading bootsector  /dev/sda14     (LINUX)         ...
 - reading bootsector  /dev/sda15     (LINUX)         ...
 - reading bootsector  /dev/sda16     (LINUX)         ... --> Legacy GRUB  found in /dev/sda16  => sda16  0x83 at offset 784242820 (Mandriva/ArchLinux/Debian)
                                                                                                => inode: 15950    Path: (hd0)/boot/grub/stage2
 - reading bootsector  /dev/sda17     (LINUX)         ...

 - reading MBR on disk /dev/sdb                       ... --> Grub2 (1.99) found in sdb MBR     => sda6   0x83 using core (Ubuntu)
 - searching partition /dev/sdb1   *  (FAT16)         ... --> Windows NT/2K/XP Loader found in /dev/sdb1

 - skipping partition  /dev/sdb2      (FreeBSD)      
 - skipping partition  /dev/sdb3      (FreeBSD)      
 - reading bootsector  /dev/sdb4      (Extended)      ... --> Legacy GRUB  found in /dev/sdb4   => sda9   0x83 at offset 582155312 (openSUSE)
                                                                                                => inode: 394000   Path: (hd0)/boot/grub/stage2.old
 - skipping partition  /dev/sdb5      (swap)         
 - reading bootsector  /dev/sdb6      (LINUX)         ... --> Legacy GRUB  found in /dev/sdb6   => sdb6   0x83 at offset 640035343 (Mandriva/ArchLinux/Debian)
                                                                                                => inode: 40185    Path: (hd1)/boot/grub/stage2
 - reading bootsector  /dev/sdb7      (LINUX)         ...
 - reading bootsector  /dev/sdb8      (LINUX)         ...
 - reading bootsector  /dev/sdb9      (LINUX)         ...
 - reading bootsector  /dev/sdb10     (LINUX)         ...
 - reading bootsector  /dev/sdb11     (LINUX)         ...
 - reading bootsector  /dev/sdb12     (LINUX)         ...
 - reading bootsector  /dev/sdb13     (LINUX)         ...


Press <enter> to Exit findgrub...

Anyway, we already know that this system doesn’t boot.

Since I recreated grub.cfg the PC does boot, but I think that something is messed up with the boot loader.

 baird-suse:~ # findgrub -c
Find Grub Version 4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> Grub2 (1.99) found in sda MBR     => sda?   0x?? using core (openSUSE)
 - reading bootsector  /dev/sda1   *  (LINUX)         ... --> Grub2 (1.99) found in /dev/sda1   => sda?   0x?? at offset 14031904 (openSUSE)/usr/bin/findgrub: line 276: : too many arguments

 - skipping partition  /dev/sda2      (swap)         
 - reading bootsector  /dev/sda3      (LINUX)         ...

 - reading MBR on disk /dev/sdb                       ... --> Grub2 (1.99) found in sdb MBR     => sda?   0x?? using core (openSUSE)
 - reading bootsector  /dev/sdb1   *  (LINUX)         ...


Press <enter> to Exit findgrub..  

I’d rather fix it than reload the system

Thanks
Mark

On 2013-02-11 01:26, please try again wrote:
> jdmcdaniel3;2526160 Wrote:
>> > I am not seeing anything wrong in your listing.
> I do: all the boot loaders are invalid.

I’m a bit thick and tired now, but I think I have seen several people
today with an unbootable systems after an update. :-?


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

I’m trying to think back. Grub2 was not installed with 12.1 but was available from repo. You could have installed it yourself (or with updategrub), and it was indeed version 1.99.

Now Grub2 is installed by default with version 12.2, and it is version 2.00.
Since you can boot, could you post the output of these commands (as root):

# grub2-probe --version
# lsb_release -a
# uname -a
# rpm -qa | grep grub
 
 baird-suse:~ # findgrub -c
Find Grub Version 4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> Grub2 (1.99) found in sda MBR     => sda?   0x?? using core (openSUSE)
 - reading bootsector  /dev/sda1   *  (LINUX)         ... --> Grub2 (1.99) found in /dev/sda1   => sda?   0x?? at offset 14031904 (openSUSE)/usr/bin/findgrub: line 276: : too many arguments

Not fun! :frowning:

 baird-suse:~ # grub2-probe --version
grub2-probe (GRUB2) 2.00
baird-suse:~ # lsb_release -a
LSB Version:    n/a
Distributor ID: SUSE LINUX
Description:    openSUSE 12.2 (x86_64)
Release:        12.2
Codename:       Mantis
baird-suse:~ # uname -a
Linux baird-suse 3.4.28-2.20-desktop #1 SMP PREEMPT Tue Jan 29 16:51:37 UTC 2013 (143156b) x86_64 x86_64 x86_64 GNU/Linux
baird-suse:~ # rpm -qa | grep grub
grub2-2.00-1.23.1.x86_64
grub2-branding-openSUSE-12.2-11.18.5.noarch
grub-0.97-185.1.2.x86_64  

I appreciate the help.
Mark

Let me say that while you don’t want to reload, you have invalid data and by the time you fix it, you could have already reinstalled your system. My suggested install does not wipe out your /home area and if after that it still does not work, there was nothing there to save in the first place. Of course you make the final choice, but if time means anything to you, I would take the shortest path to a working system. And I do wish you much luck in getting it all back online.

Thank You,

Is that possible that noone (or nothing) updated the boot loader. You seem to have Grub2 (1.99) boot loader signature in your bootsectors(s) but Grub2 (2.00) installed on your hard disk. Either findgrub is wrong by reading the signature - which would mean that the latest Grub2 (2.00) has changed, because on a 12.2 system with Grub2 (2.00), this is what I get (in blue):

 # findgrub -c
Find Grub Version 4.4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> Grub2 (1.99) found in sda MBR     => sda6   0x83 using core (Ubuntu)
 - searching partition /dev/sda1      (FAT16)         ... --> Windows NT/2K/XP Loader found in /dev/sda1

 - skipping partition  /dev/sda2      (FreeBSD)      
 - skipping partition  /dev/sda3      (FreeBSD)      
 - reading bootsector  /dev/sda4   *  (Extended)      ... --> Legacy GRUB  found in /dev/sda4   => sda9   0x83 at offset 280911943 (INVALID)
                                                                                                => inode: 1312923  Path: **(hd0)/usr/share/YaST2/modules/DNS.ybc**
 - skipping partition  /dev/sda5      (swap)         
 - reading bootsector  /dev/sda6      (LINUX)         ...
 - reading bootsector  /dev/sda7      (LINUX)         ...
 - reading bootsector  /dev/sda8      (LINUX)         ...
** - reading bootsector  /dev/sda9      (LINUX)         ... --> Grub2 (2.00) found in /dev/sda9   => sda9   0x83 at offset 243364159 (openSUSE)
                                                                                                => inode: 131350   Path: (hd0)/boot/grub2/i386-pc/core.img**
 - reading bootsector  /dev/sda10     (LINUX)         ...
 - reading bootsector  /dev/sda11     (LINUX)         ...
 - reading bootsector  /dev/sda12     (LINUX)         ... --> Grub2 (1.99) found in /dev/sda12  => sda12  0x83 at offset 332203738 (Fedora)
                                                                                                => inode: 1442458  Path: (hd0)/boot/grub2/core.img
 - reading bootsector  /dev/sda13     (LINUX)         ...
 - reading bootsector  /dev/sda14     (LINUX)         ...
 - reading bootsector  /dev/sda15     (LINUX)         ...

 - reading MBR on disk /dev/sdb                       ... --> Legacy GRUB  found in sdb MBR     => sda11  0x83 using stage1.5 (openSUSE)
 - searching partition /dev/sdb1      (FAT16)         ... --> Windows NT/2K/XP Loader found in /dev/sdb1

 - skipping partition  /dev/sdb2      (FreeBSD)      
 - skipping partition  /dev/sdb3      (FreeBSD)      
 - reading bootsector  /dev/sdb4   *  (Extended)      ... --> Legacy GRUB  found in /dev/sdb4   => sda12  0x83 at offset 320934114 (INVALID)
                                                                                                => inode: <block not found> Path: invalid
 - skipping partition  /dev/sdb5      (swap)         
 - reading bootsector  /dev/sdb6      (LINUX)         ... --> Legacy GRUB  found in /dev/sdb6   => sdb6   0x83 at offset 644842047 (Mandriva/ArchLinux/Debian)
                                                                                                => inode: 184752   Path: (hd1)/boot/grub/stage2
 - reading bootsector  /dev/sdb7      (LINUX)         ...
 - reading bootsector  /dev/sdb8      (LINUX)         ...
 - reading bootsector  /dev/sdb9      (LINUX)         ...
 - reading bootsector  /dev/sdb10     (LINUX)         ...
 - reading bootsector  /dev/sdb11     (LINUX)         ...
 - reading bootsector  /dev/sdb12     (LINUX)         ...


Press <enter> to Exit findgrub...

I know, a couple boot loaders are invalid on this old machine (I highlighted the one in red as an example: the file in this inode in NOT what the boot loader expects This will produce a “file not found” error of some kind at boot).

I’m updating another system right now to check if there are problems. I haven’t updated for a while … maybe I will end up in the same situation. lol!

What is in /etc/default/grub_installdevice?

Which disk is your BIOS boot disk?

baird-suse:~ # cat /etc/default/grub_installdevice
/dev/sdb1
/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WCAV26464221-part1
/dev/sda
activate 

I see that there is also a file called grub_installdevice.old with just /dev/sda in it.

Mark

And my second question?

1st boot device is DVDRAM

2nd boot device is HDD
Hard Disk Boot Priority
WD1600AAJS-00L7A0 which I believe to be /dev/sda
WD2500AAJS-55M0A0 which I believe to be /dev/sdb
Boot Add-in Cards

3rd boot device USB

Mark

The info was provided in post #1 by findgrub -M.

OK, so in your configuration it is indeed not possible to install grub2 on /dev/sdb1. Assuming YaST2 takes first device in the list, error is more or less correct.

To manually install grub2 into MBR of the /dev/sda - boot into rescue mode using installation DVD and then execute:

mkdir /tmp/sysroot
mount /dev/sda1 /tmp/sysroot
mount --bind /sys /tmp/sysroot/sys
mount --bind /dev /tmp/sysroot/dev
mount --bind /run /tmp/sysroot/run
mount --bind /proc /tmp/sysroot/proc
chroot /tmp/sysroot
grub2-install /dev/sda
grub2-mkconfig -o /boot/grub2/grub.cfg

You can double check installation using bootinfoscript (I maintain local GIT repo with some cleanups and fixes suggested but not integrated upstream - https://github.com/arvidjaar/bootinfoscript/raw/master/bootinfoscript). Actually I would be interested in results showing both current state and state after grub2 installation, could you upload them to SUSE Paste)?

After booting, go into YaST2 bootloader, uncheck everything except “Boot from MBR” (including “install generic MBR”) and then make sure /etc/default/grub_install does not contain any device besides /dev/sda ot (hd0) - I am not sure what YaST2 puts there. I have seen it not changing this file even after changes in GUI, so you may need to simply edit it. This file is where perl-Bootloader gets information about bootloader location and per-Bootloader runs when you update kernel …

I’m still rather surprised how did you manage to install 12.2 witout actually updating bootloader to 12.2 …

OK, finally have some more time to work on this.

Here is the results of the bootinfoscript before re-installing grub2 to the mbr of /dev/sda SUSE Paste

I used the DVD Rescue System mounted & then chroot into /dev/sda1

grub2-install /dev/sda

Returned: Installation finished no error reported

grub2-mkconfig -o /boot/grub2/grub.cfg

Returned:

 generating grub.cfg
found them /boot/grub2/themes/openSUSE/theme.txt
found linuximage /boot/vmlinuz-3.4.28-2.20-desktop
generating image /boot/initrd-3.4.28-2.20-desktop
error opening path /mounts/instsys/sys/block
error failed to discover devices
error opening path /mounts/instsys/sys/block
error failed to discover devices
error opening path /mounts/instsys/sys/block
error failed to discover devices
error opening path /mounts/instsys/sys/block
error failed to discover devices
No volume groups found 

I rebooted and ran bootinfoscript again: SUSE Paste
In Yast2 >System >>Bootloader I unchecked all except Boot from Master Boot Record.

I checked /etc/default/grub_installdevice and found:


baird-suse:~ # cat /etc/default/grub_installdevice
/dev/sdb 

I checked /boot/grub2/device.map and found:


baird-suse:/boot/grub2 # cat device.map
(hd0)   /dev/disk/by-id/ata-WDC_WD2500AAJS-55M0A0_WD-WCAV2W720129
(hd1)   /dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WCAV26464221 

I changed it to reflect what I think it should be.


baird-suse:/boot/grub2 # cat device.map
(hd1)   /dev/disk/by-id/ata-WDC_WD2500AAJS-55M0A0_WD-WCAV2W720129
(hd0)   /dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WCAV26464221 

and ran Yast2 >System >>Bootloader and made sure that Boot from Master Boot Record was the only item checked.

When I check /etc/default/grub_installdevice


baird-suse:~ # cat /etc/default/grub_installdevice
/dev/sda 

I rebooted and the system did come up. I again rebooted into the Rescue System and re-ran grub2-mkconfig with the same errors showing. I don’t know if those errors mean anything.

Thanks

Mark

Hmm … according to this you already have grub 2.00 installed on both MBRs. Wonder why you could not boot.

I rebooted and the system did come up.

All is well that ends well :slight_smile:

I again rebooted into the Rescue System and re-ran grub2-mkconfig with the same errors showing. I don’t know if those errors mean anything.

You can ignore them. Those are mount points in rescue system, and we do not “replicate” them into chroot so they are not found. They can be ignored.

Could you do me a favor. It seems bootinfoscript incorrectly detects second grub installation. Could you make available first 1MB from sdb (or from both sdb and sda foro that matter)? I believe, SUSE paste allows binary upload.


dd if=/dev/sdb of=sdb.mbr count=2048
bzip2 -9 sdb.mbr

And upload sdb.mbr.bz2. It should be compressed well (I expect it to be mostly zeroes anyway). Thank you in advance!

I can’t figure out how to upload these files to susepaste. Another hosting site?

Mark