HAL-0.5.7.1

Introduction to HAL

HAL is a hardware abstraction layer, which is a piece of software that provides a view of the various hardware attached to a system. In addition to this, HAL keeps detailed metadata for each piece of hardware and provides hooks such that system and desktop-level software can react to changes in the hardware configuration in order to maintain system policy.

The most important goal of HAL is to provide plug-and-play facilities for UNIX-like desktops with focus on providing a rich and extensible description of device characteristics and features. One example of the functionality provided by HAL is when you plug in a USB storage device. HAL can automatically create a mount point in /media and mount the device.

Package Information

HAL Dependencies

Required

GLib-2.10.3, D-BUS-0.62 (see the HAL Requirements), Python-2.4.4, and XML::Parser-2.34

Recommended

Optional

pkg-config-0.20, intltool-0.34.2, libusb-0.1.12, Doxygen-1.4.6, and DocBook-utils-0.6.14

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/hal

Installation of HAL

You must create a dedicated user and group before installing the package. Though the default BLFS instructions run the HAL daemon as the root user, a configuration file is installed which has the dedicated user's name hard-coded in it. This causes a confusing message to be generated when starting the D-BUS daemon. Issue the following commands as the root user:

groupadd -g 19 haldaemon &&
useradd -c "HAL Daemon User" -d /dev/null -u 19 \
        -g haldaemon -s /bin/false haldaemon

Install HAL by running the following commands:

./configure --prefix=/usr \
            --sysconfdir=/etc \
            --libexecdir=/usr/lib/hal \
            --localstatedir=/var &&
make

To test the results, issue make check.

Now, as the root user:

make install &&
install -v -m755 -d /var/run/hald

Command Explanations

--libexecdir=/usr/lib/hal: This parameter forces the installation of libexec files to /usr/lib/hal instead of /usr/libexec.

--localstatedir=/var: This parameter forces the creation of the pid file to /var/run/hald instead of /usr/var/run/hald.

Run-Time Dependencies

The hal-device-manager program requires several additional packages to be installed before it will run. The list is significant and requires a substantial commitment to install them. It is left up to you to determine if the time and effort spent installing the following packages is worth using the hal-device-manager program.

Though the only requirement to run the hal-device-manager program is installing GNOME-Python, the dependency list is staggering. The following list does not include the dependencies already identified in the BLFS book. For example, libgnome already lists GNOME VFS, GConf, etc., so they are not repeated here. Note that some of the dependencies have their own dependencies, which have their own, and so forth and so on.

[Note]

Note

The dependency list is designed to start at the bottom and work your way up until the last package to install is GNOME-Python. Note that the dependencies marked as “required” are required for the package it is listed under. For example, you don't need to install ORBit if you don't plan on installing PyORBit. The minimum packages you could install to support running hal-device-manager would be (in this order): libgnome-2.14.1, libglade-2.6.0, PyGTK and GNOME-Python.

Configuring HAL

Config Files

/etc/dbus-1/system.d/hal.conf, /etc/dbus-1/system.d/halusers.conf and /etc/hal/*

Configuration Information

The default setup for HAL is to allow only certain users to invoke methods such as Mount(). These are the root user and the user determined to be at the active console using pam_console. If you are not set up to use Linux-PAM-0.99.4.0 and pam_console, create a group that is allowed to invoke HAL methods with the following commands:

groupadd -g 61 halusers &&
cat > /etc/dbus-1/system.d/halusers.conf << "EOF"
<!DOCTYPE busconfig PUBLIC
 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <!-- Allow users in the halusers group invoke HAL methods -->
  <policy group="halusers">
    <allow send_interface="org.freedesktop.Hal.Device.SystemPowerManagement"/>
    <allow send_interface="org.freedesktop.Hal.Device.LaptopPanel"/>
    <allow send_interface="org.freedesktop.Hal.Device.Volume"/>
    <allow send_interface="org.freedesktop.Hal.Device.Volume.Crypto"/>
  </policy>

</busconfig>
EOF

Now add the users you would like to the halusers group to use HAL. Note that these users still need to have appropriate permissions to access the devices that HAL will invoke its methods on.

With the above configuration in place, authorized users now have the ability to unmount disk partitions mounted at non-standard locations such as /pub. If you'd like to restrict this policy to only drives which are considered removable or hotpluggable, add the following configuration file as the root user:

cat > /etc/hal/fdi/policy/no-fixed-drives.fdi << "EOF"
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<!-- Don't allow HAL methods on disks that are not
     removable or hotpluggable -->

<deviceinfo version="0.2">
<device>
  <match key="@block.storage_device:storage.hotpluggable" bool="false">
    <match key="@block.storage_device:storage.removable" bool="false">
      <merge key="volume.ignore" type="bool">true</merge>
    </match>
  </match>
</device>
</deviceinfo>
EOF

HAL only provides the methods such as Mount() to act on hardware. In order to take advantage of these, a HAL event handler such as gnome-volume-manager-1.5.15 or Ivman should be installed.

[Note]

Note

HAL will ignore any devices listed in /etc/fstab for the purpose of automounting. You must remove any listings for devices that you would like automounted such as CD-ROMs or USB keys.

Boot Script

To automatically start the hald daemon when the system is rebooted, install the /etc/rc.d/init.d/haldaemon bootscript from the blfs-bootscripts-20060910 package.

[Important]

Important

If the system-wide D-BUS daemon was running during the installation of HAL, ensure you stop and restart the D-BUS daemon before attempting to start the hald daemon.

make install-haldaemon

Contents

Installed Programs: hal-device, hal-device-manager, hal-find-by-capability, hal-find-by-property, hal-get-property, hal-set-property, hald and lshal
Installed Libraries: libhal.{so,a} and libhal-storage,{so,a}
Installed Directories: /etc/hal, /usr/include/hal, /usr/lib/hal, /usr/share/doc/hal-0.5.7.1, /usr/share/hal and /var/run/hald

Short Descriptions

hal-device

is used to create, remove or show a HAL device.

hal-device-manager

shows a graphical representation of all the devices HAL is aware of. This program requires GNOME-Python. Here is a screenshot of hal-device-manager communicating with the HAL daemon and displaying a tree of device objects. The shown properties in the screenshot are for a device object representing a hard disk.

hal-find-by-capability

prints the Unique Device Identifiers for HAL device objects of a given capability.

hal-find-by-property

prints the Unique Device Identifiers for HAL device objects where a given property assumes a given value.

hal-get-property

retrieves a property from a device.

hal-set-property

attempts to set property for a device. Note that, due to security considerations, it may not be possible to set a property.

hald

is the HAL daemon program.

lshal

shows all devices and their properties. If the --monitor option is given then the device list and all devices are monitored for changes.

libhal.{so,a}

contains the API functions required by the HAL programs.

libhal-storage.{so,a}

contains the API functions required by the HAL storage and volume utility programs.

Last updated on 2007-01-21 11:50:20 -0600