Bug 431628 - partitionmanager does not wipe old signatures when creating a new partition table
Summary: partitionmanager does not wipe old signatures when creating a new partition t...
Status: RESOLVED FIXED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-15 08:53 UTC by Michael Weghorn
Modified: 2021-01-15 13:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 21.04.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn 2021-01-15 08:53:01 UTC
SUMMARY

partitionmanager does not wipe old signatures when creating partition table.

STEPS TO REPRODUCE
1. insert USB drive
2. download a CD ISO image, e.g. https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.7.0-amd64-netinst.iso
2. copy the image to the USB drive using dd, command if USB drive is /dev/sda:
     sudo dd if=/path/to/debian-10.7.0-amd64-netinst.iso of=/dev/sda
3. in partitionmanager, create a new partition table for the USB device
  3.1. right-click on the USB device
  3.2. select -> "New Partition Table"
  3.3. leave default selection "GPT" and click "Create New Partition Table"
  3.4. click the "Apply" button, and "Apply Pending Operations"
4. check signatures on the device, e.g. run 'sudo file -s /dev/sda'

OBSERVED RESULT

output is:

$ sudo file -s /dev/sda
/dev/sda: ISO 9660 CD-ROM filesystem data (DOS/MBR boot sector) 'Debian 10.7.0 amd64 n' (bootable)

EXPECTED RESULT

There should be no more "iso9660" signature after a new partition table has been created.
The output should be something like:

$ sudo file -s /dev/sda
/dev/sda: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 15633407 sectors, extended partition table (last)

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2
Kernel Version: 5.10.0-1-amd64
OS Type: 64-bit
Processors: 12 × Intel® Core™ i7-9850H CPU @ 2.60GHz
Memory: 62.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630

ADDITIONAL INFORMATION

* Not wiping the signatures also leads to the device's partitions not properly being shown in gparted after taking the above steps + creating partitions in partitionmanager, then starting gparted (e.g. an actual FAT32 partition is shown as having file system "iso9660" instead).
* Reproducible using kpmcore master as of commit 31706cffdc1df60b96010fbbdbbdc6ec192fd913 and partitionmanager as of commit 42c46fa67425c3bffb864a1056e56688e2fd3784.
* I have investigated this and plan to submit a MR for kpmcore that fixes this bug.
Comment 1 Michael Weghorn 2021-01-15 09:00:55 UTC
While sfdisk automatically wipes old signatures in interactive mode, it does not do so in non-interactive mode.

When run in interactive mode, i.e. from a terminal, sfdisk shows this warning:

    $ sudo sfdisk /dev/sda
    [...]
    The device contains 'iso9660' signature and it will be removed by a write command. See sfdisk(8) man page and --wipe option for more details.
    [...]

However, when explicitly disabling wiping (or running in non-interactive mode, as partitionmanager does), this warning is shown

    $ sudo sfdisk --wipe=never /dev/sda
    [....]
    The device contains 'iso9660' signature and it may remain on the device. It is recommended to wipe the device with wipefs(8) or sfdisk --wipe, in order to avoid possible collisions.
    [...]

and signatures are not wiped.

MR with suggested fix: https://invent.kde.org/system/kpmcore/-/merge_requests/25
Comment 2 Michael Weghorn 2021-01-15 13:11:29 UTC
(In reply to Michael Weghorn from comment #1)
> MR with suggested fix:
> https://invent.kde.org/system/kpmcore/-/merge_requests/25

The MR was merged now.
 -> fixed in https://invent.kde.org/system/kpmcore/-/commit/813e574001eb5b9248c92d2c8c0174d5dd062a26