VL-Hot: A Non-polling Alternative To HAL

By Caitlyn Martin
February 21, 2009 | Comments: 14

In most current Linux distributions if you plug in a piece of removable media, anything ranging from a USB memory stick to a removable hard drive to a memory card, an icon pops up on the desktop and/or a file manager window opens. The same thing happens if you insert a CD-ROM or DVD-ROM into a drive. This is accomplished by the HAL (Hardware Abstraction Layer) daemon which continually polls the hardware to determine if anything has been added or removed. Generally this works very well and makes the Linux desktop decidedly more user friendly than it was in the days before HAL.

As is usually the case this additional functionality and friendliness comes with a cost. Continuous querying to check for new or removed hardware consumes CPU cycles and energy. On older, legacy hardware or any system with limited processing power, including the lowest end of today's netbooks, using HAL can actually impact system performance in a noticeable way. On battery operated systems it also translates into somewhat shorter battery life. For those interested in green computing and reducing energy consumption the continuous polling activity by the HAL daemon when no hardware changes take place is simply wasteful.

VL-Hot, developed for Vector Linux, provides an alternative that doesn't require continuous hardware polling. Instead VL-Hot uses udev triggers to pop up the required icons. The Vector Linux developers have VL-Hot working with lightweight window managers like JWM and IceWM provided that the PCMan File Manager is installed. I'm quite surprised that other distributions which aim to be lightweight haven't incorporated VL-Hot.

Limitations in VL-Hot

The approach used by VL-Hot works well for most USB media, Firewire and PCMCIA cards. Unfortunately it doesn't work when no udev trigger (uevent) is issued. For example, there is no uevent when a CD-ROM or DVD-ROM is inserted in a drive so VL-Hot can't detect that action. Vector Linux provides alternative GUI methods to mount or unmount CD and DVD media depending on the desktop environment or window manager used. In Vector Linux 6.0 Standard the default Xfce desktop includes the mount applet in the panel. In Vector Linux 5.9 Light the default JWM window manager configuration has an icon on the desktop to mount a CD/DVD. Both of these require user action; a CD or DVD is not automounted as it would be with HAL.

Another limitation involves devices in place when a system is booted. If you have a device already inserted when a system boots VL-Hot won't detect it since there is no uevent after VL-Hot starts. The user has a choice of mounting manually or removing and reinserting the device. In the 1.x versions (used with Vector Linux 5.9.1 and prior) if a device is inserted when a system is shutdown and the desktop environment is configured to save the session state the icons for a device will still be in place at the next boot even if the device itself is no longer present. This has mostly been corrected in version 2.0.0 but I have noticed that if I have two USB sticks inserted when I shutdown the icon for the second one will still be present at next boot.

Using VL-Hot

vl-hot-icons.jpg
When you insert a device VL-Hot pops up two icons on the desktop. This differs from HAL which uses a single icon. VL-Hot automounts the partition(s) on the device or, if there is no partition table, mounts the device as a whole. The image on the right, taken from the top left of my desktop, shows the icons added after inserting a USB stick, specifically a Lexar JumpDrive. The first icon is used to access the mounted device or partition and the second is used to unmount it. (Click on the image to enlarge it.)

The default mount point is /mnt/vl-hot/vl-hot for the first partition or device and /mnt/vl-hot/vl-hotn for each subsequent mounted partition or device. The second mount would be /mnt/vl-hot/vl-hot1. The base path, /mnt/vl-hot, is configurable through a GUI tool called vl-hot-config or by editing /etc/udev/vl-hot.config. The graphical tool can also be used to change icons, sound, the file manager to be used when the first icon is clicked, and options to be used in the mount command. In addition you can assign a custom name to a device index either in the GUI or by editing /etc/udev/vl-hot-names.conf. Code pages and character sets for FAT and NTFS translations can also be set. Another configurable option is the default behavior: instead of just popping up an icon on the desktop you can have VL-Hot open a file manager window.

While this may sound complex the typical user can safely ignore configuration. Basic usage is insert, click, go. For a more sophisticated user VL-Hot can be configured to behave in whatever way is best for you.

For those considering adding VL-Hot to a distribution other than Vector Linux most of the functionality is accomplished through scripts and configuration files. The graphical configuration utility is written in Gambas so the Gambas runtime environment is a dependency for vl-hot-config.

