Bug 717321

Summary: Broken Grub boot menu - Wrong disk destination in menu.lst
Product: [openSUSE] openSUSE 12.2 Reporter: Terje J. Hanssen <terjejhanssen>
Component: BootloaderAssignee: Steffen Winterfeldt <snwint>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Major    
Priority: P3 - Medium CC: aschnell, bwiedemann, forgotten_QtBI7gWTIh, jsuchome, locilka, lslezak, pier_andreit, rogers, sabourin.gilles, snwint, ug
Version: Milestone 3   
Target Milestone: ---   
Hardware: Other   
OS: openSUSE 12.2   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: /var/log/YaST2/*
driver update with fixed perl-Bootloader
patch for inst_storage.ycp
corrected patch for /usr/share/YaST2/clients/inst_prepdisk.ycp
patch for /usr/share/YaST2/clients/inst_prepdisk.ycp
/var/log/YaST2/perl-BL-standalone-log

Description Terje J. Hanssen 2011-09-12 18:44:34 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2

On an Asus M4A89 GTD Pro/USB3 based machine with scsi and sata disks I had on beforehand properly installed and working in dualboot

openSUSE Tumbleweed/Gnome x86_64 installed on /dev/sda1
openSUSE 11.4/Gnome x86_64 installed on /dev/sdc3 

1. First I tried a 12.1 M5 Update installation from NET-DVD on the 11.4/sdc3 system disk. This resulted in a broken grub boot menu that didn't work and returned the following error message:

Kernel (hd0,2)/boot/vmlinuz-3.0.0-4-desktop root=/dev/sdc3 ....
Error 22: No such partition

2. Afterwards I also tried a 12.1 M5/Gnome3 New Installation, and got the same error.

3. Doing a Rescue logon and mounting /dev/sdc3, the first sections of the /boot/grub/menu.lst contained:

-------------
# Modified by YaST2. Last modification on lø. sep. 10 18:01:39 CEST 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd2,2)/boot/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 12.1 Milestone 5 - 3.0.0-4
    kernel (hd0,2)/boot/vmlinuz-3.0.0-4-desktop root=/dev/sdc3 resume=/dev/disk/by-id/scsi-200e09e0000baec4c-part1 splash=silent quiet  showopts vga=0x31a
    initrd (hd0,2)/boot/initrd-3.0.0-4-desktop
-----------

That is, while fxmenu points to the right disk (hd2,2),
both the kernel line and initrd line have got wrong disk designation (hd0,2)
and the same errors occure in the Failsafe section not showed here.
This is a new bug in 12.1, as both 11.4 and Tumbleweed have worked correct.



Reproducible: Always

Steps to Reproduce:
1. Update and New Installation on /dev/sdc3 as described above
2.
3.
Actual Results:  
Broken Grub boot menu, Error 22 

Expected Results:  
Should install and create correct disk destination as openSUSE 11.4 and Tumbleweed did on the same machine.
Comment 1 Jiri Srain 2011-09-15 12:41:26 UTC
Could you, please, attach the installation logs?
Comment 2 Terje J. Hanssen 2011-09-15 15:45:58 UTC
Created attachment 451026 [details]
/var/log/YaST2/*
Comment 3 Steffen Winterfeldt 2011-09-16 06:45:33 UTC
Created attachment 451134 [details]
driver update with fixed perl-Bootloader

Could you test with the attached driverupdate? To use it, put
it somewhere and point the 'dud' boot option to it. For example:
'dud=ftp://some_server/foo'.

Please watch the console messages to make sure the driverupdate was applied.
Comment 4 Terje J. Hanssen 2011-09-19 10:36:56 UTC
As this bug was generated from the installation media (DVD iso), I have no idea how I'm able to test the driver update. As I use a rewriteable DVD+RW disk, I can possibly update packages there and retry with a installatio update. 

Though, I had hoped to wait with the next installation until also the Gnome3 desktop works on my hardware https://bugzilla.novell.com/show_bug.cgi?id=717377#c

Could you possibly explain what to do and and how to test this?
Comment 5 Steffen Winterfeldt 2011-09-19 11:27:03 UTC
If you don't have a network, you can put the update on an usb stick and use
something like dud=disk:/foo_update.
Comment 6 Terje J. Hanssen 2011-09-21 21:46:22 UTC
I've never tried a driver update disk before, so I'm sorry this still goes a little over my head. I have currently no usb stick available. What I have is a local rewriteable CD/DVD/BD-device. Beside I have some network connection through the ADS router (modem) between two home machines, that is I can use ssh and sftp from the actual machine to logon by ip-address to the other openSUSE mobile workstation *). I have downloaed the file bug-717321_bl10 in my home directory on the latter. 

So if we can continue from here, I can try to follow detailed instructions further ;) 
I think the command option should be entered on the first installation screen after first booting from the installation DVD (?) ;)

But what is the purpose, is it to test a full new installation on the first machine again to see if the disk destination will be right in menu.lst?

*) Note
I've also installed 12.1 on the mobile workstation which has several distributions installed in multiboot, but on the same physical single disk partioned as required. On this machine the disk destionations became correct in menu.lst. But what I had to do on this machine to get the installation program running, was to enter 'nomodeset' option on the first boot screen.
Comment 7 Steffen Winterfeldt 2011-09-22 13:30:21 UTC
never mind; I've been able to reproduce the issue
Comment 8 Steffen Winterfeldt 2011-09-22 14:04:06 UTC
It's actually an udev related issue.

Latest udev stores its data in /run. So, when yast prepares it's install target
it needs not only to bind mount /dev, /proc, and /sys, but also /run.

This might also affect sle11-sp2, haven't checked yet.

Jiri, is that your area?
Comment 9 Jiří Suchomel 2011-09-22 14:15:20 UTC
Well, probably yes, but I'm not sure where. It's faster to ask: Lukas, where is this done?
Comment 10 Lukas Ocilka 2011-09-22 14:27:00 UTC
It's "$something --bind", which means:

clients/bootloader_finish.ycp:  mount -v --bind /dev ${targetdir}/dev
clients/bootloader_finish.ycp:  y2milestone ("mount --bind cmd: %1", cmd);
clients/bootloader_finish.ycp:  y2milestone ("mount --bind /dev /mnt/dev output: %1", out);
clients/inst_prepdisk.ycp:      + "mount -v --bind /dev '" + String::Quote(Storage::PathToDestdir("/dev")) + "'";
clients/inst_kickoff.ycp:               "/bin/rm -rf '%1/dev/' && /bin/mkdir -p '%1/dev/' && /bin/mount -v --bind '/dev/' '%1/dev/'",
include/autoinstall/io.ycp:                        string cmd = "mount -v --bind `grep "+cdrom_device+" /proc/mounts |cut -f 2 -d \\ ` "+mount_point+";";

I'd say clients/inst_kickoff.ycp for the update process but also clients/bootloader_finish.ycp for storing the bootloader configuration
and also clients/inst_prepdisk.ycp for the installation

IMO worth creating a simple library (or include file) and calling it from
all the other places. Uwe, you might be interested as well.

Also please adjust
list <string> umount_these = ["/proc", "/sys", "/dev"];
in clients/umount_finish.ycp
Comment 11 Jiří Suchomel 2011-09-22 14:46:36 UTC
(In reply to comment #10)

> Also please adjust
> list <string> umount_these = ["/proc", "/sys", "/dev"];
> in clients/umount_finish.ycp


Well, this one is the only clearly understandable place.

But for others: bootloader_finish.ycp is part of yast2-bootloader, inst_prepdisk.ycp part of yast2-storage and inst_kickoff.ycp part of yast2-packager.

Don't we really have a common place where that bind-mounting is done together?
Comment 12 Jiří Suchomel 2011-09-23 06:35:46 UTC
Created attachment 452662 [details]
patch for inst_storage.ycp

Well, disk preparation seems to be correct place for these mounts. Thomas, what do you think about this patch?
Comment 13 Jiří Suchomel 2011-09-23 06:38:21 UTC
Adding Thomas to CC (storage code).

Steffen, could you test the patch during installation? (I could, but I do not know how to verify it helps)
Comment 14 Jiří Suchomel 2011-09-23 06:39:49 UTC
Created attachment 452668 [details]
corrected patch for /usr/share/YaST2/clients/inst_prepdisk.ycp
Comment 15 Steffen Winterfeldt 2011-09-23 06:44:39 UTC
Do you have a complete package?
Comment 16 Jiří Suchomel 2011-09-23 07:08:39 UTC
(In reply to comment #15)
> Do you have a complete package?

https://build.opensuse.org/package/show?package=yast2-storage&project=home%3Ajsuchome

and yast2-installation for unmounting:

https://build.opensuse.org/package/show?package=yast2-installation&project=home%3Ajsuchome
Comment 17 Steffen Winterfeldt 2011-09-23 08:18:59 UTC
no, does not work. /run is not mounted
Comment 19 Jiří Suchomel 2011-09-23 08:26:05 UTC
y2log:

cmd mount -v --bind /run '/mnt/run'
mount: mount point /mnt/run does not exist

Does the directory need to be created before? Thomas, can you check the patch?
Comment 20 Steffen Winterfeldt 2011-09-23 08:26:38 UTC
I think it's this one:

2011-09-23 10:13:41 <1> d146.suse.de(10147) [YCP] clients/inst_prepdisk.ycp:84 cmd mkdir -vp '/mnt/dev'; cp --preserve=all --recursive --remove-destination /lib/udev/devices/* '/mnt/dev'; mount -v --bind /dev '/mnt/dev'
2011-09-23 10:13:41 <1> d146.suse.de(10147) [YCP] clients/inst_prepdisk.ycp:86 ret $["exit":0, "stderr":"", "stdout":"/dev on /mnt/dev type none (rw,bind)\n"]
2011-09-23 10:13:41 <1> d146.suse.de(10147) [YCP] clients/inst_prepdisk.ycp:93 cmd mount -v --bind /run '/mnt/run'
2011-09-23 10:13:41 <3> d146.suse.de(10147) [bash] ShellCommand.cc(shellcommand):78 mount: mount point /mnt/run does not exist
2011-09-23 10:13:41 <1> d146.suse.de(10147) [YCP] clients/inst_prepdisk.ycp:95 ret $["exit":32, "stderr":"mount: mount point /mnt/run does not exist\n", "stdout":""]
2011-09-23 10:13:41 <1> d146.suse.de(10147) [YCP] clients/inst_prepdisk.ycp:109 END of inst_prepdisk.ycp
Comment 21 Jiří Suchomel 2011-09-23 08:37:25 UTC
Would this be correct?

cmd = "mkdir -vp '" + String::Quote(Storage::PathToDestdir("/run")) + "'; "
 + "mount -v --bind /run'" + String::Quote(Storage::PathToDestdir("/run")) + "'";
Comment 23 Arvin Schnell 2011-09-23 10:03:45 UTC
There's a space missing between /run and '. (BTW reminds me that the
String::Quote function is busted to not include the actual quotes.)

It should be identical to the cmd that bind-mounts /dev a few lines above
(and without the cp).
Comment 24 Jiří Suchomel 2011-09-23 10:29:40 UTC
Steffen, please test again with new package:

https://build.opensuse.org/package/show?package=yast2-storage&project=home%3Ajsuchome
Comment 25 Steffen Winterfeldt 2011-09-23 10:54:55 UTC
yast is hanging somewhere after installing packages and preparing config files.

Nothing is unmounted, the gui is gone but it is still running.

Same machine as before.
Comment 26 Jiří Suchomel 2011-09-23 11:08:14 UTC
2011-09-23 12:49:01 <3> d146.suse.de(10143) [qt-ui] YQUI.cc(qMessageHandler):744 Client killed. Possibly caused by X server shutdown or crash.

Have you killed it? I assume unmounting would be done later, but there wasn't changes.


Can you verify that /run was mounted succesfully? It was called with 

mkdir -vp '/mnt/run'; mount -v --bind /run '/mnt/run

Don't we need any special options there?
Comment 27 Steffen Winterfeldt 2011-09-23 11:47:10 UTC
Mounting was ok, and the grub config also correct.

The premature ending yast might not be related. I'll check.
Comment 28 Steffen Winterfeldt 2011-09-23 12:12:30 UTC
there's definitely something broken with install finish, but this bug is fixed
Comment 30 Jiří Suchomel 2011-09-23 12:21:32 UTC
Created attachment 452756 [details]
patch for /usr/share/YaST2/clients/inst_prepdisk.ycp

Arvin, please include this patch in y2-storage.
Comment 31 Jiří Suchomel 2011-09-23 12:46:54 UTC
I've submitted yast2-installation.

I'm not sure if other places mentioned in comment 10 need this change too. Steffen: is mounting of /run needed during update?
Uwe, what about autoinstallation?
Comment 32 Steffen Winterfeldt 2011-09-23 13:16:56 UTC
We will probably need it in all cases where we mounted /dev, /proc etc.
Comment 33 Uwe Gansert 2011-09-23 14:59:52 UTC
in autoyast I do not mount the installed system by myself.
The only case that might be affected is when you create an image with the autoyast UI.
I need to check that.
Comment 35 Jiří Suchomel 2011-10-05 09:37:33 UTC
(In reply to comment #32)
> We will probably need it in all cases where we mounted /dev, /proc etc.

The other places mentioned in comment 10 only mount /dev, not others parts.

What do you, for example think about enhancing bootloader_finish.ycp, which is one of those mentioned?
Comment 36 Steffen Winterfeldt 2011-10-07 07:12:03 UTC
It's needed there.

Shouldn't we have a common function for mounting/unmounting those directories?
Comment 37 Jiří Suchomel 2011-10-07 08:53:00 UTC
OK, so please fix yast2-bootloader.

Ladislav, seems like we need it on yast2-packager (inst_kickoff.ycp) too.

Look at the patch used for storage, in comment 30.
Comment 38 Lukas Ocilka 2011-10-10 07:41:47 UTC
(In reply to comment #36)
> Shouldn't we have a common function for mounting/unmounting those directories?

See comment #10

> IMO worth creating a simple library (or include file) and calling it from
> all the other places.
Comment 39 Craig Rogers 2011-11-18 22:46:43 UTC
I encountered an apparently identical problem using the openSUSE 12.1 x86_64 DVD image that was released to the public this week.  Did the fix discussed above did not make it into the final release?
Comment 40 Terje J. Hanssen 2011-11-19 10:33:17 UTC
Yesterday I did a new installation as a reinstallation on the same machine as initial above, using the final 12.1 x86_64 NET iso. The Grub menu now worked correctly in my case.
Comment 41 Steffen Winterfeldt 2011-11-21 08:41:06 UTC
Craig, if there's still something wrong with your install, please open a new
bug for it and attach yast logs. This issue has been fixed.
Comment 42 Gilles Sabourin 2012-01-02 11:52:32 UTC
Last 2011-12-29, I performed a network upgrade of my virtual openSUSE 11.4 x86_64 using virtualbox. This upgrade let my virtual machine unbootable.
My partition scheme is the simplest one : only one disk, part0 is swap, part1 is root and part2 is home. However, I use LABELED partitions.

After doing a rescue logon from NET CD iso, I saw that I was getting wrong menu.lst entries like "root (hd0)" instead of having "root hd(0,1)"
Also, old menu entries from openSUSE 11.4 were not removed from menu.lst

I am keeping this virtual openSUSE 11.4, so I can easily reproduce it.
Comment 43 pier andre 2012-02-26 12:34:07 UTC
install suse linux dual boot on toshiba C660-13Q (bootmgr is missing problem).
I faced some problem installing opensuse 12.1 dual booted with windows 7 on this laptop, I solved the problems, and this is to say to developers that opensuse has this "strange" behaviour.

I restored windows 7 to factory using the 2 dvd I created before, the result was a three partitioned hard disk
/dev/sda1 ntfs SYSTEM flags boot and diagn
/dev/sda2 ntfs WINDOWS
/dev/sda3 ntfs data

I used Gparted in systemrescuecd to modify partitions in this way,
/dev/sda1 ntfs SYSTEM flags boot and diagn
/dev/sda2 ntfs WINDOWS
/dev/sda4 extended
      /dev/sda5 ext3 SUSE
      /dev/sda6 ext3 home
      /dev/sda7 swap
      /dev/sda8 ext3 dati
/dev/sda3 ntfs data 

I rebooted and windows starts ok after a verification process,

I installed opensuse 12.1 and everything went well,
at reboot linux boots well.
at boot grub shows two windows entry, windows1 and windows2, both gives an error, the windows1 gives this:

rootnoverify (hd0,1)
chainloader +1

bootmgr is missing
ctrl+alt+del to restart 

I discovered that grub fail to recognize that in this case windows boot from /dev/sda1 and not from /dev/sda2 or /dev/sda3,
so to solve the problem you have to boot in linux,
go to yast>system>bootloader, select windows1 entry, click on edit, on "other system" choose /dev/sda1, click ok and approve the install of grub,
or edit /boot/grub/menu.lst file changing this in windows1 section:

###Don't change this comment - YaST2 identifier: Original name: windows 1###
title windows 1
    rootnoverify (hd0,0)>>>>>>>>>>>>>>>>>>>>>>>>>>>> change this in (hd0,0)
    chainloader +1
Comment 44 Terje J. Hanssen 2012-05-01 20:44:26 UTC
The same bug appears now also in openSUSE 12.2 Milestone 3 x86_64.

I did an upgrade installation using openSUSE 12.2 M3 x86_64 DVD on the /dev/sdc3 with 12.1/Tumbleweed. 

On beforehand the /boot/grub/menu.lst contained the disk destination (hd2,2) as follows:

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 12.1 - 3.3.3-21
    root (hd2,2)
    kernel /boot/vmlinuz-3.3.3-21-desktop root=/dev/disk/by-id/scsi-200e09e0000baec4c-part3 resume=/dev/disk/by-id/scsi-200e09e0000baec4c-part1 splash=silent quiet showopts vga=0x345
    initrd /boot/initrd-3.3.3-21-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.1 - 3.3.3-21
    root (hd2,2)
    kernel /boot/vmlinuz-3.3.3-21-desktop root=/dev/disk/by-id/scsi-200e09e0000baec4c-part3 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345
    initrd /boot/initrd-3.3.3-21-desktop

----------------------

After the 12.2 update installation and startup the the root partition wasn't found. 

Looking into the new /boot/grub/menu.lst the disk destination had changed to (hd0,2) as follows:

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 12.2 Milestone 2 - 3.3.0-2
    kernel (hd0,2)/boot/vmlinuz-3.3.0-2-desktop root=/dev/sdc3 resume=/dev/disk/by-id/scsi-200e09e0000baec4c-part1 splash=silent quiet  video=1920x1080 nomodeset showopts vga=0x345
    initrd (hd0,2)/boot/initrd-3.3.0-2-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.2 Milestone 2 - 3.3.0-2
    kernel (hd0,2)/boot/vmlinuz-3.3.0-2-desktop root=/dev/sdc3 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345
    initrd (hd0,2)/boot/initrd-3.3.0-2-desktop
Comment 45 Steffen Winterfeldt 2012-05-02 07:29:24 UTC
please attach /var/log/YaST2/perl-BL-standalone-log
Comment 46 Terje J. Hanssen 2012-05-02 18:05:35 UTC
Created attachment 489200 [details]
/var/log/YaST2/perl-BL-standalone-log
Comment 47 Steffen Winterfeldt 2014-11-11 10:51:37 UTC
This should not happen anymore with recent openSUSE and grub2.