[Bug 1325359] Re: "umountiscsi.sh" tries to unmount "/" root partition on "service open-iscsi stop" command if no block device assigned to iscsi device!

Benjamin Drung 1325359 at bugs.launchpad.net
Mon Dec 16 14:33:50 UTC 2024


Thank you for taking the time to report this bug and helping to make Ubuntu better. We are sorry that we do not always have the capacity to look at all reported bugs in a timely manner. There have been many changes in Ubuntu since that time you reported the bug and your problem may have been fixed with some of the updates. It would help us a lot if you could test it on a currently supported Ubuntu version. When you test it and it is still an issue, kindly upload the updated logs by running only once:
apport-collect <bug #>

and any other logs that are relevant for this particular issue.

** Changed in: open-iscsi (Ubuntu)
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to open-iscsi in Ubuntu.
https://bugs.launchpad.net/bugs/1325359

Title:
  "umountiscsi.sh" tries to unmount "/" root partition on "service open-
  iscsi stop" command if no block device assigned to iscsi device!

Status in open-iscsi package in Ubuntu:
  Incomplete

Bug description:
  Whilst trying to debug open-iscsi on Trusty (because it doesn't appear
  to be allocating a block-device to iSCSI assocaitions out of the box -
  a separate issue), it became apparent that I could not simply stop the
  open-iscsi device because when you do, but when no block device is
  associated with the iscsi session, it tries to un-mount "/" and
  obviously fails:

  shared iscsi # /etc/init.d/open-iscsi stop
   * Unmounting iscsi-backed filesystems                                                                                                                                                                                                                                           umount: /: device is busy.
          (In some cases useful info about processes that use
           the device is found by lsof(8) or fuser(1))
   * Could not unmount /
                                                                                                                                                                                                                                                                            [fail]
  invoke-rc.d: initscript umountiscsi.sh, action "stop" failed.
   * Couldn't unmount all iSCSI devices. Cannot stop iSCSI service

  The script responsible for this it "umountiscsi.sh", and installed as
  part of the open-iscsi package, and is run on stop by the init script
  to try and unmount any iscsi volumes before pulling down the iscsi
  daemon.

  The section of code responsible is this:
      for HOST_DIR in /sys/devices/platform/host*; do
          if ! [ -d $HOST_DIR/iscsi_host* ]; then
              continue
          fi
          for SESSION_DIR in $HOST_DIR/session*; do
                  if ! [ -d $SESSION_DIR/target* ]; then
                          continue
                  fi
                  for BLOCK_FILE in $SESSION_DIR/target*/*\:*/block/*; do
                          BLOCK_DEV=`echo "$BLOCK_FILE" | sed 's/.*block\///'`
                          DOS_PARTITIONS="`awk "/^\/dev\/$BLOCK_DEV/ { print \\$2; }" < /proc/mounts`"
                          for DEVICE in $DOS_PARTITIONS; do
                                  #log_progress_msg $DEVICE
                                  #echo $DEVICE
                                  umount $DEVICE
                                  exit_status=$?
                                  if ! [ $exit_status -eq 0 ]; then
                                          umount_fail=1
                                          log_warning_msg "Could not unmount $DEVICE"
                                  fi
                          done
                  done
          done
      done

  
  I attach a very simple patch that fixes this - please include and push upstream.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/open-iscsi/+bug/1325359/+subscriptions




More information about the foundations-bugs mailing list