LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Thread Tools
Old 11-08-2009, 06:25 PM   #1
kehcho
LQ Newbie
 
Registered: Jul 2006
Posts: 8
Thanked: 0
BackTrack based on SLAX, umount /: device is busy


[Log in to get rid of this advertisement]
Hi, all

First I sorry for my bad language...

I recently install that SO and I've hot a next problem. When I reboot or shutdown the computer, appears the following message:

Quote:
umount /: device is busy
I search in Google users who have the same problem and I add some lines to /etc/rc.d/rc.0 ---> lsof > /root/openfiles.txt afert the hardware clock sync and before the unmounting if tmpfs... And I obtain the next messages:

Quote:
rc.6 3552 root cwd DIR 3,66 4096 2 /
rc.6 3552 root rtd DIR 3,66 4096 2 /
rc.6 3552 root txt REG 3,66 678832 732968 /bin/bash
rc.6 3552 root mem REG 3,66 45552 928552 /lib/libnss_files-2.5.so
rc.6 3552 root mem REG 3,66 41045 928556 /lib/libnss_nis-2.5.so
rc.6 3552 root mem REG 3,66 96480 928546 /lib/libnsl-2.5.so
rc.6 3552 root mem REG 3,66 35494 928548 /lib/libnss_compat-2.5.so
rc.6 3552 root mem REG 3,66 1528742 928511 /lib/libc-2.5.so
rc.6 3552 root mem REG 3,66 13506 928527 /lib/libdl-2.5.so
rc.6 3552 root mem REG 3,66 10280 928584 /lib/libtermcap.so.2.0.8
rc.6 3552 root mem REG 3,66 131484 928495 /lib/ld-2.5.so
rc.6 3552 root 0u CHR 5,1 4674 /dev/console
rc.6 3552 root 1u CHR 5,1 4674 /dev/console
rc.6 3552 root 2u CHR 5,1 4674 /dev/console
rc.6 3552 root 255r REG 3,66 7361 668605 /etc/rc.d/rc.6
I don't know how to resolve that problem.. And every time when I start the machine with the first OS was I installed say:

Quote:
Nov 8 17:17:42 wifiway kernel: EXT3 FS on hdb2, internal journal
Nov 8 17:17:42 wifiway kernel: EXT3-fs: recovery complete.
Nov 8 17:17:42 wifiway kernel: EXT3-fs: mounted filesystem with ordered data mode.
Thanks advance...
linux kehcho is offline     Reply With Quote
Old 11-08-2009, 06:41 PM   #2
Ivshti
Member
 
Registered: Sep 2008
Posts: 38
Thanked: 18
Probably it doesn't kill all the processes before trying to unmount /.
Try to copy the rc.0/rc.6 scripts from Slackware.
I don't think that problem is fatal however.
linux Ivshti is offline     Reply With Quote
Thanked by:
Old 11-08-2009, 08:51 PM   #3
AuroraZero
Member
 
Registered: Oct 2009
Location: Michigan
Distribution: SlackWare 13.0 - Current
Posts: 53
Thanked: 5
Quote:
Originally Posted by Ivshti View Post
Probably it doesn't kill all the processes before trying to unmount /.
Try to copy the rc.0/rc.6 scripts from Slackware.
I don't think that problem is fatal however.
Yes it is trying to unmount the drive to soon and can not do it because it is still running processes. You can copy those Slackware scripts or you can compare them to see where the originals are messed up and fix them. I prefer the second route even if it takes hours to do since I may learn something new from it.
linux AuroraZero is online now     Reply With Quote
Thanked by:
Old 11-09-2009, 05:31 PM   #4
kehcho
LQ Newbie
 
Registered: Jul 2006
Posts: 8
Thanked: 0

Original Poster
[SOLVED]
Quote:
Originally Posted by Ivshti View Post
Probably it doesn't kill all the processes before trying to unmount /.
Try to copy the rc.0/rc.6 scripts from Slackware.
I don't think that problem is fatal however.
Yes, the system doesn't kill all the processes..

