Template:Article summary start Template:Article summary text Template:Article summary end HAL (Hardware Abstraction Layer) is a daemon that allows desktop applications to readily access hardware information, to locate and use such hardware regardless of bus or device type. In this way a desktop GUI can present all resources to its user in a seamless and uniform manner.
HAL functions largely overlap with udev and kernelspace functionality. Therefore, HAL is rapidly becoming obsolete in favor of udev. Currently, a small number of programs still rely on and use HAL, though development is heading toward utilizing udev as a replacement in the near future.
- 1 Overview
- 2 Install and configure HAL
- 3 Troubleshooting
- 3.1 Mounting fails for normal users
- 3.2 Auto-mounting fails
- 3.3 Removing USB flash causes improper unmount
- 3.4 NTFS issues
- 4 External links
There are a number of factors involved in 'hotplugging' and HAL is only one of them. When a new device is added, e.g. a USB drive is plugged in, the following occurs (roughly):
- The kernel becomes aware of a new device and registers it in Template:Filename.
- Udev creates a device node (e.g. Template:Filename), and loads the drivers/modules needed.
- The HAL daemon is notified by D-Bus and adds the device and what it can find out about it to its database.
- The addition of the new device is broadcast by HAL over D-Bus to whatever programs are subscribing, e.g. Thunar, which shows it as an icon in the shortcuts side panel, or Metacity/Nautilus which will add an icon to the desktop.
- Another program listening may be a volume manager, such as thunar-volman or AutoFS, configured to automatically create mount points and mount certain types of drives, start Rhythmbox whenever an iPod is connected, etc.
HAL does not detect the hardware (kernel), manage the devices or the drivers (udev) or automount drives (volume managers). As a hardware abstraction layer, its role is more akin to a communications center, providing your applications with a clean interface to the devices. Problems with hot-plugged devices not being properly detected, usable, or mounted should be investigated, knowing that it is a long chain and there are more components involved (see 'Troubleshooting').
About volumes mount points
HAL mounts your volumes under Template:Filename. To determine what some_folder should be it uses the label of a volume or, if the volume does not have a label, it uses the volume's type (eventually followed by a number if the directory already exists), for example: Template:Filename, Template:Filename ...
To give a label to a partition you can use GParted or its KDE equivalent PartitionManager (both available in extra).
Also keep in mind these three common problems that stop HAL from mounting a device:
- the directory Template:Filename must not exist, it will be dynamically created and destroyed by HAL
- the device must not be listed in fstab, otherwise HAL will ignore it, and subsequently, udev will not mount it
- you must have the right to mount the device, see Permission Denied for more details
If for some reason you cannot give a label to your partition you can give a fake label to HAL, you will need two things to do so:
- $device_uuid, the uuid of the device (Template:Codeline may help you for that)
- $device_name, the fake label you chose
Install and configure HAL
Step 1: Install
The HAL daemon requires the D-Bus daemon to be running. Ensure both are installed:
# pacman -S hal dbus
The Template:Filename DAEMONS array must be configured to start HAL (and dbus) at boot. There are generally 2 methods for configuring this.
Method 1: Manually adding both
Add both dbus and hal to the array, with dbus preceding hal:
DAEMONS=(syslog-ng dbus hal network netfs ...)
This method directs dbus to be loaded before hal.
Method 2: Adding HAL only
By default, HAL will automatically load dbus if it is not already running. Using this method, add hal only:
DAEMONS=(syslog-ng hal network netfs ...)
HAL can be manually started by issuing the following command as root:
# /etc/rc.d/hal start
For D-Bus and HAL to be of any practical use, local user accounts should be members of the groups optical and storage. To achieve this, use
/usr/bin/gpasswd as root:
# gpasswd -a username optical # gpasswd -a username storage Replace username with your actual username (e.g. johndoe).
For the group changes to take effect, the non-root account must logout and login.
Step 2: Configure
Your programs communicate with HAL controlled devices through a D-Bus interface. A number of interfaces are defined, each associated with a number of methods: The storage device interface, for example, has the methods 'eject' and 'close tray' (for optical drives). In order to 'mount' a partition on a USB key, you need access to the relevant D-Bus interface ('volume' in this case).
The configuration file Template:Filename specifies HAL-specific privileges, i.e. which users have access to which interfaces. These are defined as exceptions to the overall restrictions imposed on using D-Bus interfaces, specified in Template:Filename. In short, you will need to see that Template:Filename grants your user the right to access specific DBUS/HAL interfaces, because the D-Bus default is not to let you access them.
The default Template:Filename will contain a number of policies denying and allowing access, amongst them this default (the later of two defaults and therefore seemingly the deciding one): Template:File
In short, users are by default denied access to interfaces like Volume which has methods such as mount and unmount. This is overruled by policies allowing users of the groups 'power' and 'storage' to access their respective devices: Template:File
That is why you will want to add your user to those groups, thus reducing the number of customized configuration files.
Device specific policies
NTFS write access
Upon installing NTFS-3G, a HAL policy file will be created at Template:Filename. This will use Template:Package Official for all NTFS volumes. Simply restart HAL, and NTFS volumes should be writeable.
Enable the noatime mount option for removable devices
This will speed up file operations and also reduce wear on flash memory devices like USB sticks or SD cards. Template:File
Disable Automount on login
You may want to disable automounting of ntfs(/or other filesystem) partitions on login.
Step 3: Start or re-start HAL
For your changes to take effect you need to (re)start HAL:
# /etc/rc.d/hal restart
Mounting fails for normal users
If you receive a Permission denied, "Unable to mount location", "Not authorized", or IsCallerPrivileged failed message when you try to mount a drive in Gnome, KDE or any other destop environment, you need to start your destop enviornment with ck-launch-session by changing your Template:Filename. Look for the line that starts your DE. For eg
# exec gnome-session
and replace it with
# exec ck-launch-session gnome-session
If you just upgraded to hal-0.5.11-7 and suddenly mounting a device stopped working for non-root users with one of these errors:
- "PermissionDeniedByPolicy mount-removable no"
- "PermissionDeniedByPolicy mount-removable-extra-options no"
- "org.freedesktop.hal.storage.mount-removable no <-- (action, result)"
- "org.freedesktop.hal.storage.mount-removable-extra-options no <-- (action, result)"
you can fix the situation by editing Template:Filename and paste the following into the <config> section: Template:File Restart dbus and hal. If you used KDE you will have to restart KDE as well (the device notifier will not get it otherwise and will stop responding altogether). This was taken from Gullible Jones' "So long, Arch" thread as a hotfix for exactly this type of breakage and is probably not the best fix (especially for machines with a large number of users), but it works.
- Allowing everything (not recommended because of security constraints):
<match user="yourusername"> <return result="yes"/> </match>
- If you start your window manager from .xinitrc, see suggestion 2 entries up under HAL:IsCallerPrivileged failed
- You could also:
Template:File Where USER is your username
This gives the user specified admin authority which is the same hal authority level used by the hal and root users: Template:File
Inserted CD/DVD does not get recognized by HAL
If inserted CDs/DVDs are not recognized by HAL (no icon on the desktop or notification), check Template:Filename and remove the lines for the optical drives.
If that does not work, it may be because your device is not "checked" for automount by HAL. I am not sure why but you may have a file under Template:Filename which should have a content similar to: Template:File Remove this file to resolve the issue.
USB sticks and drives do not automount correctly
This sub-section is sourced from this forum page.
If you are experiencing problems with automounting USB sticks and/or drives, but do not have problems with mounting CDs or DVDs, and if you are able to manually mount the USB device in question, then you should create the file "preferences.fdi" in the folder Template:Filename and paste the following line into the file Template:File
Also you should remove from Template:Filename lines, corresponding to usb devices which should be mounted by hal automatically.
If this does not work, try adding
<match action="org.freedesktop.halstorage.mount-removable"> <return result="yes"> </match>
to the config section of /etc/PolicyKit/PolicyKit.conf (from http://bugs.archlinux.org/task/12221 ).
If this still doesn't work, follow the guidelines in .
If you get an error similar to: A security policy in place prevents this sender from sending this message to this recipient, see message bus configuration file (rejected message had interface "org.freedesktop.Hal.Device.Volume" member "Mount" error name "(unset)" destination "org.freedesktop.Hal")
Try adding: Template:File
Also, make sure that your user is in the Storage group. If not, add it with sudo gpasswd -a your_user storage
Alternative Fixes to Automount Problems
This subsection was sourced from this forum page and corresponds to the error message displayed starting with "Rejected Message Send ...". Users have seen this message while using Thunar, PCManFM, and Konqueror.
A default Template:Filename file allows device manipulation to all users, only from the console. Edit the Template:Filename file by finding this section: Template:File And change the value from true to false. Then restart dbus first, then restart hal (or you can just reboot your machine).
# /etc/rc.d/dbus restart # /etc/rc.d/hal restart
You should be able to insert your CD/DVDs and USB devices and access them through your file manager of choice. In Thunar and PCManFM once the device is inserted and detected, clicking on the icon will automatically mount it. Once mounted, you can right click to umount or eject the media.
Fixes for XFCE user
Firstly, please make sure that you have already been added to the user group "storage" and "power". Add the following lines to the file Template:File In case you encounter problems with the "action button" to hibernate/shutdown/suspend/logoff, you can add the following lines: Template:File
Removing USB flash causes improper unmount
If you remove your USB flash without previously unmounting it, automatic unmount by HAL may work improperly.
You may find that corresponding records from Template:Filename is not deleted, and in nautilus device list (and also on GNOME desktop) remains link to an empty folder, where the device was previously mounted.
This may be corrected by unmounting flash drive with "lazy" parameter. To do so, you should do some tweaking:
# /etc/rc.d/hal restart
The last resort
If the above policy does not work (make sure you restarted hal) you can force HAL (and all your other programs) to use the ntfs-3g driver instead of the standard ntfs driver. As root create a symbolic link from mount.ntfs to mount.ntfs-3g:
# ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs
Possible issues using this method:
- if mount is called with the "-i" option it does not work
- possible issues with the kernel ntfs module
You may have problem with filenames containing non-latin characters. This happens because your mounthelper is not parsing the policies and locale option correctly. There is a workaround for this:
- Remove this symlink: Template:Codeline
- Replace it with a new bash script containing:
- Make it executable: Template:Codeline
- Add a line to the pacman configuration file:
- A presentation of device handling