Re: Strange "program/file does not exist" error

M/Monit Support <[email protected]> Thu, 10 Apr 2025 09:07:08 +0200
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <[email protected]>
--Apple-Mail=_7985D589-D98B-4B66-B1FE-6E3E53AFDC7A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hello Steven,

it's because of Ubuntu's systemd hardening setup since Ubuntu 24.04, =
please see here for more details and solution: =
https://mmonit.com/wiki/Monit/FAQ#hardening

Best regards,
The M/Monit team


> On 9. 4. 2025, at 23:50, Steven Christensen <[email protected]> wrote:
>=20
> I have a new Ubuntu VM and I installed monit (version 5.33.0). I am =
well-versed with monit, and run it on multiple platforms.
>=20
> Anyway, I have a simple configuration to check for the existence of a =
process, and if it is missing, start it.
>=20
> Here is the configuration
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> check process udptunnel matching "127.0.0.1:21116 =
<http://127.0.0.1:21116/>"
>       start program =3D "/root/start_udptunnel.sh" with timeout 15 =
seconds
>       stop program =3D "/usr/bin/pkill -f 'udptunnel -s 21000'"
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> The start_udptunnel.sh script looks like this:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> #!/bin/bash -x
>=20
> echo "Starting" | ts >> /tmp/udptunnel.log
> /usr/local/sbin/udptunnel -s 21000 127.0.0.1:21116 =
<http://127.0.0.1:21116/> -v 2>&1 | ts >> /tmp/udptunnel.log &
> exit 0
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> Everything works when I invoke start_udptunnel.sh manually. The =
permissions on start_udptunnel.sh are appropriate.
>=20
> However, when I start up monit, this is in the log:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> [2025-04-09T16:21:08+0000] info     : Reinitializing monit daemon
> [2025-04-09T16:21:08+0000] info     : Reinitializing Monit -- control =
file '/etc/monit/monitrc'
> [2025-04-09T16:21:09+0000] warning  : =
/etc/monit/conf-enabled/udptunnel:2: Program does not exist: =
'/root/start_udptunnel.sh'
> [2025-04-09T16:21:09+0000] info     : 'xxxxxxxx.com =
<http://xxxxxxxx.com/>' Monit reloaded
> [2025-04-09T16:21:20+0000] error    : 'udptunnel' process is not =
running
> [2025-04-09T16:21:21+0000] info     : 'udptunnel' trying to restart
> [2025-04-09T16:21:21+0000] info     : 'udptunnel' start: =
'/root/start_udptunnel.sh'
> [2025-04-09T16:21:21+0000] error    : 'udptunnel' failed to start =
(exit status -1) -- Program /root/start_udptunnel.sh failed: File =
'/root/start_udptunnel.sh' does not exist
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> For the life of me I can't figure out why monit says that the script =
doesn't exist.
>=20
> I have copied and pasted the script name from the log just to make =
sure there is no typo.
>=20
> Am I missing something obvious?
>=20
> Thanks


--Apple-Mail=_7985D589-D98B-4B66-B1FE-6E3E53AFDC7A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;">Hello =
Steven,<div><br></div><div>it's because of Ubuntu's systemd hardening =
setup since Ubuntu 24.04, please see here for more details and =
solution:&nbsp;<a =
href=3D"https://mmonit.com/wiki/Monit/FAQ#hardening">https://mmonit.com/wi=
ki/Monit/FAQ#hardening</a></div><div><br></div><div><div>
<div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
line-break: after-white-space;"><div style=3D"color: rgb(0, 0, 0); =
font-family: Helvetica; font-style: normal; font-variant-caps: normal; =
font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px;">Best regards,<br>The =
M/Monit team<br></div><div style=3D"color: rgb(0, 0, 0); font-family: =
Helvetica; font-style: normal; font-variant-caps: normal; font-weight: =
normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px;"><br></div></div>

</div>
<div><br><blockquote type=3D"cite"><div>On 9. 4. 2025, at 23:50, Steven =
Christensen &lt;[email protected]&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div><div dir=3D"ltr">I have a new =
Ubuntu VM and I installed monit (version 5.33.0). I am well-versed with =
monit, and run it on multiple platforms.<div><br></div><div>Anyway, I =
have a simple configuration to check for the existence&nbsp;of a =
process, and if it is missing, start it.</div><div><br></div><div>Here =
is the =
configuration</div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><div>che=
ck process udptunnel matching "<a =
href=3D"http://127.0.0.1:21116/">127.0.0.1:21116</a>"<br>&nbsp; &nbsp; =
&nbsp; start program =3D "/root/start_udptunnel.sh" with timeout 15 =
seconds<br>&nbsp; &nbsp; &nbsp; stop program =3D "/usr/bin/pkill -f =
'udptunnel -s =
21000'"<br></div><div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><div>=
<br></div></div><div>The start_udptunnel.sh script looks like =
this:</div><div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div>#!/bin/bash=
 -x<br><br>echo "Starting" | ts &gt;&gt; =
/tmp/udptunnel.log<br>/usr/local/sbin/udptunnel -s 21000 <a =
href=3D"http://127.0.0.1:21116/">127.0.0.1:21116</a> -v 2&gt;&amp;1 | ts =
&gt;&gt; /tmp/udptunnel.log &amp;<br>exit =
0<br><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><br =
class=3D"gmail-Apple-interchange-newline"></div><div>Everything works =
when I invoke start_udptunnel.sh manually. The permissions on =
start_udptunnel.sh are appropriate.</div><div><br></div><div>However, =
when I start up monit, this is in the =
log:</div><div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><div>[2025-=
04-09T16:21:08+0000] info &nbsp; &nbsp; : Reinitializing monit =
daemon<br>[2025-04-09T16:21:08+0000] info &nbsp; &nbsp; : Reinitializing =
Monit -- control file '/etc/monit/monitrc'<br>[2025-04-09T16:21:09+0000] =
warning &nbsp;: /etc/monit/conf-enabled/udptunnel:2: Program does not =
exist: '/root/start_udptunnel.sh'<br>[2025-04-09T16:21:09+0000] info =
&nbsp; &nbsp; : '<a href=3D"http://xxxxxxxx.com/">xxxxxxxx.com</a>' =
Monit reloaded<br>[2025-04-09T16:21:20+0000] error &nbsp; &nbsp;: =
'udptunnel' process is not running<br>[2025-04-09T16:21:21+0000] info =
&nbsp; &nbsp; : 'udptunnel' trying to =
restart<br>[2025-04-09T16:21:21+0000] info &nbsp; &nbsp; : 'udptunnel' =
start: '/root/start_udptunnel.sh'<br>[2025-04-09T16:21:21+0000] error =
&nbsp; &nbsp;: 'udptunnel' failed to start (exit status -1) -- Program =
/root/start_udptunnel.sh failed: File '/root/start_udptunnel.sh' does =
not exist</div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br></div><br =
class=3D"gmail-Apple-interchange-newline"></div><div>For the life of me =
I can't figure out why monit says that the script =
doesn't&nbsp;exist.</div><div><br></div><div>I have copied and pasted =
the script name from the log just to make sure there is no =
typo.</div><div><br></div><div>Am I missing something =
obvious?</div><div><br></div><div>Thanks</div></div>
</div></blockquote></div><br></div></body></html>=

--Apple-Mail=_7985D589-D98B-4B66-B1FE-6E3E53AFDC7A--