Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit ddb8cce

Browse files
committed
refkit-image-installer: workaround kpartx bug in cleanup
The loop devices are not correctly removed when exiting due to a problem with kpartx -d failing to handle file names longer than 63. The workaround is to clean up using the loop device name with 'kpartx -d'. It also requires an explicit 'losetup -d' call. Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
1 parent c430a40 commit ddb8cce

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

meta-refkit/recipes-image/images/refkit-installer-image.bb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,14 @@ REFKIT_INSTALLER_UEFI_COMBO () {
161161

162162
confirm_install || return 1
163163

164+
input_loopdev=
164165
input_mountpoint=
165166
input_mounted=
166167

167168
cleanup_install_image () {
168169
[ "$input_mounted" ] && execute umount "$input_mountpoint"
169170
[ "$input_mountpoint" ] && rmdir "$input_mountpoint"
170-
[ "$input" ] && execute kpartx -d "$input"
171+
[ "$input_loopdev" ] && execute kpartx -d "$input_loopdev" && losetup -d "$input_loopdev"
171172
remove_cleanup cleanup_install_image
172173
}
173174
add_cleanup cleanup_install_image
@@ -177,6 +178,8 @@ REFKIT_INSTALLER_UEFI_COMBO () {
177178
loopdev=$(execute kpartx -sav "$input" | tail -1 | sed -e 's/^\(add map \)*\([^ ]*\).*/\2/')
178179
if [ ! "$loopdev" ]; then
179180
fatal "kpartx failed for $input"
181+
else
182+
input_loopdev="/dev/${loopdev%%p[0-9]}"
180183
fi
181184
if ! input_mountpoint=$(mktemp -dt input-rootfs.XXXXXX); then
182185
fatal "could not create mount point"

0 commit comments

Comments
 (0)