Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've found that HAL seems to be the only way to generate events when a CD/DVD/Blu-ray is inserted (if you know of a better way, please reply to this question), so I'm trying to get HAL running on my headless 10.04 server. It seems to work okay when I run it manually with sudo hald --daemon=yes --use-syslog.

The problem is that hald does not automatically run on startup (I assume because it's deprecated), and there's no sign of it in /etc/init.d. What's the proper way to get HAL running at startup in Lucid and beyond? And do I have to worry about other things getting screwed up by having this deprecated software around?

share|improve this question
up vote 2 down vote accepted

HAL is deprecated for a laundry list of reasons; UDev is replacing it. Fortunately nothing should break because it was all routed through DBus anyway. There is no need to revive the dead.

To detect CD removal and insertion, listen for DeviceAdded and DeviceRemoved on the org.freedesktop.UDisks.Device bus. The example code in this question should be helpful.

share|improve this answer
Hmm. I tried that example code, and got an 'unknown service' exception when I try to get_object(), as here. Per that link, I tried replacing 'SystemBus' with 'SessionBus' (X11 initialization error-- headless server!) and also 'SystemSession' (does not exist). – trbabb Nov 8 '11 at 9:21
Update: The example code at the other end of your link should read iface = dbus.Interface(proxy, "org.freedesktop.UDisks") (instead of ...UDisks.Device). Also, I found that udisks wasn't even installed on my system, so that was part of the problem :). All seems to be working now. Thanks! – trbabb Nov 13 '11 at 0:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.