Bug 57117 - Errors unconfiguring loopback devices in init.d/halt
Errors unconfiguring loopback devices in init.d/halt
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2001-12-04 21:44 EST by lars
Modified: 2014-03-16 22:24 EDT (History)
2 users (show)

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

Attachments (Terms of Use)

  None (edit)
Description lars 2001-12-04 21:44:09 EST
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 18:36:16 EST
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 01:29:31 EST
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.