Red Hat Bugzilla – Bug 57117
Errors unconfiguring loopback devices in init.d/halt
Last modified: 2014-03-16 22:24:36 EDT
There is a syntax error in /etc/rc.d/init.d/halt that causes calls to
losetup to fail. This occurs around line 141 in initscript-6.40:
for dev in $remaining ; do
losetup $dev > /dev/null 2>&1 && \
runcmd $"Detaching loopback device $dev: " losetup -d $device
The loop variable is 'dev', but the call to losetup uses '$device'. This
results in a bad losetup command line, generating errors on the console and
failing to unconfigure the loopback device.
Replace $device with $dev.
An additional problem is that mounts using the loopback are
not unmounted prior to the losetup commands. It supposed to
happen on the line:
runcmd $"Unmounting loopback filesystems: " umount $remaining
In my case, /proc/mounts has something like:
/dev/loop0 /mnt/disc1 iso9660 ...
The awk line finds it and prints "/dev/loop0" but it needs
to print the second column, "/mnt/disc1". Running the mount
cdimage.iso on /mnt/disc1 type iso9660 ...
and umount wants one of those two, not /dev/loop0.
This occurs when mounting with the "loop" option.
Manually setting up a loop could be different. Maybe
it's best to try unmounting via both 1st and 2nd entry
The dev/devices confusion will be fixed in initscripts-6.51-1, thanks!