Saturday, January 29, 2011

That dreaded cygwin "Device or Resource busy"...

If you've ever attempted to do any serious work on a Windows box configured with cygwin and a sshd, you've probably already come across the dreaded error message as you attempt to remove a file or folder

"Device or Resource busy"

If, not you probably will - sooner or later. You can't rm the files or folders, your compile is stuck as it can't write objs to disk - or whatever else your file access scenario may be.

SysInternals Handle to the rescue!

Handle will merrily show you what process is holding a handle to the specified file or folder. Once the perpetrator is located, taskkill /PID n, makes for the easy solution.

Simple, yet extremely effective trick for the toolbox...

(In all fairness, the latest 1.7.7 cygwin is a lot better than the previous versions :))

3 comments:

  1. And if Process is "System"? pid = 4?

    How to unlock?

    ReplyDelete
  2. It's simple and tricky issue.

    How to Delete Resource
    Go to Task Manager -> Details (tab)

    Now, End Process of cmd.exe. That's the magic.

    If you come back and delete. It shall delete.

    This solution worked to me. Try and let us know if there any other solution.

    ReplyDelete