LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   During shutdown /, /srv/ var: "device busy" (http://www.linuxquestions.org/questions/slackware-14/during-shutdown-srv-var-device-busy-797735/)

catkin 03-25-2010 04:24 AM

During shutdown /, /srv/ var: "device busy"
 
Hello :)

During shutdown:
Code:

umount: /srv: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
umount: /var: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
/dev/mapper/CW8-s_opt umounted
/dev/mapper/CW8-home umounted
umount: /: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
nfsd umounted
tmpfs umounted
/dev/sdb6 umounted
/dev/sda5 umounted
/dev/sda2 umounted
/dev/mapper/CW8-srv umounted
/dev/mapper/CW8-s_var umounted
usbfs umounted

Here's fstab
Code:

# /etc/fstab: static file system information.
#
# <file system> <mount point>  <type>      <options>            <dump> <pass>
/dev/CW8/home  /home/c/d      ext3        relatime                  0 2
/dev/CW8/s_opt  /opt          ext4        relatime                  0 2
/dev/CW8/s_var  /var          ext4        relatime                  0 2
/dev/CW8/srv    /srv          ext3        relatime                  0 2
/dev/sda2      /boot          ext3        relatime                  0 2
/dev/sda5      /var/cache/WXP vfat        relatime,rw,umask=000      0 2
/dev/sda7      /              jfs        relatime,errors=remount-ro 0 1
/dev/sda8      swap          swap        defaults                  0 0
/dev/sdb6      /srv/bacula    jfs        relatime                  0 2
devpts          /dev/pts      devpts      gid=5,mode=620            0 0
proc            /proc          proc        defaults                  0 0
tmpfs          /dev/shm      tmpfs      defaults                  0 0

and /etc/exports
Code:

/home 192.168.1.46(rw,no_root_squash,no_subtree_check) 192.168.1.49(rw,no_root_squash,no_subtree_check)
/home/c/d 192.168.1.41(rw,no_root_squash,no_subtree_check) 192.168.1.46(rw,no_root_squash,no_subtree_check) 192.168.1.49(rw,no_root_squash,no_subtree_check)
/usr 192.168.1.46(rw,no_root_squash,no_subtree_check) 192.168.1.48(rw,no_root_squash,no_subtree_check) 192.168.1.49(rw,no_root_squash,no_subtree_check)

To investigate the problem, I modified /etc/rc.d/rc.6 (rc.0 is a symlink to rc.6):
Code:

log=/etc/rc.d/shutdown.log
echo 'DEBUG: Before unmounting LVM volumes' > $log
lsof /var /srv >> $log
lsof /dev/mapper/CW8-s_var /dev/mapper/CW8-srv >> $log
fuser -amu /srv /var >> $log
ps -ef >> $log

# Umount any LVM volumes:
if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
  echo "DEBUG: Unmounting LVM volumes." >> $log
  echo "Unmounting LVM volumes."
  /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac) 2>&1 | tee -a $log
fi

echo 'DEBUG: After unmounting LVM volume, before unmounting local file systems' >> $log
echo "Unmounting local file systems."
/bin/umount -v -a -t no,proc,sysfs 2>&1 | tee -a $log

After reboot, ps -ef output in /etc/rc.d/shutdown.log showed only init, kthreadd and its children, rc.0 and ps itself running. There was no output from the lsof or fuser commands:
Code:

