# hald won't start -- WORKAROUND -- bug 282341

## Felig

Hald fails to start.  It was working fine under the same kernel, but when I rebooted after several days out of town with a couple of daily updates, hald was not happy.  I have since tried the 2.6.31 kernels with no difference.

Setting HALD_VERBOSE=yes in init.d/hald, I get about 8000 lines of output in /var/log/messages.  I can post this if anyone wants to wade thru it  :Smile:   Otherwise, I will summarize it.

When I manually try to start hald, the last few lines are this:

```

Oct  1 15:44:24 crowfix hald-addon-rfkill-killswitch: [5087]: 15:44:24.192 [D] addon-rfkill-killswitch.c:168: This device (/org/freedesktop/DBus/Local) isn't yet handled by the addon.

Oct  1 15:44:24 crowfix process: 5105: arguments to dbus_move_error() were incorrect, assertion "(dest) == NULL || !dbus_error_is_set ((dest))" failed in file dbus-errors.c line 278.

Oct  1 15:44:24 crowfix This: is normally a bug in some application using the D-Bus library.

Oct  1 15:44:24 crowfix D-Bus: not built with -rdynamic so unable to print a backtrace

Oct  1 15:44:24 crowfix /etc/init.d/hald[5067]: ERROR: hald failed to start

Oct  1 15:44:24 crowfix hald-probe-pc-floppy: [5094]: 15:44:24.211 [E] probe-pc-floppy.c:88: floppy drive /dev/fd0 seems not to exist

```

I restarted dbus and tried hald again.  The messages changed, but not the end result:

```

Oct  1 16:11:05 crowfix libhal.c: 4494 : Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Oct  1 16:11:05 crowfix hald-addon-hid-ups: [7752]: 16:11:05.129 [D] addon-hid-ups.c:117: foo: 'Back-UPS XS 1500 LCD FW:837.H4 .D USB FW:H4 '

Oct  1 16:11:05 crowfix hald-addon-rfkill-killswitch: [7728]: 16:11:05.129 [D] addon-rfkill-killswitch.c:168: This device (/org/freedesktop/DBus/Local) isn't yet handled by the addon.

Oct  1 16:11:05 crowfix process: 7748: arguments to dbus_move_error() were incorrect, assertion "(dest) == NULL || !dbus_error_is_set ((dest))" failed in file dbus-errors.c line 278.

Oct  1 16:11:05 crowfix This: is normally a bug in some application using the D-Bus library.

Oct  1 16:11:05 crowfix D-Bus: not built with -rdynamic so unable to print a backtrace

Oct  1 16:11:05 crowfix libhal.c: 4494 : Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Oct  1 16:11:05 crowfix libhal.c: 4494 : Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Oct  1 16:11:05 crowfix libhal.c: 4494 : Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Oct  1 16:11:05 crowfix /etc/init.d/hald[7708]: ERROR: hald failed to start

Oct  1 16:11:05 crowfix hald-addon-hid-ups: [7752]: 16:11:05.146 [D] addon-hid-ups.c:117: foo: 'JB0642008132  '

Oct  1 16:11:05 crowfix hald-addon-hid-ups: [7752]: 16:11:05.159 [D] addon-hid-ups.c:117: foo: 'PbAc'

Oct  1 16:11:05 crowfix hald-addon-hid-ups: [7752]: 16:11:05.170 [D] addon-hid-ups.c:117: foo: 'American Power Conversion'

Oct  1 16:11:05 crowfix hald-addon-hid-ups: [7752]: 16:11:05.196 [D] addon-hid-ups.c:117: foo: 'Back-UPS XS 1500 LCD'

Oct  1 16:11:05 crowfix hald-addon-hid-ups: [7752]: 16:11:05.216 [D] addon-hid-ups.c:117: foo: 'JB0642008132  '

Oct  1 16:11:05 crowfix hald-probe-pc-floppy: [7735]: 16:11:05.271 [E] probe-pc-floppy.c:88: floppy drive /dev/fd0 seems not to exist

```

The only other "error" messages are related to no lid button, no battery, etc, but this isn't a laptop, so that's ok by me.

I have no clue wat to look for.  These error messages mean nothing to me, and google doesn't show much.  I'm more than willing to try suggestions.

This is a ~amd64 system:

```

kernel 2.6.31-gentoo-r1 #1 SMP PREEMPT Mon Sep 28 15:10:58 PDT 2009 x86_64 AMD Opteron(tm) Processor 244 AuthenticAMD GNU/Linux

```

Versions of interest are:

