Install rearranged sda drive order and grub questions

I freely admit I still do not understand the grub and install. And I may not have used the correct terminology nor have remembered things correctly in the following.

I installed 42.2 on a separate partition. I chose my abandoned 42.1 partition to overwrite. It was on partition sda6. In the setup list, it showed the new drive would be sda8. Which moved my 13.1 from sda7 to sda6. Not knowing that it mattered, and not knowing what else to do about changing it, I let it install. I had thought each sda set was for each install. Guess not…

I also said to only install the the boot code into the boot partition (sda8). I left the MBR and my sda1 old grub boot alone, so I thought. In the past, in trying to understand this very confusing to me grub stuff, I installed 13.1 boot code in the extended partition (sda4), also.

After installation, I went to boot into my 13.1 boot code extended partition. It gave an error message, something about no executable code found. It should have showed a menu of 13.1 and everything else I had set up. I find that odd, unless 42.2 overwrote the extended partition code or wiped it?

So I chose my 13.1 direct partition (however you say that?), and it gave timeout error messages. I think it was avahi or something. It booted, but the screen had serious problems with black patterns at times and didn’t update properly. Changing the old grub menu to hd0,5 (sda6), from sda7, now everything seems to work. I had chosen in 13.1 to boot by label so I wouldn’t have such problems. Guess that didn’t work out.
(And as an aside note, 42.2 deleted the volume label in the swap partition. I could have labeled it at install but forgot to think of it.)

Anyway, I now have 13.1 booting ok and 42.2 booting ok. I just don’t understand things, though.

  1. Shouldn’t my sda4 extended partition have it’s old 13.1 boot code left alone?
  2. Is the sda order fixed to the drive itself? How do you keep the same sda partition order?
    I had thought installing over an existing sda6 42.1 partition, it wouldn’t have to renumber it. Any way to force the same number?
  3. When the install asks about “install boot code into MBR”, what exactly does this do? What is boot code, can I tell if boot code is there, and if so, what boot code? Is this same as a grub menu or something else or both?
    The reason I haven’t chosen to install any successive version into the MBR is I’m afraid it might do unknown things and not allow me to boot my previous system. I might have learned a few things and be able to quickly adjust it now, but the fear is still there.

I don’t understand all the differences of MBR, boot code, menu. I “think” MBR just passes control over to a partition. I’ve tried to set the flag to boot a partition directly, but it doesn’t seem to work. Is there a way to determine if my system allows direct booting of an extended partition like sda8? I “think” boot code and the grub menu must be different as some partitions seem to have a menu but won’t boot. Is there a way to determine if there is boot code in a partition?

Please at least show what the partitioning is now. So we have something to look at while reading your story:

su -c 'fdisk -l'

And when yiou have the same listing of the status before you started doing things, please post it also. But you probably do not have it.

There are many ways to do MBR booting. If you install generic code to MBR then the boot flag is used. But it does not work on partition in an extended partition. If you use grub code in MBR it just points to the partition that you last installed unless you did not mode the MBR code.

And yes we need to see details to unravel further.

Here’s from 42.2:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: dos
Disk identifier: 0x000325f8

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *        16065    160649    144585  70.6M 83 Linux
/dev/sda2          161792   4370431   4208640     2G 82 Linux swap / Solaris
/dev/sda3        16885760 100761599  83875840    40G 83 Linux
/dev/sda4       100761600 976773119 876011520 417.7G  f W95 Ext'd (LBA)
/dev/sda5       314665218 976768064 662102847 315.7G 83 Linux
/dev/sda6       186740736 274823167  88082432    42G 83 Linux
/dev/sda7       274825216 314664959  39839744    19G 83 Linux
/dev/sda8       100763648 186738687  85975040    41G 83 Linux