VL-Hot is currently under very active development. New and improved versions appear regularly with announcements appearing the the Vector Linux forum and/or on the Berlios project page.

Conclusion

VL-Hot is an automounter which provides an alternative to the HAL daemon that provides some but not all of the functionality of HAL without continuously polling hardware. While the result isn't quite as complete as HAL for limited or legacy hardware or those concerned with power consumption it can provide a reasonably elegant solution which consumes relatively few resources.


You might also be interested in:

14 Comments

Thanks Caitlyn ,

I now understand a bit better how VL-hot works.

Dave

Insightful article.

How does vl-hot relate to the the proposed HAL successor that RH seems to develop? HardwareKit or something.. I don't remember.

@Kragil: I honestly don't know anything about the Red Hat project. I will look into it, though. Thanks for the tip.

AFAIK VL-Hot development is not related to any other distro or project.

@Caitlyn Martin

So why are you writing proffesionally about Linux stuff if you don't follow what happens in it's community properly? Not knowing it is a no excuse, journalist are for writing news.

I think Red Hat has a lot more importance than another niche Linux distro like Vectorlinux, I respect it as it can be useful in certain environments. Red Hat is the most important company in the development of the Linux ecosystem, including the kernel and the most important subsystems (they even collaborate in Xorg related projects).

I suggest you to concentrate on the topics you follow better, inform better about the Linux world or find some people able to inform you in those topics. Guys from Phoronix could become a good start, as some of them are even developers from Linux related projects :)

Regards.

I forgot to mention the HAL successor by Red Hat is named DeviceKit.

It will be included in Fedora 11.

http://en.wikipedia.org/wiki/DeviceKit
https://fedoraproject.org/wiki/Features/DeviceKit
http://blog.fubar.dk/?p=103
http://lists.freedesktop.org/archives/hal/2008-May/011560.html
http://hal.freedesktop.org/docs/DeviceKit/
http://hal.freedesktop.org/docs/DeviceKit-power/
http://hal.freedesktop.org/docs/DeviceKit-disks/


