A HAL bug?

15 11 2010

This is not related to Solr/Lucene but I have to write it down somewhere so I don’t forget it next time.  I have seen this problem a few times in the past and have always forgotten about it.  Here is the behavior, when you run a Linux VPS environment, SOMETIMES (I have to stress this) hald does not play nice with your CD/DVD virtual drive.  It may ping the drive every second unnecessarily.  For most of the time, you will hardly notice it.  However, on some occasions, it may consume enough CPU and I/O that can push your idle machine to have an extra load of 1.0 or above.  It’s quite annoying when it’s happening in a small VPS where resources is already very limited.  If this is happening in your environment, you will see a process called hald-addon-storage lingers that always consume at least 1% CPU.  To confirm that it really is eating up your resources, you can use the following command to trace the system calls it makes:

strace -t -p 

You may see a bunch of open calls, such as following, on your CD/DVD drive.

open("/dev/hdc", O_RDONLY|O_NONBLOCK|O_EXCL|O_LARGEFILE) = -1
EBUSY (Device or resource busy)

So, what’s the solution?  I haven’t found a good solution for it other than stopping this pulling entirely.  Usually, you only use the CD/DVD during OS installation so stopping it shouldn’t create any adverse effect on your environment.  Here is what you should do to stop it:

  • Make sure haldaemon is still running, run following command to find your CD/DVD drive’s UDI
hal-find-by-capability --capability storage.cdrom
  • You should see something like this
/org/freedesktop/Hal/devices/storage_serial_QM00003
  • Now create this file, /etc/hal/fdi/information/media-check-disable-cd.fdi, with following content:


  
    /org/freedesktop/Hal/devices/storage_serial_QM00003">
      false
    
    

And of course, replace the “info.udi” value with your own value.  Restart haldaemon now and you should be all good.