Package: kpartx Version: 0.6.4-5 Severity: wishlist Tags: patch Dear Maintainers,
Sometimes kpartx reports errors during handling partition while at the end deleting the loop device succeeds: $ kpartx -v -d binary/boot/disk-uefi.ext4 device-mapper: remove ioctl on loop0p1 failed: Device or resource busy del devmap : loop0p15 del devmap : loop0p14 loop deleted : /dev/loop0 $ # here we have $? != 0 # (from: https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1684090) Please find the patch attached which ignores earlier errors after loop deletion is done. Cheers, Balint -- Balint Reczey Debian & Ubuntu Developer
Description: Make kpartx succeed when deleting loop dev even with minor errors Author: Balint Reczey <balint.rec...@canonical.com> --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -227,6 +227,7 @@ char *mapname = NULL; int hotplug = 0; int loopcreated = 0; + int loopdeleted = 0; struct stat buf; initpts(); @@ -491,6 +492,7 @@ exit(1); } printf("loop deleted : %s\n", loopdev); + loopdeleted = 1; } break; @@ -693,6 +695,11 @@ dm_lib_release(); dm_lib_exit(); + if (what == DELETE && loopdeleted) { + /* ignore errors since deletion was successful and error messages are printed anyway */ + return 0; + } + return r; }