Quote:
Originally Posted by AuroraZero View Post
Yes it is trying to unmount the drive to soon and can not do it because it is still running processes. You can copy those Slackware scripts or you can compare them to see where the originals are messed up and fix them. I prefer the second route even if it takes hours to do since I may learn something new from it.
Yes, I learn someting new too... I compare the files and that is the output:

Code:
sdiff /etc/rc.d/rc.6 /etc/rc.d/rc.6.ORIGINAL_SLACKWARE
This is /etc/rc.d/rc.6 of BackTrack3 based on SLAX, that file is edited for a live-cd
Code:
#! /bin/sh
#
# rc.6		This file is executed by init when it goes into runlevel
#		0 (halt) or runlevel 6 (reboot). It kills all processes,
#		unmounts file systems and then either halts or reboots.
#
# Version:	@(#)/etc/rc.d/rc.6	2.47 Sat Jan 13 13:37:26 PST 2001
#
# Author:	Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by:  Patrick J. Volkerding, <volkerdi@slackware.com>
#
# Modified by:  Tomas M <www.slax.org> in order to:
#               - remove swap deactivation (tmpfs may be there)
#               - add notmpfs argument to unmount
#               - run cleanup script from Linux Live scripts

# Set the path.
PATH=/sbin:/etc:/bin:/usr/bin

# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
  . /etc/rc.d/rc.sysvinit
fi

# Set linefeed mode to avoid staircase effect.
/bin/stty onlcr

echo "Running shutdown script $0:"

# Find out how we were called.
case "$0" in
	*0)
		command="halt"
		;;
	*6)
		command=reboot
		;;
	*)
		echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
		exit 1
		;;
esac

# Save the system time to the hardware clock using hwclock --systohc.
if [ -x /sbin/hwclock ]; then
  # Check for a broken motherboard RTC clock (where ioports for rtc are
  # unknown) to prevent hwclock causing a hang:
  if ! grep -q -w rtc /proc/ioports ; then
    CLOCK_OPT="--directisa"
  fi
  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
    echo "Saving system time to the hardware clock (UTC)."
    /sbin/hwclock $CLOCK_OPT --utc --systohc
  else
    echo "Saving system time to the hardware clock (localtime)."
    /sbin/hwclock  $CLOCK_OPT --localtime --systohc
  fi
fi

# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
  /etc/rc.d/rc.local_shutdown stop
fi

# Stop the Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
  /etc/rc.d/rc.httpd stop
fi

# Stop the MySQL database:
if [ -r /var/run/mysql/mysql.pid ]; then
  . /etc/rc.d/rc.mysqld stop
fi

# Stop the Samba server:
if [ -x /etc/rc.d/rc.samba ]; then
  . /etc/rc.d/rc.samba stop
fi

# Shut down the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
  /etc/rc.d/rc.nfsd stop
fi

# Shut down the SSH server:
if [ -x /etc/rc.d/rc.sshd ]; then
  /etc/rc.d/rc.sshd stop
fi

# Shut down the SASL authentication daemon:
if [ -x /etc/rc.d/rc.saslauthd ]; then
  /etc/rc.d/rc.saslauthd stop
fi

# Shut down OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
  /etc/rc.d/rc.openldap stop
fi

# Stop D-Bus:
if [ -x /etc/rc.d/rc.messagebus ]; then
  sh /etc/rc.d/rc.messagebus stop
fi

# Unmount any NFS, SMB, or CIFS filesystems:
echo "Unmounting remote filesystems."
/bin/umount -a -r -t nfs,smbfs,cifs

# Try to shut down pppd:
PS="$(ps ax)"
if /bin/echo "$PS" | /bin/grep -q -w pppd ; then
  if [ -x /usr/sbin/ppp-off ]; then
    /usr/sbin/ppp-off
  fi
fi

# Bring down the networking system, but first make sure that this
# isn't a diskless client with the / partition mounted via NFS:
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
  if [ -x /etc/rc.d/rc.inet1 ]; then
    . /etc/rc.d/rc.inet1 stop
  fi
fi

