The earlier steps to reproduce were wrong. I failed to convert the img
file to a raw file first. So I should have:

# Get a cloud image and convert it to raw format:
$ wget 
https://cloud-images.ubuntu.com/bionic/20180124/bionic-server-cloudimg-amd64.img
$ qemu-img convert -O raw bionic-server-cloudimg-amd64.img 
bionic-server-cloudimg-amd64.raw

# Now kpartx will attach the loop device:
$ sudo kpartx -v -l bionic-server-cloudimg-amd64.raw 
loop3p1 : 0 4384735 /dev/loop3 227328
loop3p14 : 0 8192 /dev/loop3 2048
loop3p15 : 0 217088 /dev/loop3 10240
loop deleted : /dev/loop3
$ sudo kpartx -v -s -a bionic-server-cloudimg-amd64.raw                    
add map loop3p1 (253:0): 0 4384735 linear 7:3 227328
add map loop3p14 (253:1): 0 8192 linear 7:3 2048
add map loop3p15 (253:2): 0 217088 linear 7:3 10240

# But removing does nothing:
$ sudo kpartx -v -d bionic-server-cloudimg-amd64.raw 
$ ll /dev/mapper
total 0
drwxr-xr-x  2 root root     120 Feb  2 20:43 ./
drwxr-xr-x 16 root root    3640 Feb  2 20:43 ../
crw-------  1 root root 10, 236 Feb  2 20:03 control
lrwxrwxrwx  1 root root       7 Feb  2 20:43 loop3p1 -> ../dm-0
lrwxrwxrwx  1 root root       7 Feb  2 20:43 loop3p14 -> ../dm-1
lrwxrwxrwx  1 root root       7 Feb  2 20:43 loop3p15 -> ../dm-2

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1747044

Title:
  kpartx 0.7.4-2ubuntu1 in bionic does not remove loop devices

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/multipath-tools/+bug/1747044/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to