Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Prevent CD and DVD disks from becoming stuck' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Prevent CD and DVD disks from becoming stuck
Authored by: BjarneDM on Jan 09, '06 06:32:46AM

OK - this has hint has really saved from a major PITA :-)

I've got one of the original iMac (Flat Panel) "Tessera, P80" at 800MHz from 2002. Last year, the DVD drive went titsup and had to be replaced. I got the following:

[22:28:16@Volumes]$ drutil info
 Vendor   Product           Rev 
 PIONEER  DVD-RW  DVR-106D  1.08

   Interconnect: ATAPI
   SupportLevel: Apple Shipping
          Cache: 2000k
       CD-Write: -R, -RW, BUFE, CDText, Test, IndexPts, ISRC
      DVD-Write: -R, -RW, +R, +RW, BUFE, Test
     Strategies: CD-TAO, CD-SAO, CD-Raw, DVD-DAO

and so far when it went to sleep with a CD or DVD in the drive, I was unable to eject the tray short of rebooting the whole computer and holding down the eject button at startup.

This hint works perfectly in resolving this issue.

I have, however, the following comments:

Normally, when the tray has been ejected, it's automagically pulled retracted again after the infamous 10 minutes. When this hint is implemented, this is no longer the case: once ejected it stays ejected, and has to be manually closed again.

As to launchd and where it's loading stuff from, man launchctl provides the following information:

FILES
     ~/Library/LaunchAgents         Per-user agents provided by the user.
     /Library/LaunchAgents          Per-user agents provided by the administrator.
     /Library/LaunchDaemons         System wide daemons provided by the administrator.
     /System/Library/LaunchAgents   Mac OS X Per-user agents.
     /System/Library/LaunchDaemons  Mac OS X System wide daemons.

We'll keep our dirty hands way off the last two. But the first three are interesting. Provided where you place the file, launchd treats it a somewhat differently:

~/Library/LaunchAgents
If you store the plist here, the plist is only active when the user whose home directory it's in is logged in. It seems to be completely inactive otherwise, so if another user logs in (s)he can still have the problem.

/Library/LaunchAgents
The plist is loaded for every user that logs in. If more than one user is logged in, an instance is running for each and every user. And furthermore, it's not unloaded when the user logs out, so depending on how many accounts you have, you can have a lot of instances running. And it's also one hell of a job getting rid of it again. It's not enough to stop and unload it using the sysadmin/root launchctl; that seems to have no effect at all on running account specific launchd daemons. And, for users that are already logged in, the plist isn't started. To get rid of the phantom user launchd processes I had to kill the user launchd process itself.
Take a look at the following:

[00:34:16@LaunchDaemons]$ ps -aux | grep drutil
tina    13490  13.0  0.4    30968   4092  ??  Ss   12:30AM   0:33.76 /usr/bin/drutil list
maria   13503  12.6  0.4    30968   4096  ??  Ss   12:34AM   0:04.22 /usr/bin/drutil list
bjarne  13505   0.0  0.0    27904    356  p3  U+   12:35AM   0:00.00 grep drutil
[00:35:05@LaunchDaemons]$ ps -aux -U tina
USER   PID %CPU %MEM      VSZ    RSS  TT  STAT STARTED      TIME COMMAND
tina 13490  13.2  0.4    30968   4092  ??  Ss   12:30AM   0:40.84 /usr/bin/drutil list
tina  3413   0.0  0.2    27956   2272  ??  S    Wed12PM   0:04.09 aped
tina  9278   0.0  0.0    27316    504  ??  S    Sat05PM   0:01.30 /sbin/launchd
[00:35:57@LaunchDaemons]$ sudo kill 9278 3413 13490
kill: 13490: No such process
[00:36:36@LaunchDaemons]$ ps -aux | grep drutil
maria   13503  25.0  0.4    30968   4092  ??  Ss   12:34AM   0:19.08 /usr/bin/drutil list
bjarne  13509   0.0  0.0    18060    304  p3  R+   12:36AM   0:00.01 grep drutil
[00:36:48@LaunchDaemons]$ sudo kill 13503
[00:37:21@LaunchDaemons]$ ps -aux | grep drutil
maria   13514  24.6  0.4    30968   4096  ??  Ss   12:37AM   0:01.40 /usr/bin/drutil list
bjarne  13516   0.0  0.0    18060    324  p3  R+   12:37AM   0:00.01 grep drutil
[00:37:38@LaunchDaemons]$ sudo kill 11340
[00:38:08@LaunchDaemons]$ ps -aux | grep drutil
bjarne  13519   0.0  0.0    18060    324  p3  R+   12:38AM   0:00.01 grep drutil

Of these users, only bjarne and maria had active sessions, while tina had been logged out. The plist had been created and loaded into launchd with only bjarne logged in. As you can see, bjarne doesn't get the process while both tina and maria get it. And furthermore, even though tina has subsequently logged out, she's still got the process running. You can also see that even after having unloaded the plist, the maria launchd still re-starts the process.

/Library/LaunchDaemons
This is in my opinion the best place to place a plist like this one. It's only run by the system and is independent on whether and how many users have logged in.

As to the load/unload issue with active/inactive account there might be a plist parameter that fixes this, but I don't know enough about launchd to be able to provide a solution.



[ Reply to This | # ]