0

tl;dr version: I have a localdb.kdbx.tmp file on a local network drive that I can't rename/delete/copy/overwrite/open/etc. All attempts, sudo or otherwise, throw a "Device or resource busy" error. Running fuser and lsof shows nothing; as far as I can tell nothing is actively accessing the file and there is no associated PID or parent process. Remounting the drive with FUSE set to allow root and other users makes no difference. File permissions are normal and everything else in the directory (backups etc.) are behaving as expected.

details: I have a KeePass shared database that's hosted on a local network drive shared between several on-site computers. Some of the machines run Windows, some run Linux. I'm personally using 32-bit Ubuntu 14.04 with keepass2 2.34 installed.

When attempting to save some recent updates to the localdb.kdbx KP database yesterday (I was the only person accessing the file at the time), Keepass threw an error and said the database may be corrupted. I shut down my machine, assuming I could overwrite the file the next day. But when I came in and connected to the drive this morning, localdb.kdbx only existed as localdb.kdbx.tmp and no one can get it to open (KeePass specifically throws a "lock violation on path" error).

I'd troubleshoot the issue on KeePass's forums, but we only need to be able to use the filename, so I'd be happy with just deleting it so I can recreate it from a backup. Problem is, I get a "Device or resource busy" error whenever I try to do anything with the file. Using lsof and fuser on the .tmp file just returns a blank with no PID, so there's nothing to kill and no way to "free up" the file for deletion. I thought it might be a FUSE issue and tried the solutions at How to get sudo access to shares mounted by Gigolo and WARNING: can't stat() fuse.gvfsd-fuse file system with no luck.

Any tips?

6
  • 1
    It sounds like you've rebooted one of the clients. Which machine is the server? Have you checked if its in use there? In use preventing remove sounds like something Windows would do, not Unix.
    – derobert
    Aug 9, 2016 at 21:44
  • The network drive is an SMB Windows machine. Is there a way to check the processes running on it? I've got it mounted as a /media directory on my machine so I thought being in the relevant dir (the one with the database) when running lsof and fuser would be enough.
    – Boxbot
    Aug 9, 2016 at 22:05
  • Oh wait, doy, I have to SSH into the server and run tasklist.
    – Boxbot
    Aug 9, 2016 at 22:30
  • 1
    Other than asking Google about "check open files Windows", I don't know how to check on Windows... serverfault.com/questions/1966/… looks like it might be relevant. I suspect there is a non-sysadmin-focused answer somewhere on Super User as well. It's probably your file server (Windows) that is denying the delete.
    – derobert
    Aug 9, 2016 at 23:19
  • I don't have control over the server and it doesn't seem to have an SSH server; I used smbclient to get in but the rename and del commands throw a "NT_STATUS_SHARING_VIOLATION" error. UNIX CIFS extensions aren't supported either. Will have to wait and talk to the server admin tomorrow, I suppose.
    – Boxbot
    Aug 9, 2016 at 23:40

1 Answer 1

0

ETA: I was mistaken; the drive is not an SMB Windows machine, but a machine running a QNAP Linux 3.2.26 build (which avahi-discover was picking up as Windows).

Turned out the network drive was an SMB Windows machine (I'd mistakenly thought it was Linux) (see ETA) and the process locking the file was being run by Windows. I didn't take into account that lsof and fuser only return processes for the machine they're being run on (ie. my local machine, and not the network drive :).

The network drive didn't have ssh enabled and smbclient didn't enable me to override the lock, so I asked our network admin to reboot the drive. The process terminated and I was able to delete the file.

(For others' reference: I used avahi-discover to get the network drive's OS and other details.)

Props to @derobert for pointing me in the direction of the server processes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .