-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Bug coreos/ignition#1728
Operating System Version
Fedora CoreOS 38 (38.20230722.3.0)
Ignition Version
Ignition 2.16.2
Environment
What hardware/cloud provider/hypervisor is being used to run Ignition?
CoreOS running on libvirt VM
Expected Behavior
When "wipe_table: true" is specified the disk device should be wiped even if its partition table is corrupted
Actual Behavior
Ignition fails to wipe disk with sgdisk error:
[ 35.521754] ignition[855]: disks: createPartitions: op(2): op(3): [failed] deleting 0 partitions and creating 0 partitions on "/run/ignition/dev_aliases/dev/vdb": exit status 2: Cmd: "sgdisk" "--zap-all" "/run/ignition/dev_aliases/dev/vdb" Stdout: "GPT data structures destroyed! You may now partition the disk using fdisk or\nother utilities.\n" Stderr: "\aCaution: invalid main GPT header, but valid backup; regenerating main header\nfrom backup!\n\n\aWarning: Invalid CRC on main header data; loaded backup partition table.\nWarning! Main and backup partition tables differ! Use the 'c' and 'e' options\non the recovery & transformation menu to examine the two tables.\n\n\aWarning! Main partition table CRC mismatch! Loaded backup partition table\ninstead of main partition table!\n\nWarning! One or more CRCs don't match. You should repair the disk!\nMain header: ERROR\nBackup header: OK\nMain partition table: ERROR\nBackup partition table: OK\n\nInvalid partition data!\n"
Reproduction Steps
- Create a disk with corrupted partition table, for instance:
sgdisk --new=2:0:0 -i=2 /dev/vdb
dd if=/dev/urandom of=/dev/vdb bs=512 count=3 - create a VM using this disk. Use ignition to wipe disk (wipe_table: true) and create a partition:
storage:
disks:
- device: /dev/vdb
wipe_table: true
partitions:
- label: data
number: 1
size_mib: 1024
start_mib: 0
Other Information
Seem to be due to sgdisk returning an error when the disk partition table is corrupted. In this case ignition seems to returns an error on commit fail: https://github.com/coreos/ignition/blob/14151500635e8a0b020897fb2fd68706d8056fbb/internal/exec/stages/disks/partitions.go#L327
Should we ignore/log this error instead of returning?