Bug 145301 - [patch] sysutils/hal: /usr/local/etc/rc.d/hald startup delay problem
Summary: [patch] sysutils/hal: /usr/local/etc/rc.d/hald startup delay problem
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-02 19:00 UTC by Martin Birgmeier
Modified: 2016-01-17 10:34 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (292 bytes, patch)
2010-04-02 19:00 UTC, Martin Birgmeier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2010-04-02 19:00:17 UTC
FreeBSD's startup command for hald, /usr/local/etc/rc.d/hald, uses a custom start_cmd which waits up to 60 seconds for getty to start.

This has a bad interaction when the X server is not started from getty, but using a (custom) startup script. In this case, the X server starts *before* getty, but the hald waits until *after* getty has started. This means that the X server does not see the devices offered by hald.

Before I finally tracked down the cause, I had the following in my X startup script in order to ensure that hald was running before the X server started:

i=0
while [ $i -lt 120 ] && ! /usr/local/bin/lshal > /dev/null 2>&1
do
    if [ $i -eq 0 ]
    then
        echo -n ' (please wait)'
    else
        echo -n .
    fi
    sleep 3
    : $(( i = i + 3 ))
done

This of course only worked because it waited *longer* than the maximum delay in /etc/local/etc/rc.d/hald (fortunately, the latter *did* include such a maximum (at 60 seconds), otherwise the script above would have timed out (after 120 seconds)).

The fix is simple: simply get rid of the custom startup command in /usr/local/etc/rc.d/hald.

Fix: The bandaid patch is attached. Of course, the whole body of the start_cmd can also be deleted, but this should be checked by whoever wrote this in the first place - I do not know for what reason the wait for getty was introduced originally.

Patch attached with submission follows:
How-To-Repeat: Try to run the X server before getty starts (using a script in /usr/local/etc/rc.d, usually).
Comment 1 Martin Birgmeier 2010-04-02 19:30:05 UTC
Oh well... I have been looking for answers to this delay problem for 
ages, but never found anything much helpful. Now that I have the "fix", 
I find 
http://lists.freebsd.org/pipermail/freebsd-current/2009-April/005690.html right 
away...

This whole thing is an abominable hack!

At the end of the thread cited above, there is an alternative solution 
(basically starting hald twice). Maybe that should be implemented.

But with kdm started from rc.d, I am asking myself whether the 
console-kit-daemon does anything interesting at all.

And just now I have also found /usr/local/kde4/etc/rc.d/kdm4 - I always 
looked in /usr/local/etc/rc.d before, never found it, and therefore used 
my own script. Hmmm. I guess now I only need to find where all this is 
documented.

For the time being, I'll still try running without start_cmd in rc.d/hald.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-04-05 02:00:53 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gnome

Fix synopsis and assign.
Comment 3 Jeremy Messenger freebsd_committer freebsd_triage 2010-07-20 21:35:04 UTC
State Changed
From-To: open->suspended

As you have figured it out why hal has all of hacks in it. Mark it as 
suspended, that way it will remind us when we don't need hack anymore.