And yes, Red Hat guys lately has an obsession naming things with Kit at the end, (maybe because Apple's WebKit?): PolicyKit, ConsoleKit, DeviceKit...

I've developed with D-Bus and HAL. And I know for instance that a great deal of HAL's functionality is derived from udev. It doesn't poll the hardware (unless required to) and as far as I know is going to be replaced by DeviceKit anyway.

On the d-bus side of things hal is very nice. It not only allows important information about hardware, devices and related functional objects to be available. But also useful methods, which can be called.

Although some of the limitations of the fdi format and a few other things mean DeviceKit will take over once it's matured.

@Jose: What you don't know is that I have consulted for, as in worked professionally for, Red Hat. I keep up with much of what they do. They have scores of worthwhile projects. Most of my professional work is as a consultant doing systems administration and security work. Guess which distro most of my customers use. Yep, it's Red Hat Enterprise Linux. Guess what I'm certified in. Yep, Red Hat.

I do keep up with the community. Red Hat isn't the whole community. Nobody can keep up with every worthwhile project. I'm sorry I don't meet your level of perfection. I do thoroughly research the subjects I write about.

I certainly understand and appreciate the importance of Red Hat in the community. That doesn't mean smaller distros like Vector Linux can't or don't work on worthwhile projects. There is no doubt that VL-Hot is worthwhile. I also believe covering any and all distros, large and small, that make significant contributions to Linux is valuable. Indeed, the main value of this article is that it covers a project many in the community, including yourself, clearly don't know about.

VL-Hot is stable, mature, and has been around for three years. It is worthy of coverage and my purpose in writing this article is to point it out as a viable alternatives for other lightweight distros.

Oh, and Vector Linux isn't a niche distro unless you consider all desktop oriented distros as niche.

I've read up on DeviceKit now and it is in the early stages of development. Fedora is the test bed for RHEL and as such often has bits and pieces that aren't quite ready for prime time. OTOH, it also gets the cool new technologies first. Does DeviceKit fit in that category now that I've read up on it? Maybe. It's too early to tell, isn't it?

Perhaps the reason I haven't kept up with DeviceKit is that it is so early in the development process. It certainly isn't anything I'd deploy to a customer at this point.

@Martin: HAL does poll continually in order to detect events like CD insertion. Polling can be disabled with hal-disable-polling. The relevant man page can be found at: http://linux.die.net/man/1/hal-disable-polling. There have also been problems caused by just how frequent HAL does poll and patches issued to remedy that. Examples can be found at:
http://bugzilla.kernel.org/show_bug.cgi?id=6722
http://74.125.47.132/linux?q=cache:J-gz3J0ERlAJ:osdir.com/ml/linux.debian.devel.pkg-utopia/2008-04/msg00018.html+HAL+polling&hl=en&ct=clnk&cd=2&gl=us

VL-Hot does offer a significant performance boost over HAL for just that reason. It's visible and almost certainly measurable. It's also a mature project.

Will DeviceKit take over? Perhaps but if performance is lagging there will still be the need for a lightweight alternative which is what VL-Hot provides. VL-Hot is also here now, not at some nebulous point in the future.

Why do you guys feel threatened by this project? Why so defensive? Aren't choices and alternatives in the Linux community a good thing?

Jose needs to chill :P

@Jose, if you seriously think you know everything you ever undertook then that's a very arrogant approach you take in life. That systematically means that you can never ever improve on anything you do/did.
This article is very insightful and deserves the attention of programmers, developers and arrogant ass@#$%s like you.
I bet I can tell you stuff thats happening in the linux community that you have never heard off.

Caitlin, thanks for the excellent article. I've had all kinds of niggles since I switched from Supermount to HAL, mainly connected with its CD polling, so I was seriously thinking about replacing it with autofs/automount. It looks like VL-Hot could be just the thing to fill in the remaining gaps, so I might finally get around to doing it!
Being new to HAL I wasn't aware of hal-disable-polling either, so the article + comments are a great help either way.

Thanks for the article Caitlin. You did a good job as always. VectorLinux is great when it comes to make an old computer feel young again, and usable for its owner.

@Jose: Calm down dude! It's impossible to know everything. Someone once told me that a smart person is one who knows that he/she does not know and is not afraid to admit it.

Very nice article, as I have come to expect from Caitlyn. Just a few points of clarification which I did not have time to send her before the article was finished:

The code for opening a filenamager is not yet operational, though the configuration option was already added to vl-hot-config.

The left-over icons cleanup takes place on the next unmount action, so it will eventually catch up, lol. An option is to set up a small script that runs during boot to take care of this.

There are 2 desktop icons for each partition on XFCE due to a limitation of this desktop environment, which does not seem to handle custom icon actions. On KDE there would be only 1 icon. I have not tested on Gnome so this defaults to the 2 icon system, though it may support the custom actions.

The default mountbase is /mnt/vl-hot/, but the actual mount point within that is taken from 3 sources in order of preference:

1- custom name from vl-hot.conf
2- volume label of the partition
3- vl-hot + a sequential number

This means it will use vl-hot# only if the first 2 options are not set.

Thanks for the tip. I was looking something to load on this old laptop.

It's simply fascinating how most of these distributions out all but kill the performance on an old machine.

The distributions have lost sight of their target audiences.

Windows 2000 / 98 os's had hal and it ran smooth. The problem with Linux is the guy that probably developed linux-hal did so on exotic hardware.

Red Hat and Fedora are the worst alternatives for Linux. SELinux for a desktop user is the worst idea ever.

Wow... Redhat/Fedora is a crappy, slow, and buggy distro Jose! =) But it is also a great distribution and the community of developers contribute a lot of code and expertise back to the general GNU/Linux community as well. After all, the last distro I heard Linus Torvalds was using, was, in fact Fedora.

I think it's great that an article is written about a reasonable alternative (exactly what I was searching for). Just because a journalist mentions a new type of pickle doesn't mean they should instantly know everything about every pickle and who grows them. Of course, the more we strive to get that extra info, the better.

Journalism is just that. You should question everything (opinion and "fact"). If there were claims made that VL-Hot was "better than" DeviceKit, well , then you may have had some ground to stand on. But now your just sitting there with poo all over your face - good job! Way to bash a writer that actually (honestly) responds to her readers! You win the award for Rude Ignorance!

Thank you Caitlyn for the informative article. I will use it as a starting point for my own research and opinions.

News Topics

Recommended for You

Got a Question?