Error when mounting sparse bundle from terminal I picked up this command on how to open a disk image and have the password prompt in the terminal window (useful for remote mounting):hdiutil attach -stdinpass /path/to/image
source

However, it's not working with this particular volume. I get this error:

bash-3.2$ hdiutil attach -stdinpass ~/Desktop/Summer\ Docs.sparsebundle
Enter disk image passphrase:
hdiutil: attach failed - Device not configured


Here are the permission for the sparsebundle trying to be opened:

drwxr-xr-x@  6 non-admin  staff   204 May 31 16:06 Summer Docs.sparsebundle

What is wrong with the sparsebundle image that I can't mount it this way?
There's probably nothing wrong with the sparsebundle image. The error message tells you that something is wrong with the context/environment that you're the command in.

From the man page for hdiutil:

"Device not configured.  This error is returned explicitly by DiskImages when its kernel driver or framework helper cannot be contacted.  It also often shows up when a device has been removed while I/O is still active.  One common case of the helper  not being found is when Foundation's Distributed Objects RPC mechanism cannot be configured.  D.O. doesn't work under dead Mach bootstrap contexts such as can exist  in a reattached screen(1) session.  Root users can take advantage of  StartupItemContext(8) (in /usr/libexec) to access the startup item Mach bootstrap  context."

You'll need to ensure that you run the command from a session where the necessary support systems are available.

For example if you run the command inside a reattached screen session, this problem can occur (the word screen here is the name of a specific program).

So start by trying the command as an ordinary, logged in user on the physical machine using the GUI Terminal.app. Make sure you have administrative privileges (sudo) and get the command working.

Then afterwards you can try running it via ssh, via a launchd or whatever it is you're trying to accomplish.