Bug 57117 - Errors unconfiguring loopback devices in init.d/halt
Summary: Errors unconfiguring loopback devices in init.d/halt
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
(Show other bugs)
Version: 7.2
Hardware: i386 Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2001-12-05 02:44 UTC by lars
Modified: 2014-03-17 02:24 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-12-13 23:36:20 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description lars 2001-12-05 02:44:09 UTC
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.

The solution:

Replace $device with $dev.

Comment 1 Joe Krahn 2001-12-13 23:36:16 UTC
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
command says:
  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
in /proc/mounts.

Comment 2 Bill Nottingham 2002-01-25 06:29:31 UTC
The dev/devices confusion will be fixed in initscripts-6.51-1, thanks!

Note You need to log in before you can comment on or make changes to this bug.