Bug 1096913

Summary: Partitioner does not detect existing partitions (extended partition outside the disk)
Product: [openSUSE] openSUSE Distribution Reporter: Wolfgang Mayer <Wolfgang>
Component: InstallationAssignee: Sebastian Parschauer <sebastian.parschauer>
Status: RESOLVED INVALID QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P3 - Medium CC: aschnell, sebastian.parschauer, Wolfgang, yast2-maintainers
Version: Leap 15.0Flags: sebastian.parschauer: needinfo?
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: YasST logs as requested from Arvin Schnell on 11-June-2018
y2log
screenshot page1/2
screenshot page2/2
Partition layout on 42.3 as requeted by Stefan Hundhammer
MBR dump as requested

Description Wolfgang Mayer 2018-06-11 09:51:39 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Build Identifier: 

I am currently on openSuse Leap 42.3. I'd like to re use the existing partition layout in openSuse Leap 15. But the partitioner in Leap 15 does dot recognize these partitions.  

Reproducible: Always

Steps to Reproduce:
1. Select 'Installation'
2. Select language and keyboard layout in 'License Agreement'
3. Select 'Desktop with KDE Plasma' as User interface
4. Select 'Start with existing partitions'
Actual Results:  
'Expert Partitioner' shows no partitions at all.

Expected Results:  
I expect to see a partition layout similar to the information in Leap 42.3
Comment 1 Arvin Schnell 2018-06-11 09:59:18 UTC
Please provide YaST logs, see http://en.opensuse.org/openSUSE:Bugreport_YaST.
Comment 2 Wolfgang Mayer 2018-06-16 09:32:40 UTC
Created attachment 774270 [details]
YasST logs as requested from Arvin Schnell on 11-June-2018

save_y2logs is not available. Therefore I saved the logs via tar as described for step SUSE Linux 9.2. Content type 'app/x-gunzip' is not in the list nor valid. I therefore used auto-detect.
Comment 3 Arvin Schnell 2018-06-18 10:43:00 UTC
parted reports an error for sda:

/usr/sbin/parted --script --machine '/dev/sda' unit s print
Error: Can't have a partition outside the disk!

Other tools, e.g. blkid or udevadm info, report data for sda1 to sda11.
Comment 4 Stefan Hundhammer 2018-06-18 12:32:00 UTC
save_y2logs is not available? Seriously? We've been providing that script since about 15 years. Please check again. I am pretty sure that it's in the inst-sys.
Comment 5 Stefan Hundhammer 2018-06-18 12:34:00 UTC
If you tried to invoke save_y2logs from the installed system as a normal user, you might not have /usr/sbin in your $PATH (but then, you need root permissions to access that directory anyway).
Comment 6 Stefan Hundhammer 2018-06-18 12:56:11 UTC
2018-06-16 04:53:13 <1> install(3519) [libstorage] SystemCmd.cc:186 SystemCmd Executing:"/sbin/blkid -c '/dev/null'"

  /dev/sda1: UUID="a264...458b" TYPE="swap" PARTUUID="00090e6d-01"
  /dev/sda2: UUID="ce1d...1067" TYPE="ext4" PTTYPE="dos" PARTUUID="00090e6d-02"
  /dev/sda3: UUID="a04a...6a64" TYPE="ext4" PTTYPE="dos" PARTUUID="00090e6d-03"
  /dev/sda5: UUID="df38...19a0" TYPE="ext4" PARTUUID="00090e6d-05"
  /dev/sda6: UUID="9d58...c7d7" TYPE="ext4" PARTUUID="00090e6d-06"
  /dev/sda7: UUID="04d5...cc57" TYPE="ext4" PARTUUID="00090e6d-07"
  /dev/sda8: UUID="7490...30c4" TYPE="ext4" PARTUUID="00090e6d-08"
  /dev/sda9: UUID="51ef...b45b" TYPE="ext4" PARTUUID="00090e6d-09"
  /dev/sda10: UUID="611a...d953" TYPE="ext4" PARTUUID="00090e6d-0a"
  /dev/sda11: UUID="8b77...94da" TYPE="ext4" PARTUUID="00090e6d-0b"


But, as Arvin already wrote, "parted" considers your partition table to be corrupted:


2018-06-16 04:53:17 <1> install(3519) [libstorage] SystemCmd.cc:186 SystemCmd
Executing:"/usr/sbin/parted --script --machine '/dev/sda' unit s print"
  Error: Can't have a partition outside the disk!
  
  BYT;
  /dev/sda:1953523055s:scsi:512:512:unknown:ATA SAMSUNG HD103UJ:;


