monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems starting sshd [READ]


From: Jan-Henrik Haukeland
Subject: Re: problems starting sshd [READ]
Date: Wed, 16 Jul 2003 03:32:02 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Civil Service, linux)

"Krayzman, Dmitriy" <address@hidden> writes:

> I'm running monit 3.2 on Solaris9. Monit is configured to monitor
> sshd daemon but fails to restart it after sshd is shut down. 
[*]
> I have no troubles executing "/etc/init.d/sshd2 start" from the
> command line, also monit -t returns no errors.  Here is my monitrc
> file:
>
> set daemon 300
> set mailserver someserver.mcw.edu
> set logfile /var/log/monit
> set mail-format { from: address@hidden }
>
> check sshd
> pidfile /var/run/sshd2_22.pid
> start "/etc/init.d/sshd2 start"
> stop "/etc/init.d/sshd2 stop"
> port 22 protocol ssh
> alert address@hidden

Martin and I have discussed this problem with Dmitriy off-list (not
the preferred way, btw). Anyway, we found a bug which should be
generally interesting, I choose therefor to send the solution to this
list as well as a FYI. [The context to the answer below is that we got
Dmitriy to run truss on monit, to find out why sshd refused to start]


"Krayzman, Dmitriy" <address@hidden> writes:

Thanks for running truss. I found the bug as soon as I saw this line
(skip to the end of this mail to fix the problem if you do not care to
know what the problem was):

> execve("/etc/init.d/sshd2 start", 0x00050278, 0x00047368) Err#2 ENOENT

you can see that the program monit is trying to start is:
"/etc/init.d/sshd2 start" and this fails with ENOENT, meaning; program
to execute does not exist. Which of course is true, because the start
argument somehow got mangled into the command to run.

The correct execve line should have looked something like this:

execve("/etc/init.d/sshd", ["/etc/init.d/sshd", "start"]

Where the start argument is part of the arguments array to execve.

I had to double-check in our lexer and then your monitrc file to find
the bug. The reason, it turns out, is the "peculiar" way you wrote the
start/stop statement:

 start "/etc/init.d/sshd start"
 stop "/etc/init.d/sshd stop"

There is in fact a bug in the lexer which parsed this line wrong (and
put the start argument into the command to execute). The reason no one
has reported this before is probably that all our documentations use
this form:

 start = "/etc/init.d/sshd2 start" or even
 stop program = "/etc/init.d/sshd2 stop"

If you use this form it will work. Actually, if you only had used more
than one blank space between start/stop and the program it would had
worked as well.

Anyway, according to the documentation, the way you wrote the
start/stop statements should have worked, unfortunately, it didn't. I
have fixed the bug in our lexer, so it will work in the next monit
release. Until then, write the start/stop statement like so:

 start = "/etc/init.d/sshd2 start"
 stop  = "/etc/init.d/sshd2 stop"

-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]