[SATLUG] haldaemon restart at boot

John D Choate jdchoate at gmail.com
Fri Nov 20 10:41:47 CST 2009


On Friday 20 November 2009 00:34:58 Tweeks wrote:
> Depending on what distro you're using, init script system can vary quite a bit.
> By doing your renaming hack, the symlink can break other parts of the system.
> 
> For example, the Red Hat chkconfig automation system.  Your hack 
> would have left chkconfig crippled like this:  
> 
>         # chkconfig --list haldaemon
>         haldaemon        0:off   1:off   2:on    3:off   4:on    5:on    6:off
> 
> Sorry Bruce... my nit now.. ;)
> 
> 
> > For more information, read the script /etc/rc.d/rc on a RedHat system.
> 
> A better "hack" that WOULDN'T break the a Red Hat system would 
> be to use the system to hack itself, but correctly.  
> 
> For example.. on a RH system, instead of hacking the symlink (illegally), 
> play within the bounds of the chkconfig system: 
> -Delete (tear down) the SysV symlinks, 
> -RENAME the init script itself, 
> -then properly modify it's start and stop order number, 
> -then rebuild the links with the chkconfig add command
> 
> So to do it correctly, first remove the SysV init script symlinks by
> using the RH "chkconfig --del" command, but don't actually stop it:
>         
>         # ls -la /etc/rc.d/rc3.d/*hal*
>         lrwxrwxrwx 1 root root 19 Nov 19 23:56 /etc/rc.d/rc3.d/S98haldaemon -> ../init.d/haldaemon
>         # chkconfig --del haldaemon
>         # ls -la /etc/rc.d/rc3.d/*hal*
>         ls: /etc/rc.d/rc3.d/*hal*: No such file or directory
> 
> Now rename the actual SysV init script to make it last alphabetically:
> 
>         # mv /etc/rc.d/init.d/haldaemon /etc/rc.d/init.d/ZZhaldaemon
> 
> Next, modify these "comment lines" in the init script:
> 
>         # chkconfig: 345 98 02
> to
>         # chkconfig: 345 99 02
> 
> (the 98 was the OLD start order.. now 99 is)
> 
> Now use chkconfig to add (and rebuild) the valid start links using 
> its new service name:
>         # chkconfig --add ZZhaldaemon
>         # chkconfig --list |grep ZZ
>         ZZhaldaemon     0:off   1:off   2:off   3:on    4:on    5:on    6:off
> 
> While still showing the new correctly modified start order:
> 
>         # ls -la /etc/rc.d/rc3.d/*hal*
>         lrwxrwxrwx 1 root root 21 Nov 20 00:02 /etc/rc.d/rc3.d/S99ZZhaldaemon -> ../init.d/ZZhaldaemon
> 
> You might also want to add the "hal" package to the yum skiplist to prevent it 
> from being changed via some future update.  
> 
> NOW the system is "good" and you have avoided setting up someone else da bomb.
> 
> That is.. unless you want prevent from updating by maybe creating and hacking 
> a decoy init script that can't be upgraded:
>         touch /etc/rc.d/init.d/haldaemon && chattr +i /etc/rc.d/init.d/haldaemon
> 
> hehe.. (that was a joke).. ;)
> 
> 
> L8ERs...
> 
> Tweeks
> -- 

Well, thanks again. This is certainly more info than I needed or can use. But I will save it for future reference.
Adding commands to restart haldaemon in rc.local worked fine for me and will do well until Mandriva releases updates with a kernel beyond 2.6.31. They should have it sorted by then, or so I hope.
This is all related to a problem I posted about previously where certain USB drives were not mounting unless they had an external power supply or were already plugged in upon boot. In both of those cases, mount time took extra long (about a minute).
All is working properly now that haldaemon is restarting without me having to provide root password for a script every time I logged in.

John C


More information about the SATLUG mailing list