# In case dhcpcd might have been manually started on the command line,
# look for the .pid file, and shut dhcpcd down if it's found:
if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
  # A little time for /etc/resolv.conf and/or other files to
  # restore themselves.
  sleep 2
fi

# Shut down PCMCIA devices:
if [ -x /etc/rc.d/rc.pcmcia ] ; then
  . /etc/rc.d/rc.pcmcia stop
  # The cards might need a little extra time here to deactivate:
  /bin/sleep 5
fi

# Turn off process accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
  /bin/echo "Turning off process accounting."
  /sbin/accton
fi

# Kill all processes.
# INIT is supposed to handle this entirely now, but this didn't always
# work correctly without this second pass at killing off the processes.
# Since INIT already notified the user that processes were being killed,
# we'll avoid echoing this info this time around.
#TM: we need fuse-based filesystem to be alive (if mounted from initrd).
#if [ ! "$1" = "fast" ]; then # shutdown did not already kill all processes
#  /sbin/killall5 -15
#  /bin/sleep 5
#  /sbin/killall5 -9
#fi

# Try to turn off quota.
if /bin/grep -q quota /etc/fstab ; then
  if [ -x /sbin/quotaoff ]; then
    echo "Turning off filesystem quotas."
    /sbin/quotaoff -a
  fi
fi

# Carry a random seed between reboots.
echo "Saving random seed from /dev/urandom in /etc/random-seed."
# Use the pool size from /proc, or 512 bytes:
if [ -r /proc/sys/kernel/random/poolsize ]; then
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
else
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
fi
/bin/chmod 600 /etc/random-seed

# Before unmounting file systems write a reboot or halt record to wtmp.
$command -w

