Bug#734794: partition mapping deletion broken

adrelanos adrelanos at riseup.net
Thu Jan 9 21:24:56 UTC 2014


Package: kpartx
Version: 0.4.9+git0.4dfdaf2b-7

(On Debain Jessie.)

bug found in version: kpartx 0.4.9+git0.4dfdaf2b-7

not affected by this bug, last version: kpartx 0.4.9+git0.4dfdaf2b-6

It follows my test script. The command marked with "xxx" is the one
causing the device being busy later.

##########

#!/bin/bash

## starting with a clean state (freshyl rebooted)

set -x
set -e

mount

kpartx -av /home/user/whonix_binary/Whonix-Gateway.img

mkdir --parents /home/user/whonix_binary/Whonix-Gateway_image

mount /dev/mapper/loop0p1 /home/user/whonix_binary/Whonix-Gateway_image

## xxx
#umount /home/user/whonix_binary/Whonix-Gateway_image/etc/resolv.conf ||
true

umount /home/user/whonix_binary/Whonix-Gateway_image

kpartx -d /home/user/whonix_binary/Whonix-Gateway.img

rm -r /home/user/whonix_binary/Whonix-Gateway_image

mount

##########

In that form I can run that script. Here is the log.

##########

$ sudo ./bbbbbbbbbbb
+ set -e
+ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs
(rw,relatime,size=10240k,nr_inodes=212969,mode=755)
devpts on /dev/pts type devpts
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=414952k,mode=755)
/dev/disk/by-uuid/8db75226-8f69-4861-b7a0-068db6da9584 on / type ext4
(rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
pstore on /sys/fs/pstore type pstore (rw,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=829900k)
none on /sys/kernel/security type securityfs (rw,relatime)
+ kpartx -av /home/user/whonix_binary/Whonix-Gateway.img
add map loop0p1 (254:0): 0 209711104 linear /dev/loop0 4096
+ mkdir --parents /home/user/whonix_binary/Whonix-Gateway_image
+ mount /dev/mapper/loop0p1 /home/user/whonix_binary/Whonix-Gateway_image
+ umount /home/user/whonix_binary/Whonix-Gateway_image
+ kpartx -d /home/user/whonix_binary/Whonix-Gateway.img
loop deleted : /dev/loop0
+ rm -r /home/user/whonix_binary/Whonix-Gateway_image
+ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs
(rw,relatime,size=10240k,nr_inodes=212969,mode=755)
devpts on /dev/pts type devpts
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=414952k,mode=755)
/dev/disk/by-uuid/8db75226-8f69-4861-b7a0-068db6da9584 on / type ext4
(rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
pstore on /sys/fs/pstore type pstore (rw,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=829900k)
none on /sys/kernel/security type securityfs (rw,relatime)

##########

I could run it over and over again. It would always work.

Now I activate add one extra command (the one marked with xxx). Running
it for the first time.

Here is the log.

##########

user at host:~$ sudo ./bbbbbbbbbbb
+ set -e
+ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs
(rw,relatime,size=10240k,nr_inodes=212969,mode=755)
devpts on /dev/pts type devpts
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=414952k,mode=755)
/dev/disk/by-uuid/8db75226-8f69-4861-b7a0-068db6da9584 on / type ext4
(rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
pstore on /sys/fs/pstore type pstore (rw,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=829900k)
none on /sys/kernel/security type securityfs (rw,relatime)
+ kpartx -av /home/user/whonix_binary/Whonix-Gateway.img
add map loop0p1 (254:0): 0 209711104 linear /dev/loop0 4096
+ mkdir --parents /home/user/whonix_binary/Whonix-Gateway_image
+ mount /dev/mapper/loop0p1 /home/user/whonix_binary/Whonix-Gateway_image
+ umount /home/user/whonix_binary/Whonix-Gateway_image/etc/resolv.conf
umount: /home/user/whonix_binary/Whonix-Gateway_image/etc/resolv.conf:
not found
+ true
+ umount /home/user/whonix_binary/Whonix-Gateway_image
+ kpartx -d /home/user/whonix_binary/Whonix-Gateway.img
loop deleted : /dev/loop0
+ rm -r /home/user/whonix_binary/Whonix-Gateway_image
+ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs
(rw,relatime,size=10240k,nr_inodes=212969,mode=755)
devpts on /dev/pts type devpts
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=414952k,mode=755)
/dev/disk/by-uuid/8db75226-8f69-4861-b7a0-068db6da9584 on / type ext4
(rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
pstore on /sys/fs/pstore type pstore (rw,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=829900k)
none on /sys/kernel/security type securityfs (rw,relatime)

##########

It worked. But when I run it for the second time, the device is busy.
Log follows.

##########

user at host:~$ sudo ./bbbbbbbbbbb
+ set -e
+ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs
(rw,relatime,size=10240k,nr_inodes=212969,mode=755)
devpts on /dev/pts type devpts
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=414952k,mode=755)
/dev/disk/by-uuid/8db75226-8f69-4861-b7a0-068db6da9584 on / type ext4
(rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
pstore on /sys/fs/pstore type pstore (rw,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=829900k)
none on /sys/kernel/security type securityfs (rw,relatime)
+ kpartx -av /home/user/whonix_binary/Whonix-Gateway.img
add map loop0p1 (254:0): 0 209711104 linear /dev/loop0 4096
+ mkdir --parents /home/user/whonix_binary/Whonix-Gateway_image
+ mount /dev/mapper/loop0p1 /home/user/whonix_binary/Whonix-Gateway_image
+ umount /home/user/whonix_binary/Whonix-Gateway_image/etc/resolv.conf
umount: /home/user/whonix_binary/Whonix-Gateway_image/etc/resolv.conf:
not found
+ true
+ umount /home/user/whonix_binary/Whonix-Gateway_image
+ kpartx -d /home/user/whonix_binary/Whonix-Gateway.img
device-mapper: remove ioctl on loop0p1 failed: Device or resource busy
loop deleted : /dev/loop0

##########

Any idea why that is?



More information about the pkg-lvm-maintainers mailing list