```

[ebuild   R   ] sys-apps/dbus-1.3.0  USE="X doc -debug (-selinux) -test" 0 kB

[ebuild   R   ] sys-apps/hal-0.5.13-r2  USE="X acpi consolekit crypt doc -apm -debug -dell -disk-partition -laptop -policykit (-selinux)" 0 kB

[ebuild   R   ] app-misc/hal-info-20090716  0 kB

```

emerge --info:

```

Portage 2.1.6.13 (default/linux/amd64/2008.0, gcc-4.4.1, glibc-2.10.1-r0, 2.6.31-gentoo-r1 x86_64)

=================================================================

System uname: Linux-2.6.31-gentoo-r1-x86_64-AMD_Opteron-tm-_Processor_244-with-gentoo-2.0.1

Timestamp of tree: Thu, 01 Oct 2009 21:20:01 +0000

ccache version 2.4 [enabled]

app-shells/bash:     4.0_p33

dev-java/java-config: 1.3.7-r1, 2.1.9-r1

dev-lang/python:     2.4.6, 2.5.4-r3, 2.6.2-r2, 3.1.1-r1

dev-python/pycrypto: 2.0.1-r8

dev-util/ccache:     2.4-r8

dev-util/cmake:      2.6.4-r2

sys-apps/baselayout: 2.0.1

sys-apps/openrc:     0.4.3-r3

sys-apps/sandbox:    2.1

sys-devel/autoconf:  2.13, 2.63-r1

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11

sys-devel/binutils:  2.19.1-r1

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6a

virtual/os-headers:  2.6.30-r1

ACCEPT_KEYWORDS="amd64 ~amd64"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O3 -march=k8 -mtune=k8 -pipe -fomit-frame-pointer"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/4.2/env /usr/kde/4.2/share/config /usr/kde/4.2/shutdown /usr/share/config /var /var/lib/hsqldb /var/qmail/alias /var/qmail/control /var/spool/torque"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"

CXXFLAGS="-O3 -march=k8 -mtune=k8 -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

EMERGE_DEFAULT_OPTS="--keep-going --nospinner"

FEATURES="buildsyspkg ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://gentoo.osuosl.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo"

LDFLAGS="-Wl,-O1"

LINGUAS="en_US en_GB en af ar az bg bn br bs ca cs cy da de el eo es et eu fa fi fr fy ga gl he hi hr hu is it ja km ko lt lv mk mn ms nb nds nl nn pa pl pt pt_BR ro ru rw se sk sl sr sr@Latn ss sv ta tg tr uk uz zh_CN zh_TW"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"

USE="3dnow X Xaw3d a52 aac aalib accessibility acl acpi afs aim alsa amd amd64 anthy apache2 arts audiofile avahi bcmath berkdb bidi blas bluetooth bonjour bonobo bzip2 cairo calendar canna cdb cdparanoia cdr chasen cjk cli consolekit cracklib crypt ctype cups curl curlwrappers dbm dbus dbx dga directfb doc dri dts dv dvb dvd dvdr dvdread eds emacs enblend encode esd evdev evo examples exif expat extras fam fastcgi fbcon ffmpeg flac flash flatfile fontconfig foomaticdb fortran freetds freewnn ftp gb gcj gd gdbm geoip ggi gif ginac glib glut gmp gnome gnustep gnutls gphoto2 gpm gps gstreamer gtk gtkhtml guile hal haskell howl iconv icq idn ieee1394 imagemagick imap imlib immqt-bc inifile innodb ipv6 isdnlog jabber jack jadetex java java5 javascript jbig jpeg jpeg2k junit kde kpathsea ladcca lapack lash lcms leim libcaca libffi libgda libwww lirc lm_sensors loop-aes lua lzo m17n-lib mad maildir mailwrapper mcal mdnsresponder-compat mikmod mime ming mjpeg mmap mmx mng modules mono motif mozilla mp3 mpeg mpi msn mudflap multilib musepack mysql mysqli nas ncurses networking new-login nis nls nptl nptlonly nsplugin objc ocaml odbc offensive ofx ogg openal openexr opengl openmp oscar oss pam pcre pda pdf perl plotutils png portaudio posix postgres ppds pppd python qdbm qt3 qt3support qt4 quicktime readline recode reflection rtc ruby samba sasl scanner sdl session sharedext sharedmem shorten sift simplexml slang slp sndfile snmp soap sockets socks5 sox speex spell spf spl sql sqlite sqlite3 sse sse2 ssl stroke suexec svg sysfs sysvipc tcpd tetex theora threads tiff tk tokenizer truetype unicode usb utils v4l vcd vhook vorbis wddx webkit wifi wmf wxwindows x264 xanim xcb xine xinerama xml xmlrpc xorg xosd xpm xprint xsl xulrunner xv xvid xvmc yahoo yaz zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias asis auth_basic auth_digest authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache dumpio env expires ext_filter file_cache filter headers ident imagemap include info log_config log_forensic logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http rewrite setenvif speling status unique_id userdir usertrack version vhost_alias" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_US en_GB en af ar az bg bn br bs ca cs cy da de el eo es et eu fa fi fr fy ga gl he hi hr hu is it ja km ko lt lv mk mn ms nb nds nl nn pa pl pt pt_BR ro ru rw se sk sl sr sr@Latn ss sv ta tg tr uk uz zh_CN zh_TW" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"

Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

Last edited by Felig on Sat Oct 03, 2009 5:54 am; edited 1 time in total

----------

## Sannin

Same problem here...

----------

## Nerevar

Long story short: gcc-4.4 and -O3 breaks glib which breaks hal.

For more info:

https://bugs.gentoo.org/show_bug.cgi?id=282341

----------

## Felig

My system matches in those (gcc, hal, glibc) versions and using -O3.  I see one possibility is to switch to -O2 and remerge system, but someone else remerged just hal with -O2.  Obviously I'd rather get back up sooner than later  :Smile: 

How well do these various -On optimizations work together?

P.S.  And thanks, Nerevar.  I googled and searched bugzilla but did not find that bug, even though it has the exact version in its name.  Sometimes searching seems like pure dumb luck more than a black art.

----------

## Nerevar

Rebuilding just glib (not glibc) with -O2 or more precisely "-O3 -fno-ipa-cp-clone" worked for me. You can use the ebuild attached to that bug.

Remember that -O3 is considered an unsupported optimization level by many developers. If that isn't a problem for you, that's fine. It's just something to keep in mind when you file bug reports. For me, the slight performance gain of -O3 was not worth losing support.

----------

## Felig

-fno-ipa-cp-clone with a remerge of glib (not glibc!) did the trick, many thanks.

The description of ipa-cp-clone is not quite obvious to the non-compiler me.  It seems to say that functions called with constants for a parameter are unrolled such that there is a separate copy of the function for each parameter, and callers call the specific function and drop the now-redundant constant parameter.

If this is correct, why does the -fno-ipa-cp-clone glib work with -fipa-cp-clone callers?  I can only imagine that this function copying is only for local functions, not for ones available for linking.

----------

## Nerevar

Here is the information about that switch from the gcc-4.4.1 manual:

```
-fipa-cp

          Perform interprocedural constant propagation. This optimization analyzes the

          program to determine when values passed to functions are constants and then

          optimizes accordingly. This optimization can substantially increase perfor-

          mance if the application has constants passed to functions. This flag is enabled

          by default at ‘-O2’, ‘-Os’ and ‘-O3’.

