Bug 848576

Summary: Update RC1 -> RC2 produces broken menu.lst
Product: [openSUSE] openSUSE Tumbleweed Reporter: George Baltz <GeoBaltz>
Component: YaST2Assignee: Lukas Ocilka <locilka>
Status: RESOLVED WONTFIX QA Contact: Jiri Srain <jsrain>
Severity: Minor    
Priority: P3 - Medium CC: aschnell, jreidinger, locilka, snwint
Version: 13.1 Beta 1   
Target Milestone: ---   
Hardware: x86-64   
OS: SUSE Other   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Screen photo of error
/boot/grub/menu.lst from prior system
menu.lst after performing update
tar of /var/log/YaST2/ as requested
/var/log/pbl.log as requested

Description George Baltz 2013-10-31 20:37:11 UTC
Performed update RC1->RC2 (DVD image on USB); when I tried to reboot, machine hung.  Hit ESC and found it waiting for a bogus device; tried entering Y to fallback, but no joy.  Photo attached(as 1st reply)

Workaround: Entered 'root=/dev/sda7' on boot line, and I'm writing this on that system now.
Comment 1 George Baltz 2013-10-31 20:39:36 UTC
Created attachment 565798 [details]
Screen photo of error

No place for attachments in simple bug entry...
Comment 2 George Baltz 2013-10-31 20:42:31 UTC
Created attachment 565799 [details]
/boot/grub/menu.lst from prior system
Comment 3 George Baltz 2013-10-31 20:43:33 UTC
Created attachment 565800 [details]
menu.lst after performing update
Comment 4 Jiri Srain 2013-11-05 07:03:40 UTC
In other words, the problem is that system switched from by-id to devices. Any idea about the reason, like e.g. setting the DEVICE_NAMES variable in /etc/sysconfig/storage? What does the value say?
Comment 5 George Baltz 2013-11-05 18:53:01 UTC
Current value:

gwb@gidney:~> grep DEVICE /etc/sysconfig/storage 
DEVICE_NAMES="id"

I wouldn't mind it using devices names, if it used the correct one.  Only one HDD, so no sdb.  And why only for root= ?
Comment 6 Jiri Srain 2013-11-07 08:23:33 UTC
Well, when you have a USB stick inserted, you instantly have two HDDs. And it can differ between boots which one is sda and sdb when you boot with a different initrd (which is the case - installation initrd differs from the one the installation creates.
Comment 7 Steffen Winterfeldt 2013-11-07 12:26:13 UTC
Please attach /var/log/YaST2/ and /var/log/pbl.log.
Comment 8 George Baltz 2013-11-07 20:40:14 UTC
Created attachment 566569 [details]
tar of /var/log/YaST2/  as requested
Comment 9 George Baltz 2013-11-07 20:41:54 UTC
Created attachment 566570 [details]
/var/log/pbl.log    as requested
Comment 10 Steffen Winterfeldt 2013-11-08 09:48:27 UTC
The problem is that Storage::GetMountPoints() returns /dev/sdb7 for '/' even though fstab has the correct /dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part7.

Cf. 'Storage.rb:5397' in y2log-1.
Comment 11 Arvin Schnell 2013-11-08 10:58:34 UTC
Storage::GetMountPoints() returns the device name by design. The bootloader
code even converts the result to a more useful value depending on the
mountby method. Unfortunately RootPart.rb sets that to `device for /.

modules/RootPart.rb:183 Setting partition data: Device: /dev/sdb7, MountPoint: /
modules/Storage.rb:5414 SetPartitionData device=/dev/sdb7 key=mount value=/
modules/Storage.rb:5414 SetPartitionData device=/dev/sdb7 key=mountby value=`device
Comment 12 Steffen Winterfeldt 2013-11-08 12:02:45 UTC
There are apparently two issues:

1) yast2-storage for some reason says to use by-device for sdb7
2) yast2-bootloader doesn't use by-id even if yast2-storage said so

But fortunately this normally doesn't matter because the first kernel install
will fix menu.lst. RC1 -> RC2 didn't have a kernel update, so the bug became
visible.
Comment 13 Arvin Schnell 2013-11-08 12:55:30 UTC
The reason for point 1 is the update code as explained in comment #11.
But bootloader must be fixed anyway, thus assigning to Steffen.
Comment 14 Josef Reidinger 2014-04-03 08:37:19 UTC
I check code in bootloader and in fact it do exactly what storage want. It found that device /dev/sdb7 is mounted by :device and not by :id .
Arvin see e.g. line 3210 so bootloader (sdb7 => mountby => :device) code works as expected.
Comment 15 Arvin Schnell 2014-04-03 14:23:51 UTC
And yast2-storage returns the data yast2-update sets, see comment #11.
Comment 16 Josef Reidinger 2014-04-03 14:33:23 UTC
arvin - it is handled in this code https://github.com/yast/yast-update/blob/master/src/modules/RootPart.rb#L193

From log:
3122 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/RootPart.rb:183 Setting partition data: Device: /dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part8, MountPoint: /home
3123 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=/dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part8 key=mount value=/home
3124 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=/dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part8 key=mountby value=`id
3125 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/RootPart.rb:183 Setting partition data: Device: proc, MountPoint: /proc
3126 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=proc key=mount value=/proc
3127 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=proc key=mountby value=`label
3128 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/RootPart.rb:183 Setting partition data: Device: sysfs, MountPoint: /sys
3129 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=sysfs key=mount value=/sys
3130 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=sysfs key=mountby value=`label
3131 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/RootPart.rb:183 Setting partition data: Device: /dev/sdb7, MountPoint: /
3132 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=/dev/sdb7 key=mount value=/
3133 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=/dev/sdb7 key=mountby value=`device
3134 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/RootPart.rb:224 Setting swap partition data: Device: /dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part6
3135 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=/dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part6 key=mount value=swap
3136 2013-10-31 16:15:06 <1> linux(2569) [Ruby] modules/Storage.rb:5414 SetPartitionData device=/dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part6 key=mountby value=`id 

so as you can see for /dev/sdb7 it returns in target map :device /dev/sdb7
but for rest it return correct by-id device like /dev/disk/by-id/ata-ST9250315AS_6VCLFYMY-part8 for /home.

So do you have idea why it return different device? ( beside that code in update is really quite stupid and fragile from my POV)
Comment 17 Arvin Schnell 2014-04-03 15:12:51 UTC
The values are taken from @activated (which is logged).

AFAIS the code goes through all potential devices (using kernel device
names), mounts them and looks for a fstab. The root device is then added
to @activated while the other devices and takes from the found fstab.
Thus the root device uses the kernel device name.

The code seems indeed fragile and broken, e.g. the mount-by detection
in AddToTargetMap does not handle by-path or by-uuid. I suppose the code
only gets a bug fix once in a while but otherwise no attention.
Comment 18 Lukas Ocilka 2014-04-04 09:01:02 UTC
Possible fix would be:

...
the code goes through all potential devices (using kernel device
names), mounts them and looks for a fstab. The root device is then added
to @activated
...

Root device should be taken from the fstab found, so instead of using
/dev/sd... anything found in fstab with mountpoint "/" would be used.
Comment 19 Lukas Ocilka 2014-04-17 13:11:01 UTC
I'll have a look.

But this is low-prio now, sorry.
Comment 20 Josef Reidinger 2016-11-25 14:07:44 UTC
we no longer support grub1. so sorry, we do not find time for it till it is obsoleted.