I don't know how it got into that state. Since we don't get any useful output from "parted", I can't even see what partition table type (MS-DOS or GPT) it is.

Can you try on your Leap 42.3 what "parted" and the other partition tools report?

E.g. (as root)


  export LANG=C
  /usr/sbin/parted /dev/sda print

  /usr/sbin/parted /dev/sda unit s print

  /sbin/fdisk -l /dev/sda

  cat /proc/partitions


I would expect "parted" (and most likely "fdisk" as well) to report a similar error. Since the "blkid" command did find some partitions, there might be something in /proc/partitions which means that the kernel seems to have some error handling for that situation (or does not detect an error at all).
Comment 7 Carsten Grebehem 2018-06-19 18:54:44 UTC
Created attachment 774550 [details]
y2log
Comment 8 Carsten Grebehem 2018-06-19 18:56:07 UTC
Created attachment 774551 [details]
screenshot page1/2
Comment 9 Carsten Grebehem 2018-06-19 18:56:44 UTC
Created attachment 774552 [details]
screenshot page2/2
Comment 10 Carsten Grebehem 2018-06-19 19:23:16 UTC
I tryed a MBR-Harddisk to install openSUSE Leap 15.0 in /dev/sda5. The output of
fdisk -l is:

Festplatte /dev/sda: 931,5 GiB, 1000204886016 Bytes, 1953525168 Sektoren
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 4096 Bytes
E/A-Größe (minimal/optimal): 4096 Bytes / 4096 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0x04b1bad9

Gerät      Boot    Anfang       Ende   Sektoren  Größe Kn Typ
/dev/sda1  *         2048  612302115  612300068   292G  7 HPFS/NTFS/exFAT
/dev/sda2       612302848  719259647  106956800    51G  5 Erweiterte
/dev/sda3       719259648  887031807  167772160    80G 83 Linux
/dev/sda4       887031808 1953525134 1066493327 508,6G 83 Linux
/dev/sda5  *    612304896  666830847   54525952    26G 83 Linux
/dev/sda6  *    666830848  719259647   52428800    25G 83 Linux

Partitionstabelleneinträge sind nicht in Festplatten-Reihenfolge.




The maschine was started like Wolfgang Mayer by openSUSE Leap 15.0 DVD

     Steps to Reproduce:
     1. Select 'Installation'
     2. Select language and keyboard layout in 'License Agreement'
     3. Select 'Desktop with KDE Plasma' as User interface
     4. Select 'Start with existing partitions'
     Actual Results:  
     'Expert Partitioner' shows no partitions at all.

See attachments for my y2log.

The I started my maschine by the openSUSE Leap 15.0 KDE live-DVD. I got a message about a bug in parted Version 3.2 (screenshot page1/2 and screenshot page 2/2). With parted Version 3.1 (under openSUSE Leap 43.2) came no error in parted.
Comment 11 Stefan Hundhammer 2018-06-20 10:20:52 UTC
Carsten, your bug is completely unrelated to this one. It has completely different symptoms and completely different error messages. Why did you attach your y2logs to this bug? This just confuses everybody working on this.

Please open a new bug against parted and add your attachments to that new bug.
Comment 12 Wolfgang Mayer 2018-07-08 10:44:45 UTC
Created attachment 776425 [details]
Partition layout on 42.3 as requeted by  Stefan Hundhammer

I have no idea what this message "Error: Can't have a partition outside the disk!" means, where it comes from and how or if it can be corrected.
Comment 13 Arvin Schnell 2018-08-03 12:06:27 UTC
The screenshot in comment #12 shows that the extended partition sda4 end
sector (1953523711) is outside of the disk (which has 1953523055 sectors).

