0

Have a bunch of DVD drives connected via USB. Have written some bash scripting to interact with these drives and eject the discs when done.

Running MacOS 10.10 (Yosemite)....yes I know, need to get around to upgrading.

Using diskutil eject /dev/diskX to eject the specific disc I am done interacting with before moving on to the next.

Discovered yesterday that while the screen is asleep the eject command fails. I disabled the password autolock last night thinking that was the issue...but this morning moving my mouse woke up the screen (no password required)...however the eject had been failing (retried every 10 seconds) all night....but the eject succeeded the next try after the screen came back on.

  • The computer was not asleep.
  • The computer was not locked (ie no password required)
  • Tested screensaver on/off...no effect
  • Tested toggling "put hard disks to sleep when possible" under power saving. No effect.
  • Tested disabling password required after X minutes...no effect.
  • This seems to be specific issue to the screen being put to sleep. Disabling screen sleep in power saving (screensaver and everything else can be on) resolves this.

Searching "eject fails while display sleep" hasn't led me to anything specific about why this behaviour exists let alone how to work around it. Weird right?

Would love to:

  1. understand if this is a feature and the logic behind it. Perhaps to avoid remote access people from accidentally ejecting a disk that requires them to go to the data center to push it back in?
  2. any ideas for a work around (ie ejecting from script that works when the display is asleep).

I have thought about disabling the display sleep hacks...don't need help on that front though as I already know various ways to do that. More interested in understanding and addressing the root cause (display sleeping causes eject to fail).

...
Eject /dev/disk10 failed.  Trying again in a few seconds.
Volume failed to eject
Eject /dev/disk10 failed.  Trying again in a few seconds.
Volume failed to eject
Eject /dev/disk10 failed.  Trying again in a few seconds.
Volume failed to eject
Eject /dev/disk10 failed.  Trying again in a few seconds.
Volume failed to eject
Eject /dev/disk10 failed.  Trying again in a few seconds.
Volume failed to eject
Eject /dev/disk10 failed.  Trying again in a few seconds.
Disk /dev/disk10 ejected      <--- eject succeeded this morning after display woken up.
Done.  Sleeping 60 seconds before looking for new discs.
  • ctrl/k will block code, but it makes its own mind up what colours to use. All other code formats leave white-space... Take your pick ;-) – Tetsujin Jun 8 '18 at 7:23
  • ctrl-k didn't work. was indented like code block but preview was showing the text smashed together as a paragraph. never had the problem before. some new issue or bug related to the specific content in my code block. – mattpr Jun 8 '18 at 10:20
  • Just as an example, I dropped a standard code block underneath - copy/paste + Ctrl/k – Tetsujin Jun 8 '18 at 10:24
  • Yeah, the issue seems fixed now. What you did is what I did when I originally posted and got <p> formatting instead of <pre><code> formatting. I tried a bunch of times (clearing formatting, copying out and pasting back in plain text, disabling browser cache). I just resorted to three back ticks because I couldn't get the usual code block to work. Anyway, perhaps just an issue on initial post or the issue was fixed. Appreciate you trying to help. – mattpr Jun 8 '18 at 10:31

You must log in to answer this question.

Browse other questions tagged .