And here’s from some distant past:

  Disk /dev/sda: 500.1 GB, 500107862016 bytes
  255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x000325f8

     Device Boot      Start         End      Blocks   Id  System
  /dev/sda1   *       16065      160649       72292+  83  Linux
  /dev/sda2          160650    16884314     8361832+  82  Linux swap / Solaris
  /dev/sda3        16884315   100759679    41937682+  83  Linux
  /dev/sda4       100761600   976773119   438005760    f  W95 Ext'd (LBA)
  /dev/sda5       314665218   976768064   331051423+  83  Linux
  /dev/sda6       100763648   186738687    42987520   83  Linux
  /dev/sda7       186740736   274823167    44041216   83  Linux
  /dev/sda8       274825216   314664959    19919872   83  Linux                                                 
                                                                                                                
  Partition table entries are not in disk order

Here is what was working in the old grub menu to boot the 13.1 grub2 menu but no longer working:
rootnoverify (hd0,3)
chainloader +1

error: file ‘/boot/grub2/i386-pc/normal.mod’ not found

IMO
The disk and partition ordering has not changed though it looks like some there might have been some re-sizing which should not affect grub.

Also, AFAIK in the grub menu entries are not ordered by their disk ordering, they’re ordered by the kernel name. You’ll need to maybe post a couple screenshots or describe better exactly what the ordering change is.

As for your old and new boot process, it’s possible that the disk and partition identification has changed although AFAIK that should not be the case in an upgrade. To verify, compare and if necessary post the contents of fstab, not fdisk.

cat /etc/fstab

TSU

Maybe I said it wrong. The actual disk start locations are not changed. But notice
/dev/sda6 100763648 186738687 42987520 83 Linux

in the second list is now

/dev/sda8 100763648 186738687 85975040 41G 83 Linux

in the first list. Which changed my sda7 to sda6.

Old grub for booting 13.1 had:
root (hd0,6)
kernel /boot/vmlinuz root=UUID=d42a4dec-f134-41c4-9d00-9e22303ab32a resume=/dev/disk/by-label/SwapSpace splash=silent quiet showopts
initrd /boot/initrd

Which I changed to (hd0,5)

It probably has left it, although I am not sure how it matters here - I do not see how extended partition is used for booting based on output you shown.

  1. Is the sda order fixed to the drive itself?

Yes, partitions and their numbering are defined on disk itself.

How do you keep the same sda partition order?

Normally I do not expect it to change during installation, unless you explicitly request changing layout. But here not only partition 6,7 and 8 were reordered, but also partitions 2 and 3 were changed. It is hard to tell why. You may consider opening bug report and attaching installer logs so it can be analyzed. Installer reordering partitions on its own does not sound like good thing.

What is boot code, can I tell if boot code is there, and if so, what boot code?

Run GitHub - arvidjaar/bootinfoscript and upload result to http://susepaste.org/, then we have better overview what is installed on your system.

The partition table on the drive shows things in creation order not in the order of the sector numbers. If you remove several partitions and recreate then you may get different orders as per sectors depending on start and end sectors but the partition numbers will be in the order created. BTW deleting and recreating also generates different UUID values which may effect mounting on existing OS.

If you simply reuse just reformatting without deleting partitions things will not change.

I think I’ve looked at bootinfoscript before. I see now that grub is booting to the msdos7 instead of the new msdos6, same issue as in my sda1 grub.


============================= Boot Info Summary: ===============================

 => Windows 2000/XP/2003 is installed in the MBR of /dev/sda.
...

sda4: __________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  Grub2 (v1.99-2.00)
    Boot sector info:  Grub2 (v2.00) is installed in the boot sector of sda4 
                       and looks at sector 261344584 of the same hard drive 
                       for core.img. core.img is at this location and looks 
                       for (,msdos7)/boot/grub2. It also embeds following 
                       components:
                       
                       modules
                       -------------------------------------------------------
                       biosdisk fshelp ext2 part_msdos
                       -------------------------------------------------------

Don’t know showing the rest is useful in light of this. So if I run the boot loader from yast, place a checkmark only in “boot from extended partition”, that should set it up correctly again?

Here is sda8,

