%general-entities; ]> $Date$ HAL-&hal-version; HAL 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 Download (HTTP): Download (FTP): Download MD5 sum: &hal-md5sum; Download size: &hal-size; Estimated disk space required: &hal-buildsize; Estimated build time: &hal-time; Additional Package Download Required Hardware Data Download (HTTP): Download (FTP): Download MD5 sum: &hal-info-md5sum; Download size: &hal-info-size; HAL Dependencies Required Recommended (with a current pci.ids file) and (with a current usb.ids file) Optional (to Create Documentation) Optional , , , PolicyKit, , , , and libsmbios User Notes: 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 -fg 19 haldaemon && useradd -c "HAL Daemon User" -d /dev/null -u 19 \ -g haldaemon -s /bin/false haldaemon || [ $? == 9 ] Install HAL by running the following commands: ./configure --prefix=/usr \ --sysconfdir=/etc \ --libexecdir=/usr/lib/hal \ --localstatedir=/var \ --docdir=/usr/share/doc/hal-&hal-version; \ --enable-policy-kit=no && make To test the results, issue: make check. Now, as the root user: make install Install the HAL hardware data with the following commands: tar -xf ../hal-info-&hal-info-version;.tar.bz2 && cd hal-info-&hal-info-version; && ./configure --prefix=/usr --sysconfdir=/etc Now, as the root user: make install 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. --enable-policy-kit=no: This parameter is required if PolicyKit is not installed. Remove it if PolicyKit is installed. --enable-docbook-docs --docdir=/usr/share/doc/hal-&hal-version;: If is available, these parameters enable the HAL specification documentation to be built. Run-Time Dependencies A few more packages enable more functionality in HAL at run-time. These include , dmidecode, (device-mapper), Cryptsetup-LUKS, and pm-utils. Configuring HAL Config Files /etc/dbus-1/system.d/hal.conf, /etc/dbus-1/system.d/halusers.conf and /etc/hal/* /etc/dbus-1/system.d/hal.conf /etc/dbus-1/system.d/halusers.conf /etc/hal/* Configuration Information Allowing users to invoke HAL methods 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 and pam_console, create a group that is allowed to invoke HAL methods with the following commands: groupadd -fg 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. usermod -a -G halusers <username> 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 Installing mount helpers 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 Ivman should be installed. Changing default mount options In some cases, it is necessary to specify some default mount options for filesystems. E.g., in non-English environments, the and options are needed for filesystems of Windows origin in order to show national characters correctly. Also, due to a bug in the Linux kernel version in LFS (2.6.22.x), you may want to pass the option to vfat filesystems in order to reduce the time needed to determine the amount of free space on the filesystem. Google search results for hal default mount options are still full of recommendations to create *.fdi files mentioning either or keys. Such recommendations worked for HAL-0.4.x only and are invalid now. For HAL-&hal-version;, mount options are expected to be handled as follows: An event handler from the desktop environment receives an event describing the newly-added storage device. If the storage device is not already mentioned in /etc/fstab, mount options are fetched from a database of user preferences, which is specific to the desktop environment, and passed back to HAL. This process can be influenced by the filesystem type and possibly other volume properties available from HAL. If the options are in the list of permitted ones, HAL mounts the volume. The important point above is that the configuration procedure is desktop-specific. However, as of December, 2007, only GNOME allows the user to set default mount options on a per-filesystem basis, as described in the next paragraph. KDE allows the mount options to be set only on a per-volume basis, not per-filesystem, which is a bug, because, as mentioned in the report, for every new device (let's say your friend's USB stick) you have to first not mount it, then change options and then mount. Xfce, if compiled with HAL support, hard-codes the mount options without any means to override them, which is even worse. In KDE and Xfce, if the built-in default mount options are not suitable, it is needed to mention every possible removable storage device in /etc/fstab with the correct options, thus mostly defeating the point of installing HAL. In order to adjust the default mount options, GNOME users should change the /system/storage/default_options/[fs_type]/mount_options GConf key from the command line, as demonstrated in the following example: gconftool-2 --type list --list-type=string \ --set /system/storage/default_options/vfat/mount_options \ "[shortname=mixed,uid=,usefree,iocharset=koi8-r,codepage=866]" See more details in the gnome-mount(1) manual page. Adding allowed mount options The list of mount options permitted in the default HAL configuration resides in the /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi file. GNOME and KDE users may want to use options not in this list (in the above example, this applies to the option). In this case, as root user, create a custom policy file that mentions unknown mount options: cat > /etc/hal/fdi/policy/user-options.fdi << "EOF" <?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- --> <!-- This file is used to set custom options to the HAL policy settings. The default policy settings are defined in files contained in the /usr/share/hal/fdi/policy subdirectories. User defined customizations should be in files contained in the /etc/hal/fdi/policy directory. --> <deviceinfo version="0.2"> <device> <!-- this is to be able to mount media in drives we cannot poll, e.g. IDE Zip Drives and PC style floppy drives --> <match key="storage.media_check_enabled" bool="false"> <match key="storage.no_partitions_hint" bool="true"> <append key="volume.mount.valid_options" type="strlist">usefree</append> <!-- Insert other options here --> </match> </match> <match key="volume.fsusage" string="filesystem"> <!-- allow these mount options for vfat --> <match key="volume.fstype" string="vfat"> <append key="volume.mount.valid_options" type="strlist">usefree</append> <!-- Insert other options here --> </match> </match> </device> </deviceinfo> EOF Boot Script To automatically start the hald daemon when the system is rebooted, install the /etc/rc.d/init.d/haldaemon bootscript from the package. haldaemon 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 Installed Libraries Installed Directories hal-device, hal-disable-polling, hal-find-by-capability, hal-find-by-property, hal-get-property, hal-is-caller-locked-out, hal-lock, hal-set-property, hald and lshal libhal.{so,a} and libhal-storage,{so,a} /etc/hal, /usr/include/hal, /usr/lib/hal, /usr/share/doc/hal-&hal-version;, /usr/share/hal, /var/cache/hald, /var/lib/hal, and /var/run/hald Short Descriptions hal-device is used to create, remove or show a HAL device. hal-device hal-disable-polling can be used to to disable and enable media detection on drives with removable storage. hal-disable-polling hal-find-by-capability prints the Unique Device Identifiers for HAL device objects of a given capability. hal-find-by-capability hal-find-by-property prints the Unique Device Identifiers for HAL device objects where a given property assumes a given value. hal-find-by-property hal-get-property retrieves a property from a device. hal-get-property 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. hal-set-property hal-is-caller-locked-out determines if a specific caller is locked out of a specific D-Bus interface on a specific device. hal-is-caller-locked-out hald is the HAL daemon program. hald lshal shows all devices and their properties. If the --monitor option is given then the device list and all devices are monitored for changes. lshal libhal.{so,a} contains the API functions required by the HAL programs. libhal.{so,a} libhal-storage.{so,a} contains the API functions required by the HAL storage and volume utility programs. libhal-storage.{so,a}