Bug 1326474

Summary: wipefs does not remove GPT signature from device with hybrid MBR
Product: [Fedora] Fedora Reporter: Chris Murphy <bugzilla>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: jonathan, kzak
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-20 19:56:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
4Kblock original
none
4Kblock wiped none

Description Chris Murphy 2016-04-12 18:50:07 UTC
Description of problem:

Wipefs doesn't appear to see all of the partition maps in this hybrid map used by Fedora installation ISOs. It sees and wipes the MBR and APM signatures, but leaves the GPT signature intact.



Version-Release number of selected component (if applicable):
util-linux-2.27.1-2.fc23.x86_64

How reproducible:
Always

Steps to Reproduce:
1. dd if=<any Fedora ISO> of=<USB flash> bs=1M count=20
2. wipefs -a /dev/sdb[123] 
3. wipefs -a /dev/sdb


Actual results:


# wipefs -a /dev/sdb[123]
/dev/sdb1: 5 bytes were erased at offset 0x00008001 (iso9660): 43 44 30 30 31
wipefs: /dev/sdb1: ignoring nested "dos" partition table on non-whole disk device
wipefs: /dev/sdb1: ignoring nested "mac" partition table on non-whole disk device
wipefs: Use the --force option to force erase.
/dev/sdb2: 8 bytes were erased at offset 0x00000036 (vfat): 46 41 54 31 32 20 20 20
/dev/sdb2: 1 byte was erased at offset 0x00000000 (vfat): eb
/dev/sdb2: 2 bytes were erased at offset 0x000001fe (vfat): 55 aa
/dev/sdb3: 2 bytes were erased at offset 0x00000400 (hfsplus): 48 2b

# wipefs -a /dev/sdb
/dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdb: 2 bytes were erased at offset 0x00000000 (mac): 45 52
/dev/sdb: calling ioctl to re-read partition table: Success

# parted /dev/sdb u s p
Error: /dev/sdb: unrecognised disk label
Model: Kingston DT R500 (scsi)                                            
Disk /dev/sdb: 31277056s
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with corrupt MBR; using GPT and will write new
protective MBR on save.
Warning! Main partition table overlaps the first partition by 48 blocks!
You will need to delete this partition or resize it in another utility.
Disk /dev/sdb: 31277056 sectors, 14.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 93475653-E08A-4F1E-B3B0-D325D32C6283
Partition table holds up to 128 entries
First usable sector is 48, last usable sector is 2873310
Partitions will be aligned on 4-sector boundaries
Total free space is 1539 sectors (769.5 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   2          102844          113479   5.2 MiB     0700  ISOHybrid
   3          113480          136823   11.4 MiB    AF00  ISOHybrid




Expected results:

gdisk shouldn't see this as a valid GPT; I can't tell off hand if this is a valid GPT, but wipefs hasn't tried to wipe the GPT signature. It looks like at offset 0x200 these 8 bytes should be removed 45 46 49 20 50 41 52 54.

Even though this GPT is half broken due to missing backup GPT, the primary seems valid still? So it probably should have the signature wiped.

Additional info:

I used Fedora-Workstation-Live-x86_64-24_Alpha-7.iso for this test.


/dev/sdb1: UUID="2016-03-22-21-57-41-00" LABEL="Fedora-WS-Live-24_A-7" TYPE="iso9660" PTUUID="08549cf5" PTTYPE="dos" PARTUUID="08549cf5-01"
/dev/sdb2: SEC_TYPE="msdos" LABEL="ANACONDA" UUID="FC75-9AAF" TYPE="vfat" PARTUUID="08549cf5-02"
/dev/sdb3: UUID="b5a043c2-e705-30c1-ae04-3e45bd601a39" LABEL="ANACONDA" TYPE="hfsplus" PARTUUID="08549cf5-03"


# wipefs -np /dev/sdb[123]
# offset,uuid,label,type
0x0,,,mac
0x1fe,,,dos
0x8001,2016-03-22-21-57-41-00,Fedora-WS-Live-24_A-7,iso9660
# offset,uuid,label,type
0x36,FC75-9AAF,ANACONDA,vfat
# offset,uuid,label,type
0x400,b5a043c2-e705-30c1-ae04-3e45bd601a39,ANACONDA,hfsplus


# wipefs -np /dev/sdb
# offset,uuid,label,type
0x0,,,mac
0x1fe,,,dos
0x8001,2016-03-22-21-57-41-00,Fedora-WS-Live-24_A-7,iso9660

Comment 1 Chris Murphy 2016-04-12 18:51:26 UTC
Created attachment 1146612 [details]
4Kblock original

dd if=<ISO> of=file bs=4096 count=1

Comment 2 Chris Murphy 2016-04-12 18:51:59 UTC
Created attachment 1146613 [details]
4Kblock wiped

This is after both wipes.

dd if=device of=file bs=4096 count=1

Comment 3 Karel Zak 2016-05-25 13:37:06 UTC
Ah, I have forgot update this BZ. It's already fixed in the upstream git tree, commit 949e5c960037c377d8c6f696758082e0f20e98f6.

Fedora package will be updated later after upgrade to v2.28.1 (or so).

Thanks for your report.

Comment 4 Fedora End Of Life 2016-11-25 07:20:36 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2016-12-20 19:56:17 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.