Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

November 25, 2006

Ubuntu 6.10 Annoyance: `failed to initialize HAL` error

Filed under: GNU/Linux — tabrez @ 1:49 pm

Ubuntu 6.10(Edgy Eft) worked well for the first few weeks with the most visible change from the earlier version being fast boot up times. It took less than a minute on my system to boot Ubuntu and load the GNOME desktop(with automatic user login enabled). Then I lost the sound on a certain fateful day without being able to understand what could have been the possible reason for it. I got it back by running the amixer command and resetting the volume levels, but lost it again after a few days. Running the same command returned the sound but I have no idea when I am going to lose it again. My concern though is that I am not able to track down what is causing the sound to go dead repeatedly(I hope it is not because of the beta version of the Firefox Flash plugin).

The error that refuses to go away and which seems to have no simple fixes, is the HAL initialization error. I started to get this error after a few weeks since the installation of Ubuntu 6.10, in the form of a pop up window informing that the system failed to initialize HAL. Which meant no automatic mounting of the removable devices: USB hard disks, USB pen drives and CD/DVD discs in my case. After spending some time hunting for a fix on the Internet, going through bug reports and related discussion on Launchpad, surfing through ubuntuforums threads and chatting on IRC channels, I found two possible fixes for the problem:

Disabling the Samba shares in the /etc/fstab file and Disabling the automatic user login option for GDM.

There are no Samba shares in my /etc/fstab file, so I tried disabling the auto login option for GDM(System -> Administration -> Login Window -> Security; but if you have enabled this option earlier, then you already know how to disable it) and the HAL error was gone. All the removable disks were mounted automatically upon insertion once again. This clearly shows that there is a timing problem which is causing this error, and it goes away when the login process gives enough time for all the initialization to be completed before fully loading the GNOME desktop manager. Which also suggests that using timed automatic login option will also effectively solve the problem: I used a time delay of 5 seconds with automatic login option and HAL is properly initialized with this setting.

If you think automatic mounting of Samba shares might be the source of failed HAL initialization problem, read this discussion:
auto smbfs mount in /etc/fstab causes hald hang at boot
Ubuntuforums has the discussion about disabling automatic login option in GDM to fix HAL initialization error.

If you want to receive future posts by email, enter your email address here:

Related Posts:

18 Comments »

Thanks! That was exactly what was wrong for me too. :-)

Quote

Comment by Dave — December 12, 2006 @ 6:22 pm

See https://launchpad.net/ubuntu/+source/gdm/+bug/81670. In fact, all you need is (1) disable automagic login (it logs you in as soon as possible, which is a bad idea on this bug, and a bad idea on security), and (2) give it a minute or so before logging in.

It is a race condition, and you lose if you log in before a certain piece of the system starts (udev). This only happens after a boot.

Quote

Comment by hggdh — February 12, 2007 @ 10:04 pm

I think i know the exact cause of this. I was trying to make a Fat32 share in root. I had to enable Root to login with GDM. when i enabled it, the next reboot I got the error. I disabled it and the error was gone. I think this has to do more with Root being allowed to login coupled with Auto login.

Just letting ya know. Im a Linux noob but noticed this happened.

Quote

Comment by Geilt — February 13, 2007 @ 11:17 am

It’s nothing to do with root, it’s a simple race condition as hggdh said.

Quote

Comment by Dave — February 13, 2007 @ 2:01 pm

Oh! allright, no idea what a race condition is either =) Told ya im new!

Switching from windows has been fun!

Quote

Comment by Geilt — February 13, 2007 @ 6:27 pm

:-)

It just means it depends on which process manages to load first. By delaying the login a bit longer (use timed login instead of automatic login) you help udev to finish first.

Quote

Comment by Dave — February 13, 2007 @ 6:31 pm

Ah! That makes sense. Although I wonder why there is no priority to what loads up first? Are multiple things loaded at once instead of one by one to increase boot time?

For Example: In windows, when it starts loading its DLL’s it loads em one by one and it will pause on a busted one almost every time.

But if the way this works is true then either something is not in a proper order, or one is loading quicker than the other but loading at the same time.

Just asking for knowledge sake =). Will probably come in handy for more advanced and future linux use.

Quote

Comment by Geilt — February 13, 2007 @ 8:09 pm

