# hamachi blocks startup

## triki

During startup after Hamachi log-in, the startup process blocks and doesn't start the next daemon. This happen one time of two: one time I get system starting regulary also after Hamachi login, the next time I start the system (it's the same if I do it after a few or a lot of time) it stops after Hamachi successfull login, then the next time it again works fine.

I tried changing in /etc/conf.d/rc Parallel startup from "no" to "yes" and I get the system starting regulary but one time of two it successfully stops the other one time it hangs during stop. In this situation (paralle_startup=yes and case when during shutdown system i get crash) I also noticed that:

1) in first console it didn't get to login but it show only some daemon started

2) the result of "/etc/init.d/hamachi status" is "starting" but checking from another host my computer is regulary running hamachi.

Any ideas for solving the problem or making a workaround that let me start hamachi without using standard demon?

Thank

----------

## BradN

Can you put it in /etc/conf.d/local.start?

----------

## triki

Yes it works fine every time I start the system, thank you!

Do you think I have bettter put also stop command for hamachi in local.stop?

----------

## BradN

It probably isn't important unless it needs to run some cleanup before it shuts down.  You could probably get by with a killall daemonname command in local.stop.

Also, in local.start, you will probably want to put & after the command so it runs in the background and local.start actually finishes (that is, if the daemon itself doesn't fork a new process by itself to let the original finish).  

If you want to do things more correctly, you could use the start-stop-daemon command which will make init start the process, and can save its pid to a file for you to use to close it later (this is more important if you need to run more than one instance of the daemon at a time).

But really, if it works fine for you now, I wouldn't worry too much.

----------

## triki

I think is the start-stop daemon that gives me the original problem, so if in this way it works it's fine. The only doubt is that why on other to computer I get it starting and stopping fine in default runlevel...

----------

## BradN

It's hard to say why that is, but it's common for there to be race conditions during startup, where say, on a slower or faster machine, it might work fine, but on the opposite some ordering happens differently that things don't work right.

But, this is less likely with parallel startup off, but can still happen (sometimes the system thinks a service is done starting, but in reality it's still getting ready in the background).

----------

## triki

so strange... what i get is all fine on a PIII laptop (1996) and on a coreduo laptop (2009) but all wrong on a quad (2009) all with parallel off. If I swicth parallel on, I get hamachi started but the system thinking not. I'm just trying to change something in the waiting time you can find in rc file but with no success.

----------

## BradN

Another idea I thought of, you could try adding sleep 1 before and after the start-stop-daemon command in the init script - this may work around the problem too.

----------

## triki

So i have to put sleep 1 inside the hamachi file i find in /etc/init.d ?

----------

## BradN

Yep, basically we're giving it an extra second before and after running the daemon - this should be plenty to overcome whatever was happening, if it was indeed a race condition.

Like, pretend this is how the file looked:

something something

start-stop-daemon blah blah

something else

You would want it to look like:

something something

sleep 1

start-stop-daemon blah blah

sleep 1

something else

It's always better if you can make it work using the init scripts, just in case you add another service later that needs hamachi (not sure if this is possible or not), but if you had it in local.start, suddenly you would have to start 2 services there!  And, if it's going to be like that, why not just use slackware where you write your own init script for everything...

----------

