[Samba] "Device or Resource Busy" when deleting folders

Louis Sabet louis at mobiles.co.uk
Thu Apr 10 13:39:36 GMT 2003


Hi all,

I have set up an LTSP environment (www.ltsp.org) for a small group of users 
who have migrated from WinXP. As part of the setup, and during the 
transition, I have created a number of folders in each user's home 
directory which are mapped via SMBMOUNT to the NT domain controller's home 
directories, and various shared data folders.

When each user logs into X, a script is run which defines various options, 
and also mounts their SMB folders:

sudo mount -t smbfs -o 
quiet,fmask=0777,dmask=0777,credentials=$HOME/.credentials //homer/shared 
$HOME/Shared_Data
sudo mount -t smbfs -o 
quiet,fmask=0777,dmask=0777,credentials=$HOME/.credentials //homer/$USER 
$HOME/.ntprofile
sudo mount -t smbfs -o 
quiet,fmask=0777,dmask=0777,credentials=$HOME/.credentials 
//homer/$USER\prefs $HOME/.userprefs

Chances are, that the above lines are completely wrong, but it appears to 
work, at least mostly.

I'm using RedHat7.2, and from what I understand in this distro at least, 
normal users are not allowed to mount SMB shares, so each user has the 
mount commands listed in /etc/sudoers (I know it's dirty, but I had to get 
this running quick, and ran out of options).

Now, all of this works nicely as long as my primary interface is an xterm 
window. I can create, delete, move, rename etc without any problems. 
Obviously all the files are owned by "root", but since the permissions are 
set to 0777, permissions errors are nonexistant.

The real problem is when using GUI-based file managers. Again, MOST 
functions work - I can create files, directories etc, even delete files 
quite happily, but renaming files can cause problems (since some file 
managers attempt to re-set permissions), and deleting folders is an 
impossibility.

(SOME file managers WILL delete folders quite happily - for example 
ROX-Filer works nicely, but generally the ones that work are the simpler 
ones. The more complex file managers such as konqueror cause problems, as 
does OpenOffice (when in an open file dialog, and right-click-deleting))

I tried fixing the permissions errors with the "quiet" flag on the smbmount 
syntax. This may or may not have worked - haven't had a chance to find out 
yet, but isn't a major problem anyway.

As for the folder deletion error, using rmdir in a shell will work 
flawlessly. Using rm -Rf to delete a folder and its contents also works 
fine, but within the GUI, it fails with various generic non-specific 
errors. If I THEN try and delete the same folder in a shell, I get the 
following message:

"Device or Resource Busy"

IF the folder had files inside it, these files will have been deleted, but 
the folder itself will remain, and will refuse to delete for the duration 
of the session.

Once the folders are unmounted, and remounted, issuing rmdir foldername or 
rm -Rf foldername works fine.

Has anyone come across this behaviour before, and is there a solution?

Also if anyone has a better solution for mounting user filesystems, please 
do let me know as I have a little more development time on my hands now. 
Eventually I'll be moving the user-data over to an NFS share or even on a 
local disk, but this isn't an option at present.

Best Regards, and many thanks in advance,

Louis

--
Louis Sabet - IT Manager
http://www.mobiles.co.uk
http://www.gadgets.co.uk


More information about the samba mailing list