Dave on February 13, 2007 at 8:17 pm said:

Although I wonder why there is no priority to what loads up first?

See the bug report in comment 2.

Quote

Comment by Dave — February 13, 2007 @ 8:17 pm

There is an order imposed on Linux (in fact, all brands of UNIX) system startup. The full explanation is rather long, soI will summarise it here:

under /etc/init.d you will find a series of shell scripts. These are the systems startup/shutdown scripts for each Linux component (that warrants such approach).

Now, under /etc/rc[0-6].d you will find a series of soft links into the /etc/init.d. These soft links are named S, where varies between 00 and 99, and usually refers to the linked file under /etc/init.d. The meaning of the rc.d are as follows:

/etc/rc0.d — scripts to be used to shutdown the box
/etc/rc1.d — scripts to be used to bring the box into single user mode (usually for system recovery)
/etc/rc[2-5].d — scripts used to bring the box into the desired multi-user level. The default for a normal startup is rc2.d
/etc/rc6.d — scripts to be used to reboot the box.

Additionally, /etc/rc.local will always be executed after all rc[2-5] startup scripts are executed.

For each of these directories (except rc.local, which is a file, not a directory), the names *must* start with a S (uppercase letter ‘S’) — to start — or a K (uppercase letter ‘K’) — to stop –. After the initial letter the two-digit number defines the relative priority, startying at 00 as the highest and going down to 99 as the lowest.

This is why we see this issue: gdm — the gnome display manager — is stated before dbus, and your gnome session depends on dbus.

Quote

Comment by hggdh — February 13, 2007 @ 10:03 pm

this bug ‘failed to initialize hal’ is now getting into my blood system, logging me off 20 times isnt nice.i dont have autologin and i always give dbus time to load, i cant understand why is this bug stil sticking around. most of the time it happen when i open firefox(v2.0.0.1) or gaim(v2.0.0beta3.1). here is the log: $tail -f /var/log/messages

Feb 21 23:26:06 unknown007 gconfd (root-4994): starting (version 2.16.0), pid 4994 user ‘root’
Feb 21 23:26:06 unknown007 gconfd (root-4994): Resolved address “xml:readonly:/etc/gconf/gconf.xml.mandatory” to a read-only configuration source at position 0
Feb 21 23:26:06 unknown007 gconfd (root-4994): Resolved address “xml:readwrite:/root/.gconf” to a writable configuration source at position 1
Feb 21 23:26:06 unknown007 gconfd (root-4994): Resolved address “xml:readonly:/etc/gconf/gconf.xml.defaults” to a read-only configuration source at position 2
Feb 21 23:26:06 unknown007 gconfd (root-4994): Resolved address “xml:readonly:/var/lib/gconf/debian.defaults” to a read-only configuration source at position 3
Feb 21 23:26:06 unknown007 gconfd (root-4994): Resolved address “xml:readonly:/var/lib/gconf/defaults” to a read-only configuration source at position 4
Feb 21 23:27:36 unknown007 gconfd (root-4994): GConf server is not in use, shutting down.
Feb 21 23:27:36 unknown007 gconfd (root-4994): Exiting
Feb 21 23:28:29 unknown007 gnome-power-manager: (oli) Critical error: This program cannot start until you start the dbus system service. It is strongly recommended you reboot your computer after starting this service.
Feb 21 23:28:29 unknown007 gnome-power-manager: (oli) Critical error: This program cannot start until you start the dbus system service. It is strongly recommended you reboot your computer after starting this service.

========

