Fixing your HAL application for Ubuntu 10.04

Ubuntu Lucid Lynx sports full removal of HAL from the boot process, making Ubuntu faster to boot and faster to resume from suspend.

From a developer stance, all what has changed is that Ubuntu has switched over to D-BUS activation. So if a program tries to talk to HAL, but HAL is not running, it triggers it’s startup.

If this isn’t the case when you try to start your application, then the most likely reason is that it is too cautious and checks if HAL is running before trying to connect to it. This is true in the case of lshal, where you probably wouldn’t want HAL starting if it wasn’t already running.

Such an example of this check would be as seen below (taken from pcmanfm).

/* try to initialize the HAL context */
if (!libhal_ctx_init (hal_context, &error)
    goto failed;

What we do differently is simply dropping the check, letting the application connect to hal straight away, checking of course if that failed instead before returning true.

/* try to initialize the HAL context */
libhal_ctx_init (hal_context, &error);

Happy debugging!

Regards

D-BUS Errors

Since I had a difficult time figuring it out – I just thought I might post a “be all, end all” answer here.

There is a certain elusive DBus error that seems to occur in multiple applications, from Jockey to Bzr, to Ubuntu-One client.

The bottom of the traceback will look like this:

File "/var/lib/python-support/python2.5/dbus/bus.py", line 244, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/var/lib/python-support/python2.5/dbus/proxies.py", line 241, in __init__
self._named_service = conn.activate_name_owner(bus_name)
File "/var/lib/python-support/python2.5/dbus/bus.py", line 183, in activate_name_owner
self.start_service_by_name(bus_name)
File "/var/lib/python-support/python2.5/dbus/bus.py", line 281, in start_service_by_name
'su', (bus_name, flags)))
File "/var/lib/python-support/python2.5/dbus/connection.py", line 607, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

To put this into english – this essentially means that your system’s configuration for that particular piece of software has made it corrupt. The simple fix is simply removing the system configuration – or purging and reinstalling the application if you use a package manager.

ie:

sudo apt-get purge jockey-gtk jockey-common
sudo apt-get install jockey-gtk jockey-common

And I am 90% certain that doing this will retify your problem in most cases.

Follow

Get every new post delivered to your Inbox.