using umount with bash wildcard ends in "device is busy" for mount of parent directory

Asked by the2nd

hi,

i've run into a problem on ubuntu 14.04 while mounting an ganeti instance for doing some chroot stuff. but the problem itself not related to ganeti or any other virtualization. its just a problem while mounting some devices.

so heres an example how to reproduce the problem:

lvcreate -L 1G -n test system
lvcreate -L 1G -n test2 system
mkfs.ext4 /dev/system/test
mkfs.ext4 /dev/system/test2
mount /dev/system/test /mnt/
mkdir /mnt/test2
mount /dev/system/test2 /mnt/test2/
ln -sf /etc/issue /mnt/
umount /mnt/*
umount /mnt/
lvremove -f /dev/system/test2
lvremove -f /dev/system/test

if i run this commands /mnt/ is still mounted and it is only possible to umount it using "-l" switch. but after this it is still not possible to remove the logical volume because it says "Logical volume system/test contains a filesystem in use."

if i run the same commands but without the "ln -sf /etc/issue /mnt/" everything is okay. also if i replace "umount /mnt/*" with "umount /mnt/boot" everything works.

so it seems like umount ist opening /etc/issue for some reason if a bash wildcard is used and not releasing it. checking with lsof or fuser does not show any open files under /mnt/ nor for /etc/issue.

the problem does not exist with ubuntu 12.04.

a solution for this problem would be great because if you often do some chroot stuff it is easier to use "umount /mnt/*" to umount all bind mounts like /proc/ or /sys/ than running a umount command for each mount.

also i havent found a way, other than reboot, to remove an open logical volume if it was hit by this problem.

regards
the2nd

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

If your pwd in terminal is a subfolder of the mount point, it will be marked as busy. Be sure the terminal is outside of the folder.

Revision history for this message
the2nd (the2nd) said :
#2

the working directory is not /mnt. i just used the commands from my initial post:

lvcreate -L 1G -n test system
lvcreate -L 1G -n test2 system
mkfs.ext4 /dev/system/test
mkfs.ext4 /dev/system/test2
mount /dev/system/test /mnt/
mkdir /mnt/test2
mount /dev/system/test2 /mnt/test2/
ln -sf /etc/issue /mnt/
umount /mnt/*
umount /mnt/
lvremove -f /dev/system/test2
lvremove -f /dev/system/test

Running this commands on 12.04 LTS works without problems. on 14.04 i run into the issue describe above....

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

I suggest you report a bug

Can you help with this problem?

Provide an answer of your own, or ask the2nd for more information if necessary.

To post a message you must log in.