Feb 22 23:50:42 unknown007 gconfd (oli-4706): Exiting
Feb 22 23:50:48 unknown007 gconfd (oli-6598): starting (version 2.16.0), pid 6598 user ‘oli’
Feb 22 23:50:48 unknown007 gconfd (oli-6598): Resolved address “xml:readonly:/etc/gconf/gconf.xml.mandatory” to a read-only configuration source at position 0
Feb 22 23:50:48 unknown007 gconfd (oli-6598): Resolved address “xml:readwrite:/home/oli/.gconf” to a writable configuration source at position 1
Feb 22 23:50:48 unknown007 gconfd (oli-6598): Resolved address “xml:readonly:/etc/gconf/gconf.xml.defaults” to a read-only configuration source at position 2
Feb 22 23:50:48 unknown007 gconfd (oli-6598): Resolved address “xml:readonly:/var/lib/gconf/debian.defaults” to a read-only configuration source at position 3
Feb 22 23:50:48 unknown007 gconfd (oli-6598): Resolved address “xml:readonly:/var/lib/gconf/defaults” to a read-only configuration source at position 4
Feb 22 23:50:50 unknown007 gconfd (oli-6598): Resolved address “xml:readwrite:/home/oli/.gconf” to a writable configuration source at position 0
Feb 22 23:50:51 unknown007 dhcdbd: Shut down.
Feb 22 23:58:34 unknown007 gnome-power-manager: (oli) Critical error: This program cannot start until you start the dbus system service. It is strongly recommended you reboot your computer after starting this service.

Quote

Comment by oliver — February 23, 2007 @ 5:44 am

How do you make the Autologin have a 5 second Delay before automatically logging in?

Quote

Comment by tenka — April 19, 2007 @ 6:37 am

You do not. There is no such option, unless you go and hack in.

The best option is to change the startup priority of dbus, so that it will start before gdm/kdm/whateverdm. On Feisty this has been done, but I do not know if it (will be|has been) backported to Edgy. This is a rather simple change.

Quote

Comment by hggdh — April 19, 2007 @ 5:47 pm

>> “How do you make the Autologin have a 5 second Delay before automatically logging in?”

> “You do not. There is no such option, unless you go and hack in.”

Sure there is! System > Administration > Login (or sudo gdmsetup) > Security > Timed Login. I use a 15 second delay.

(Or perhaps instead hggdh could actually explain which files need changing to change the startup priority as they suggest? Because I would only be guessing.)

Quote

Comment by Dave — April 19, 2007 @ 6:10 pm

I stand corrected :-)

On my defence, I have never used autologins because of the huge security risk (since I float around different customers, having my laptop autologin is an invitation to be had; YMMV).

Anyway, delaying autologin is not a solution, but a bypass.

For full resolution, change /etc/rc[2345].d/S20dbus to /etc/rc[2345].d/S12dbus (this is how it is on Feisty; I do not use Edgy):

sudo mv /etc/rc2.d/S20dbus /etc/rc2.d/S12dbus
sudo mv /etc/rc3.d/S20dbus /etc/rc3.d/S12dbus
sudo mv /etc/rc4.d/S20dbus /etc/rc4.d/S12dbus
sudo mv /etc/rc5.d/S20dbus /etc/rc5.d/S12dbus

What will happen: it will take slightly longer for the autologin to complete, but you will not have this issue anymore.

In fact, the time needed to initialise dbus will vary depending on your hardware. It can be as low as some few seconds, and as high as some tens of seconds. In my case, due to another issue (apparently resolved by HAL 0.5.9) it takes about 30 seconds for my LVM partitions to be available.

Quote

Comment by hggdh — April 19, 2007 @ 6:36 pm

Another fix at blog.ubrio.us:
udev address already in use

Quote

Comment by tabrez — July 26, 2007 @ 1:11 pm

If you want to debug:

sudo hald –daemon=no –verbose=yes

My HAL wouldn’t start after upgrading to 6.10 because a file was in the wrong place:

cd /var/cache/hald
sudo mv fdi-cache~ fdi-cache

Quote

Comment by Matthew Painter — October 26, 2007 @ 6:34 pm

thanks for the info. Needed to boot windows xp first on a dual boot machine with a very inexperienced user that couldn’t handle the boot screen. Made a change from default 0 to default 8, xp being the 8th line on the list, using sudo gedit /boot/grub/menu.lst This moved the highlighted selection bar to xp to boot first. Then upon rebooting and selecting ubuntu the hal problem appeared. Using your time delay suggestion worked thank you

Quote

Comment by gene kemp — April 8, 2008 @ 6:00 am

[...] megoldás innen származik. Köszönet érte. Ha tetszett, oszd meg ezt a bejegyzést [...]

Quote

Pingback by HAL | Garrotter blogja — November 15, 2008 @ 5:45 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment

Subscribe without commenting


Copyright (c) 2006, 2007 Tabrez Iqbal.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


Powered by WordPress
This website is hosted by Dreamhost


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser
Mobilytics