sda8: __________________________________________________________________________

    File system:       btrfs
    Boot sector type:  Grub2 (v1.99-2.00)
    Boot sector info:  Grub2 (v2.00) is installed in the boot sector of sda8 
                       and looks at sector 100763649 of the same hard drive 
                       for core.img. core.img is at this location and looks 
                       for (,msdos8)/boot/grub2. It also embeds following 
                       components:
                       
                       modules
                       -------------------------------------------------------
                       gzio extcmd crypto lzopio btrfs part_msdos biosdisk
                       -------------------------------------------------------
                       
                       config script
                       -------------------------------------------------------
                       set btrfs_relative_path='y'
                       btrfs-mount-subvol ($root) /boot/grub2/i386-pc 
                       @/boot/grub2/i386-pc
                       
                       -------------------------------------------------------
    Operating System:  openSUSE Leap 42.2
    Boot files:        /boot/grub2/grub.cfg /etc/fstab

It looks like grub2 is there. Any way of knowing if I set sda8 flag to boot it would other than actually trying it and then having to set the flag back to sda1?

I now recall on install that it showed the changes and said it was deleting sda6 and adding sda8. I did not find a way to prevent that.

If grub code is installed to the MBR the boot flag is not used only if you install generic code to the MBR is the flag needed. but generic will not boot to a partition in the extended so you must inst grub code to the extended and the flag should go there. If you can run yast at least one OS is working be sure that the scan for foreign OS is checked think it is on last tab. If that does not find the OS then it may have been damaged somehow by the install procedure you used

Using which openSUSE version? In my experience older versions (which may include 13.2) did not reinstall bootloader when you simply changed this option; you had to either manually run update-bootloader --reinit or select different (or no) bootloader in YaST, save, then enter again and select grub2 with correct boot location.

Any way of knowing if I set sda8 flag to boot it would other than actually trying it and then having to set the flag back to sda1?

You have generic Windows code in MBR, this code does not know how to boot from logical partition. Newer openSUSE versions install Syslinux MBR code that supports it.

Ah,
Missed the changes in partitions sda6 to sda8. Bad eyes.

But, as gogalthorp points out, if you inspect the grub command entry you posted which I’ll quote again here, you’ll notice that the entry does not identify the os partition by drive/partition id, it’s identified by UUID which means that something you did changed that identifier… Which although not central to the issue also created the different partition order you noticed. Solution would be to change the UUID to specify the id of the correct partition or change the partition identifier method and point accordingly.

kernel /boot/vmlinuz root=UUID=d42a4dec-f134-41c4-9d00-9e22303ab32a resume=/dev/disk/by-label/SwapSpace splash=silent 

TSU

Maybe that has caused me confusion? I know I had checked the boxes in the past and things didn’t change as I thought. This is for the 42.2 version, should that one work?

You have generic Windows code in MBR, this code does not know how to boot from logical partition. Newer openSUSE versions install Syslinux MBR code that supports it.

Ok, another question. What does “Write generic Boot Code to MBR” do? Is that different than generic Windows code, does that boot logical partitions (such as generic from 13.1)? But since I have Windows code, that would explain why the logical partitions don’t boot.

I think the problem was the root (hd0,6) command which I then changed to (hd0,5) to make it work. Which happened because on install, it said it was deleting sda6 and adding sda8. Is there some option to prevent that at install?

You can always take control of the install and set it as you wish. Default options may not be what you intend

I went back through the install without actually doing it and tried some things. I can’t remember exactly, but on the disk partition options, there were three. The first one, I didn’t use, but when I went in this time, made no changes but clicked ok, it changed things. Instead of deleting and adding the partition, it overwrote it. Sorry, it’s hard to remember from install to rebooting and typing things down.
…(Ah, here it is from the documentation online: Edit Proposal Settings.)
The key thing is, although I choose the partition as before (in Create Partition Setup), if I first select the first option, it behaves differently than not doing it. And the option doesn’t seem to imply to me that any changes were made.

Is this some strange thing or do I just not understand it right?

Any changes are shown on the partition scheme page before any changes are actually made this page should be what you want it to be or go back and change things