-fipa-cp-clone

          Perform function cloning to make interprocedural constant propagation

          stronger. When enabled, interprocedural constant propagation will perform

          function cloning when externally visible function can be called with constant

          arguments. Because this optimization can create multiple copies of functions, it

          may significantly increase code size (see ‘--param ipcp-unit-growth=value ’).

          This flag is enabled by default at ‘-O3’.
```

As I read the two switches above, fipa-cp-clone creates multiples copies of functions and based upon the constness of the arguments passed to the function makes the determination of which "cloned" function to call.

So, say you have these simplified definitions:

```
void foo(int a, char *b) {

  bar(a, b);

}

void foo2(int a, const char *b) {

  bar(a, b);

}

void bar(int a, char *b) {

  <do something which doesn't change the secondary argument>

}
```

-fipa-cp-clone creates multiple copies of bar (with and without const arguments). foo would call the non-optimized version of bar (without the const secondary argument) and foo2 would call the optimized version.

Using -fno-ipa-cp-clone means that the "cloned" bar functions with const arguments are not created. That won't break anything, it's just sub-optimal.

----------

## Felig

Ah, of course, "const", not "constant".  Thanks.

I don't know when I set -O3.  I remember many years ago NOT setting it, explicitly keeping -O2, so I don't know what made me change to -O3.

----------

## Nerevar

I changed to -O3 with gcc-4.3 and the march=native switch. It worked fine for that version of gcc. I'm back to -O2 now that I've moved to 4.4.

----------