# Clear /var/lock/subsys.
if [ -d /var/lock/subsys ]; then
  rm -f /var/lock/subsys/*
fi

# Turn off swap, then unmount local file systems.
# TM: disabled
#/bin/echo "Turning off swap."
#/sbin/swapoff -a
/bin/sync

modprobe -r snd_hda_intel

lsof > /root/openfiles.txt # by me, see open files during restart or halt

echo "Unmounting local file systems."
KERNEL_VERSION=$(/bin/uname -r | /bin/cut -d . -f 1,2)
ROOTFS_TYPE=$(/bin/mount | /bin/head -n 1 | /bin/cut -d ' ' -f 5)
if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
  /bin/umount $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
fi

# Deactivate LVM volume groups:
if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
  echo "Deactivating LVM volume groups:"
  /sbin/vgchange -an --ignorelockingfailure
fi

/bin/umount -a -r -t nonfs,noproc,nosysfs,notmpfs

# We don't need to remount root directory readonly in Slax, as it's tmpfs
# It could took very long time. So skip remount if cleanup script is found.
# Nevertheless we MUST remount ro if the cleanup script is not found
# (eg. in the case user installed Slax to disk as a real OS using cp).
if [ ! -x /mnt/live/cleanup ]; then
    echo "Remounting root filesystem read-only."
    /bin/mount -n -o remount,ro /
fi

# This never hurts:
/bin/sync

# sleep 1 fixes problems with some hard drives that don't
# otherwise finish syncing before reboot or poweroff
/bin/sleep 1

# This is to ensure all processes have completed on SMP machines:
wait

if [ -x /sbin/genpowerd ]; then
  # See if this is a powerfail situation:
  if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
    # Signal UPS to shut off the inverter:
    /sbin/genpowerd -k
    if [ ! $? = 0 ]; then
      echo
      echo "There was an error signaling the UPS."
      echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
      echo "the serial line and UPS type."
      # Wasting 15 seconds of precious power:
      /bin/sleep 15
    fi
  fi
fi

# start Slax cleanup script, which ensures everything is correctly unmounted
if [ -x /mnt/live/cleanup ]; then
   cd /mnt/live/
   exec ./cleanup $command <dev/console >dev/console 2>&1
fi

# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$command" = "reboot" ]; then
  echo "Rebooting."
  /sbin/reboot
else
  /sbin/poweroff
fi
I edit the file by combining each other:

Code:
#! /bin/sh
#
# rc.6		This file is executed by init when it goes into runlevel
#		0 (halt) or runlevel 6 (reboot). It kills all processes,
#		unmounts file systems and then either halts or reboots.
#
# Version:	@(#)/etc/rc.d/rc.6	2.47 Sat Jan 13 13:37:26 PST 2001
#
# Author:	Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by:  Patrick J. Volkerding, <volkerdi@slackware.com>
#

# Set the path.
PATH=/sbin:/etc:/bin:/usr/bin

# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
  . /etc/rc.d/rc.sysvinit
fi

# Set linefeed mode to avoid staircase effect.
/bin/stty onlcr

echo "Running shutdown script $0:"

# Find out how we were called.
case "$0" in
	*0)
		command="halt"
		;;
	*6)
		command=reboot
		;;
	*)
		echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
		exit 1
		;;
esac

# Save the system time to the hardware clock using hwclock --systohc.
if [ -x /sbin/hwclock ]; then
  # Check for a broken motherboard RTC clock (where ioports for rtc are
  # unknown) to prevent hwclock causing a hang:
  if ! grep -q -w rtc /proc/ioports ; then
    CLOCK_OPT="--directisa"
  fi
  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
    echo "Saving system time to the hardware clock (UTC)."
    /sbin/hwclock $CLOCK_OPT --utc --systohc
  else
    echo "Saving system time to the hardware clock (localtime)."
    /sbin/hwclock  $CLOCK_OPT --localtime --systohc
  fi
fi

# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
  /etc/rc.d/rc.local_shutdown stop
fi

# Stop the Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
  /etc/rc.d/rc.httpd stop
fi

# Stop the MySQL database:
if [ -r /var/run/mysql/mysql.pid ]; then
  . /etc/rc.d/rc.mysqld stop
fi

# Stop the Samba server:
if [ -x /etc/rc.d/rc.samba ]; then
  . /etc/rc.d/rc.samba stop
fi

# Shut down the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
  /etc/rc.d/rc.nfsd stop
fi

# Shut down the SSH server:
if [ -x /etc/rc.d/rc.sshd ]; then
  /etc/rc.d/rc.sshd stop
fi

# Shut down the SASL authentication daemon:
if [ -x /etc/rc.d/rc.saslauthd ]; then
  /etc/rc.d/rc.saslauthd stop
fi

# Shut down OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
  /etc/rc.d/rc.openldap stop
fi

# If it looks like we use an initrd, prepare for one at next boot:
if /bin/grep -q -w initrd /var/log/messages ; then
  /bin/mkdir -p /initrd
fi

# Unmount any NFS, SMB, or CIFS filesystems:
echo "Unmounting remote filesystems."
/bin/umount -a -r -t nfs,smbfs,cifs

# Try to shut down pppd:
PS="$(ps ax)"
if /bin/echo "$PS" | /bin/grep -q -w pppd ; then
  if [ -x /usr/sbin/ppp-off ]; then
    /usr/sbin/ppp-off
  fi
fi

# Bring down the networking system, but first make sure that this
# isn't a diskless client with the / partition mounted via NFS:
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
  if [ -x /etc/rc.d/rc.inet1 ]; then
    . /etc/rc.d/rc.inet1 stop
  fi
fi

# In case dhcpcd might have been manually started on the command line,
# look for the .pid file, and shut dhcpcd down if it's found:
if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
  # A little time for /etc/resolv.conf and/or other files to
  # restore themselves.
  sleep 2
fi

# Shut down PCMCIA devices:
if [ -x /etc/rc.d/rc.pcmcia ] ; then
  . /etc/rc.d/rc.pcmcia stop
  # The cards might need a little extra time here to deactivate:
  /bin/sleep 5
fi

# Turn off process accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
  /bin/echo "Turning off process accounting."
  /sbin/accton
fi

# Kill all processes.
# INIT is supposed to handle this entirely now, but this didn't always
# work correctly without this second pass at killing off the processes.
# Since INIT already notified the user that processes were being killed,
# we'll avoid echoing this info this time around.
if [ ! "$1" = "fast" ]; then # shutdown did not already kill all processes
  /sbin/killall5 -15 
  /bin/sleep 5
  /sbin/killall5 -9
fi

# Try to turn off quota.
if /bin/grep -q quota /etc/fstab ; then
  if [ -x /sbin/quotaoff ]; then
    echo "Turning off filesystem quotas."
    /sbin/quotaoff -a
  fi
fi

# Carry a random seed between reboots.
echo "Saving random seed from /dev/urandom in /etc/random-seed."
# Use the pool size from /proc, or 512 bytes:
if [ -r /proc/sys/kernel/random/poolsize ]; then
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
else
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
fi
/bin/chmod 600 /etc/random-seed

# Before unmounting file systems write a reboot or halt record to wtmp.
$command -w

# Clear /var/lock/subsys.
if [ -d /var/lock/subsys ]; then
  rm -f /var/lock/subsys/*
fi

# Turn off swap, then unmount local file systems.
/bin/echo "Turning off swap."
/sbin/swapoff -a
/bin/sync

echo "Unmounting local file systems."
KERNEL_VERSION=$(/bin/uname -r | /bin/cut -d . -f 1,2)
ROOTFS_TYPE=$(/bin/mount | /bin/head -n 1 | /bin/cut -d ' ' -f 5)
if [ "$KERNEL_VERSION" == "2.4" ]; then
  if [ ! "$ROOTFS_TYPE" = "umsdos" ]; then
    /bin/umount -a -t nonfs,noproc,nosysfs
  else
    /bin/umount -a -t nonfs,noproc,nosysfs,noumsdos
  fi
else
  if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
    /bin/umount $(/bin/mount | /bin/awk '/^\/dev\/mapper\// { print $3 }' | /bin/tac)
  fi
fi

# Deactivate LVM volume groups:
if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
  echo "Deactivating LVM volume groups:"
  if [ "$KERNEL_VERSION" == "2.4" ]; then
    /sbin/vgchange -an
  else
    /sbin/vgchange -an --ignorelockingfailure
  fi
fi

# Don't remount UMSDOS root volumes:
if [ ! "$ROOTFS_TYPE" = "umsdos" ]; then
  /bin/umount -a -r -t nonfs,noproc,nosysfs
  echo "Remounting root filesystem read-only."
  /bin/mount -n -o remount,ro /
else
  /bin/umount -a -r -t nonfs,noproc,nosysfs,noumsdos
fi

# This never hurts:
/bin/sync

# sleep 1 fixes problems with some hard drives that don't
# otherwise finish syncing before reboot or poweroff
/bin/sleep 1

# This is to ensure all processes have completed on SMP machines:
wait

if [ -x /sbin/genpowerd ]; then
  # See if this is a powerfail situation:
  if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
    # Signal UPS to shut off the inverter:
    /sbin/genpowerd -k
    if [ ! $? = 0 ]; then
      echo
      echo "There was an error signaling the UPS."
      echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
      echo "the serial line and UPS type."
      # Wasting 15 seconds of precious power:
      /bin/sleep 15
    fi
  fi
fi

# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$command" = "reboot" ]; then
  echo "Rebooting."
  /sbin/reboot
else
  /sbin/poweroff
fi
When I'm restrating, all appear good.. now, but I don't know if the code of the script is good!

Thanks for the idea Ivshti & AuroraZero!

Last edited by kehcho; 11-09-2009 at 05:43 PM..
linux kehcho is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linux BackTrack: umount /: device is busy kehcho Linux - Newbie 2 11-10-2009 10:07 AM
umount device busy ...ARGGHHH Gintaras Linux - Newbie 4 10-09-2007 08:46 PM
Cannot umount - device busy rust8y Linux - General 5 07-16-2006 09:41 PM
umount :device busy Pedroski Linux - Hardware 14 12-29-2004 04:37 PM
umount - device is busy - with what??? Moebius Linux - Software 16 12-08-2004 11:32 AM


All times are GMT -5. The time now is 09:47 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration