Comment 4 for bug 1425153

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Got it.

The regression on the dialog is not a problem in the attached patch.
It's actually hit because the attached patch uncovered another problem, again related to bug 1424734 (different multipath disk-partition separators / 'p' vs '-part').
This probably requires another patch or discussion for the behavior described below.

The regression was that, after the partman confirmation dialog ("confirm_changes partman", in /bin/partman), rather then proceeding to the formatting stage, the installer goes back to the partitioning dialog.

It's caused because the /lib/partman/commit.d/31multipath_partition script is now exiting with non-zero exit code, making /bin/partman stop processing the other scripts in commit.d/, including the formatting ones.

The non-zero exit code comes from a kpartx command, that fails due to the different disk-partition separators (see bug 1424734), yielding a 'device busy' error in syslog.

If the attached patch is not in place, this non-zero exit code is supressed by other (incorrect) iterations of the for loop..
Other partman's /device/ dirs are created for each /partition/ (which is incorrect).
Then, the for loop just goes over the failed kpartx command, and that non-zero exit code is forgotten.

One can observe that with the trace of /lib/partman/commit.d/31multipath_partition.
(add "set -x; exec 2>/31multipath_partitions.stderr" before the for-loop, and 'exit $?' after it)
Check that the for-loop goes over the kpartx error when there are devices for each mpath0 partition (mpath0p1, mpath0p2 and mpath0p3).. but exits with the error when they're not there anymore (as that's the last iteration in the for-loop)

Without the patch:

 ~ # cat /31partition_multipath.stderr
 + [ -d /var/lib/partman/devices/=dev=mapper=mpath0 ]
 + cd /var/lib/partman/devices/=dev=mapper=mpath0
 + [ -f device ]
 + [ -f multipath ]
 + cat device
 + kpartx -d -p -part /dev/mapper/mpath0
 + cat device
 + kpartx -a -p -part /dev/mapper/mpath0
 device-mapper: create ioctl on mpath0-part1 failed: Device or resource busy
 create/reload failed on mpath0-part1
 device-mapper: create ioctl on mpath0-part2 failed: Device or resource busy
 create/reload failed on mpath0-part2
 device-mapper: create ioctl on mpath0-part3 failed: Device or resource busy
 create/reload failed on mpath0-part3
 + [ -d /var/lib/partman/devices/=dev=mapper=mpath0p1 ]
 + cd /var/lib/partman/devices/=dev=mapper=mpath0p1
 + [ -f device ]
 + [ -f multipath ]
 + continue
 + [ -d /var/lib/partman/devices/=dev=mapper=mpath0p2 ]
 + cd /var/lib/partman/devices/=dev=mapper=mpath0p2
 + [ -f device ]
 + [ -f multipath ]
 + continue
 + [ -d /var/lib/partman/devices/=dev=mapper=mpath0p3 ]
 + cd /var/lib/partman/devices/=dev=mapper=mpath0p3
 + [ -f device ]
 + [ -f multipath ]
 + continue
 + exit 0

With the patch:

 ~ # cat /31partition_multipath.stderr
 + [ -d /var/lib/partman/devices/=dev=mapper=mpath0 ]
 + cd /var/lib/partman/devices/=dev=mapper=mpath0
 + [ -f device ]
 + [ -f multipath ]
 + cat device
 + kpartx -d -p -part /dev/mapper/mpath0
 + cat device
 + kpartx -a -p -part /dev/mapper/mpath0
 device-mapper: create ioctl on mpath0-part1 failed: Device or resource busy
 create/reload failed on mpath0-part1
 device-mapper: create ioctl on mpath0-part2 failed: Device or resource busy
 create/reload failed on mpath0-part2
 device-mapper: create ioctl on mpath0-part3 failed: Device or resource busy
 create/reload failed on mpath0-part3
 + exit 3

So, we can either append an 'exit 0' to the /lib/partman/commit.d/31multipath_partition script (because it seems that kpartx failures can be safely ignored if there are other devices to check).. or wait until the more general multipath disk-partition separator issue is resolved.