Sebastian, do you know whether a stricter check was introduced in parted
for Leap 15.0? Any idea how the problem can occur (e.g. HPA)?
Comment 14 Sebastian Parschauer 2018-08-06 08:49:20 UTC
(In reply to Arvin Schnell from comment #13)
> The screenshot in comment #12 shows that the extended partition sda4 end
> sector (1953523711) is outside of the disk (which has 1953523055 sectors).
> 
> Sebastian, do you know whether a stricter check was introduced in parted
> for Leap 15.0? Any idea how the problem can occur (e.g. HPA)?

Yes, the bug is known. Leap15 parted even has a test for this in its upstream test suite:
> tests-check-extended-partition-length.patch

I mark for which code a test is added. Here it is:
> libparted-BLKPG_RESIZE_PARTITION-uses-bytes.patch

See:
> http://git.savannah.gnu.org/cgit/parted.git/commit/?id=c6dc6e5d0f49a26242d2b28622514814a53d92e1
and
> http://git.savannah.gnu.org/cgit/parted.git/commit/?id=31b5bfa4cd0b2e2944af22466e7b7d88ad94c4c9
Comment 15 Sebastian Parschauer 2018-08-06 09:46:14 UTC
The change detecting too long partitions is:
> http://git.savannah.gnu.org/cgit/parted.git/commit/?id=fa815ad05db248d78ef214ea79a78c22772a9ffe

It is usually meant to be able to ignore that warning and to let parted fix the issue.
I need the MBR dump (first 512 bytes) for reproduction:

dd if=/dev/sda of=/yourpath/mbr.dump count=1

@Wolfgang: Can you please provide the MBR dump? TIA
Comment 16 Wolfgang Mayer 2018-08-06 10:59:48 UTC
Created attachment 778986 [details]
MBR dump as requested
Comment 17 Sebastian Parschauer 2018-08-06 11:06:19 UTC
Thanks. Assigning to me.
Comment 18 Sebastian Parschauer 2018-08-06 12:54:16 UTC
Parted from the rescue system from the Leap15 DVD is asking me if I would want to ignore the "Can't have a partition outside the disk!" error. Then I can just fix it with a resizepart:
> parted /dev/sda
> ...
> (parted) unit s
> (parted) p
> Error: Can't have a partition outside the disk!
> Ignore/Cancel? ignore
> ...
> (parted) resizepart 4 1953523054s
> Warning: Shrinking a partition can cause data loss, are you sure you want to continue?
> Yes/No? Yes
> (parted) p
> ...
>  4      465596416s  1953523054s  1487926639s  extended               lba, type=0f
> ...

The resizepart should definitely be done with Leap15 parted as it has proper resizing code.

@Wolfgang: Does fixing this with the Leap15 rescue system work for you? TIA
Comment 20 Wolfgang Mayer 2018-08-07 13:43:47 UTC
Apparently the 'resizepart' worked.
The partitions are now recognized by the partitioner. Also the import of the mount points worked fine. Sine I realized that the flag was set to 'format' for all these partitions I changed this to 'do not format' (except root partition).

But when I then continue a warning message is now popping up:

"The system may not boot:
MBR distance is not enough to install the bootloader correctly
Do you want to continue"

What does this message mean, Is it save to continue?

I decided to cancel the installation.
Comment 21 Sebastian Parschauer 2018-08-07 14:50:10 UTC
(In reply to Wolfgang Mayer from comment #20)
Perfect, thanks.

> "The system may not boot:
> MBR distance is not enough to install the bootloader correctly
> Do you want to continue"
> 
> What does this message mean, Is it save to continue?
> 
> I decided to cancel the installation.

Setting needinfo to the YaST maintainers. Basically it should mean that the start of the first partition is too low with 63 sectors as seen in comment 12. Properly aligned partitions start at 1 MiB (2048 sectors).

I would suggest to select installing GRUB2 into a partition and not into MBR as I've seen that there is a generic MBR on disk any way (comment 16) and no GRUB2 inside.
Comment 22 Sebastian Parschauer 2018-08-07 15:46:54 UTC
There seems to be a bug in the warning. When looking at
> https://en.wikipedia.org/wiki/GNU_GRUB#Version_2_(GRUB)
it should be fine to ignore the warning and GRUB2 stage 1.5 should have enough space between MBR and start of the first partition.
Comment 23 Sebastian Parschauer 2018-08-07 16:20:57 UTC
Related code:
> https://github.com/yast/yast-storage-ng/blob/SLE-15-GA/src/lib/y2storage/boot_requirements_strategies/legacy.rb

This is checking for >= 256 KiB (GRUB_SIZE) in "valid_mbr_gap?". Otherwise, it jumps to "mbr_gap_error".
Comment 24 Wolfgang Mayer 2018-08-08 09:15:03 UTC
The installation now completed successfully. No further issues detected so far.
Thanks a lot to all of you for your great help.
Wolfgang
Comment 25 Sebastian Parschauer 2018-08-10 11:35:52 UTC
Thanks, I'm closing this case as invalid as this is the process for bugs which don't result in patches applied to the distribution. But the problem is fixed. Being strict about existing partition tables is intentional upstream behavior.

The YaST issue is something for another bug.