root@CW8:/etc/rc.d# cat shutdown.log
DEBUG: Before unmounting LVM volumes
UID        PID  PPID  C STIME TTY          TIME CMD
root        1    0  0 Mar24 ?        00:00:00 init [0]
root        2    0  0 Mar24 ?        00:00:00 [kthreadd]
root        3    2  0 Mar24 ?        00:00:00 [migration/0]
root        4    2  0 Mar24 ?        00:00:00 [ksoftirqd/0]
root        5    2  0 Mar24 ?        00:00:00 [migration/1]
root        6    2  0 Mar24 ?        00:00:00 [ksoftirqd/1]
root        7    2  0 Mar24 ?        00:00:00 [events/0]
root        8    2  0 Mar24 ?        00:00:01 [events/1]
root        9    2  0 Mar24 ?        00:00:00 [work_on_cpu/0]
root        10    2  0 Mar24 ?        00:00:00 [work_on_cpu/1]
root        11    2  0 Mar24 ?        00:00:00 [khelper]
root      183    2  0 Mar24 ?        00:00:00 [kblockd/0]
root      184    2  0 Mar24 ?        00:00:00 [kblockd/1]
root      186    2  0 Mar24 ?        00:00:00 [kacpid]
root      187    2  0 Mar24 ?        00:00:00 [kacpi_notify]
root      251    2  0 Mar24 ?        00:00:00 [ata/0]
root      252    2  0 Mar24 ?        00:00:00 [ata/1]
root      253    2  0 Mar24 ?        00:00:00 [ata_aux]
root      254    2  0 Mar24 ?        00:00:00 [ksuspend_usbd]
root      260    2  0 Mar24 ?        00:00:00 [khubd]
root      263    2  0 Mar24 ?        00:00:00 [kseriod]
root      290    2  0 Mar24 ?        00:00:00 [khpsbpkt]
root      322    2  0 Mar24 ?        00:00:05 [pdflush]
root      323    2  0 Mar24 ?        00:00:09 [kswapd0]
root      370    2  0 Mar24 ?        00:00:00 [aio/0]
root      371    2  0 Mar24 ?        00:00:00 [aio/1]
root      388    2  0 Mar24 ?        00:00:00 [nfsiod]
root      397    2  0 Mar24 ?        00:00:00 [jfsIO]
root      398    2  0 Mar24 ?        00:00:00 [jfsCommit]
root      399    2  0 Mar24 ?        00:00:00 [jfsCommit]
root      400    2  0 Mar24 ?        00:00:00 [jfsSync]
root      407    2  0 Mar24 ?        00:00:00 [xfs_mru_cache]
root      408    2  0 Mar24 ?        00:00:00 [xfslogd/0]
root      409    2  0 Mar24 ?        00:00:00 [xfslogd/1]
root      410    2  0 Mar24 ?        00:00:00 [xfsdatad/0]
root      411    2  0 Mar24 ?        00:00:00 [xfsdatad/1]
root      412    2  0 Mar24 ?        00:00:00 [glock_workqueue]
root      413    2  0 Mar24 ?        00:00:00 [glock_workqueue]
root      1157    2  0 Mar24 ?        00:00:00 [scsi_tgtd/0]
root      1158    2  0 Mar24 ?        00:00:00 [scsi_tgtd/1]
root      1172    2  0 Mar24 ?        00:00:00 [iscsi_eh]
root      1181    2  0 Mar24 ?        00:00:00 [fc_rport_eq]
root      1182    2  0 Mar24 ?        00:00:00 [fcoethread/0]
root      1183    2  0 Mar24 ?        00:00:00 [fcoethread/1]
root      1247    2  0 Mar24 ?        00:00:00 [scsi_eh_2]
root      1250    2  0 Mar24 ?        00:00:00 [scsi_eh_3]
root      1253    2  0 Mar24 ?        00:00:00 [scsi_eh_4]
root      1256    2  0 Mar24 ?        00:00:00 [scsi_eh_5]
root      1317    2  0 Mar24 ?        00:00:00 [exec-osm/0]
root      1318    2  0 Mar24 ?        00:00:00 [exec-osm/1]
root      1324    2  0 Mar24 ?        00:00:00 [block-osm/0]
root      1325    2  0 Mar24 ?        00:00:00 [block-osm/1]
root      1410    2  0 Mar24 ?        00:00:00 [kstriped]
root      1412    2  0 Mar24 ?        00:00:00 [ksnapd]
root      1416    2  0 Mar24 ?        00:00:00 [hid_compat]
root      1446    2  0 Mar24 ?        00:00:00 [rpciod/0]
root      1447    2  0 Mar24 ?        00:00:00 [rpciod/1]
root      2022    2  0 Mar24 ?        00:00:00 [kpsmoused]
root      2260    1  0 03:06 ?        00:00:00 /bin/sh /etc/rc.d/rc.0
root      2342  2260  0 03:06 ?        00:00:00 ps -ef
root      2645    2  0 Mar24 ?        00:00:00 [hd-audio0]
root      3048    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3052    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3059    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3065    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3074    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3084    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3094    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3104    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3110    2  0 Mar24 ?        00:00:00 [kdmflush]
root      3222    2  0 Mar24 ?        00:00:00 [kjournald]
root      3223    2  0 Mar24 ?        00:00:00 [kjournald2]
root      3224    2  0 Mar24 ?        00:00:01 [kjournald2]
root      3225    2  0 Mar24 ?        00:00:00 [kjournald]
root      3226    2  0 Mar24 ?        00:00:00 [kjournald]
root    27909    2  0 Mar24 ?        00:00:00 [pdflush]
DEBUG: Unmounting LVM volumes.
umount: /srv: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
umount: /var: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
/dev/mapper/CW8-s_opt umounted
/dev/mapper/CW8-home umounted
DEBUG: After unmounting LVM volume, before unmounting local file systems
umount: /: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
nfsd umounted
tmpfs umounted
/dev/sdb6 umounted
/dev/sda5 umounted
/dev/sda2 umounted
/dev/mapper/CW8-srv umounted
/dev/mapper/CW8-s_var umounted
usbfs umounted

What to do?

Best

Charles

GazL 03-25-2010 06:58 AM

Your problem is that the "Unmount any LVM Volumes:" section of rc.6 is trying to unmount all filesystems on lvm volumes, including /srv, but in your case you have a non-lvm filesystem mounted at a lower mountpoint (/srv/bacula) which will result in /srv being 'busy'. The same thing is happening with your /var and /var/cache/WXP.


My advice would be to completely remove the "Unmount any LVM Volumes" section of rc.6 and let the "unmount local filesystems" section of code directly below it deal with all the unmounting. Filesystems on LVM volumes are 'local' so there's no reason I can think of for this extra section of code being in rc.6

Besides, that section of code is a bit brain-dead anyway, "mount | grep /dev/mapper" isn't a reliable way of identifying filesystems on LVM LVs as other things can have /dev/mapper/... devices!

I have raised the issue of this unnecessary section of code in the past on this forum, but the devs weren't particularly interested at that time. Maybe now there's a good example of it causing someone a problem they'll take another look at it.

catkin 03-25-2010 07:25 AM

Thanks GazL :)

Analysis understood (why didn't I realise it was mountpoints on the affected file systems that were causing the problem? :doh:).

Solution implemented and tested -- OK.

Good luck with getting the code changed.

Best

Charles

GazL 03-25-2010 08:04 AM

You're welcome mate, and thanks for reporting back that it does the job. That should help the cause.

There's a couple of other nasties in rc.6 that I'm intending to look at and see if I can find a better way of doing things, but that's for another day/thread. :)


All times are GMT -5. The time now is 07:58 PM.