LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-31-2014, 07:22 PM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,496

Rep: Reputation: 103Reputation: 103
The "device is busy" but I can not find out why


Here is the situation...

I have established an encypted partition on a drive in my server (Ubuntu 12.04 server) using cryptsetup. It seems to work OK. When I wish to access the partition I invoke the following script on the server via ssh from my PC
Code:
#!/bin/bash

sudo cryptsetup luksOpen /dev/sdb1 sdb1
sudo mount /dev/mapper/sdb1 /crypt

echo Partition Attached - press enter
read nothing
and provided I enter the correct passphrase the contents of the encryped partition appear under /crypt

I have the mount point /crypt exported to my PC, and my PC only with nfs. The line in /etc/exports reads
Quote:
/crypt 192.168.0.112(rw,async,no_root_squash)
This also works fine. I can mount the exported /crypt on my PC (CentOS 6) and see the contents of the encrypted partition on the server.

However, the problem comes when I attempt to umount the mount point on the server.

If I do thus:

mount the encrypted partition on the server
mount the exported directory on the PC
umount the exported directory on the PC

I can umount the mount on the server.

If I do thus:

mount the encrypted partition on the server
mount the exported directory on the PC
access - even to read - the exported directory (using the PC)
umount the exported directory on the PC
Attempt to umount the mount point on the server

I get the following error
Quote:
ken@taylor14:~$ sudo umount /crypt
umount: /crypt: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
I have tried lsof and fuse and studied their man pages and examples on-line but I cannot find any guilt suspects holding files in /crypt.

I am at a loss as to what to try next. Can anyone make any suggestions?

TIA,

Ken
 
Old 05-31-2014, 08:42 PM   #2
potato_farmer
Member
 
Registered: May 2014
Posts: 55

Rep: Reputation: Disabled
After unmounting from the PC, try the following command on both the server and the PC and see if you get any results.

Code:
lsof | grep "/crypt"
 
Old 05-31-2014, 09:33 PM   #3
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,496

Original Poster
Rep: Reputation: 103Reputation: 103
Thanks potato_farmer,

I mounted the encrypted drive on the server and issued the command on the server - no results.

I mounted the nfs exported directory on the server from the PC - no results on the server nor the PC.

I accessed the mounted directory with gnome-commander on the PC - again, nothing on either machine.

I opened a file in directory - from on the PC - nothing on the server but I do see the file in the results on the PC

I closed the file on the PC and it disappeared from the lsof results on the PC. It is still NOT in the results on the server.

A sound approach but unfortunately no hit of what is still open. I suspect I need to stop/start or restart the nfs service but I have not figured out how to do that.

Thanks again,

Ken
 
Old 05-31-2014, 09:41 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,131

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
Did you try the "lazy" option to umount?

i.e.,
Code:
umount -l /crypt
(that's a lower case letter ell option)

Also, make sure you do not have some directory under /crypt as your current working directory.

Try this:
Code:
cd /
umount -l /crypt
 
Old 06-01-2014, 06:09 AM   #5
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,496

Original Poster
Rep: Reputation: 103Reputation: 103
Thanks haertig,

I have tried the lazy option with umount on the server. It "works" except that the underlying device /dev/mapper/sdb (the encrypted partition) is then still busy and I cannot shut it off with "sudo cryptsetup remove sdb1".

You make a good point about not being in the /crypt tree. pwd shows me to still be in my home directory. Truly a puzzler.

Thanks again,

Ken
 
Old 06-01-2014, 08:56 AM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,502
Blog Entries: 1

Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
It could be that some kernel modules are in play with regards to the device and filesystem. And of course that does not show up in the lsof or fuser results.
 
Old 06-02-2014, 08:24 PM   #7
selfprogrammed
Member
 
Registered: Jan 2010
Location: Minnesota, USA
Distribution: Slackware 13.37
Posts: 291

Rep: Reputation: 55
Check /var for locks.
 
Old 06-02-2014, 09:23 PM   #8
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,496

Original Poster
Rep: Reputation: 103Reputation: 103
Thanks selfprogrammed,

A good suggestion but no luck. I examined /var and found
Quote:
lrwxrwxrwx 1 root root 9 Apr 26 18:45 lock -> /run/lock/
I then looked at /run/lock and found
Quote:
drwxr-xr-x 2 whoopsie whoopsie 60 Jun 2 21:08 whoopsie
I mounted the encryted partiton, accessed it with gnome-commander on the server and observed no locks. But it is now busy if I try to umount.

Ken
 
Old 06-03-2014, 02:18 PM   #9
selfprogrammed
Member
 
Registered: Jan 2010
Location: Minnesota, USA
Distribution: Slackware 13.37
Posts: 291

Rep: Reputation: 55
I assume you have tried
>> fuser -m /dev/sdb1


Someone else solved a similar problem:
http://ubuntuforums.org/showthread.php?t=1775679


Try issuing the command from 'root'. That bypasses all permissions problems.
If no program has it open, it is usually a permission problem.


If you get desperate there are two approaches.

1. When it comes time to shutdown the system. Try killing off processes manually one at a time until the umount command works.

2. Install print stmts in umount and the kernel to track exactly what is making it busy.
(The kernel should have had this years ago).
 
Old 06-04-2014, 09:29 PM   #10
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,496

Original Poster
Rep: Reputation: 103Reputation: 103
Thanks again selfprogrammed. fuser -m returns a lot of process numbers. Interestingly the same process numbers are returned regardless if the partition is mapped or not.

I generally bring this server up only if I need to backup something to it or recover something which has been backed up. I may pick at the issue a little more. However, it is not a show stopper. I can shut down the server successfully and that umounts /crypt and closes the encrypted file system without apparent error.

Thanks again,

Ken
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
FC multipath says "device busy " when connecting again. SLES 11 - netapp - emulex permalac Linux - Server 1 01-13-2012 05:45 PM
Debian 5 mdadm "device or resource busy" raid edwardzc Debian 1 12-27-2010 05:52 AM
xine "Audio output unavailable. Device is busy." shellshock Linux - Software 3 05-13-2006 01:19 PM
samba - smbmount freezing my terminals -> "Device is busy" Yntarius Linux - Networking 4 05-21-2004 08:19 AM
nvidia insmod: "Device or resource busy" w/GeForce 4 MX KeithSpook Linux - Hardware 4 03-03-2004 01:21 PM


All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration