Page 1 of 1

zoneminder.service: Failed with result 'exit-code'

Posted: Tue May 05, 2020 7:20 am
by gruiarew
Hi Guys,

First of all thanks for this amazing piece of software.

Sorry if was already discussed, first post here. I have already searched the forums but found nothing similar. I have a new installation of 1.34.9 updated lately to 1.34.10 on a Debian 10.3.

System works, I have all monitors running fine, recording, motion detection, all fine.

But I'm seeing all the times in logs every 10 seconds this:

Code: Select all

May  5 10:07:10 zone systemd[1]: zoneminder.service: Service RestartSec=10s expired, scheduling restart.
May  5 10:07:10 zone systemd[1]: zoneminder.service: Scheduled restart job, restart counter is at 6021.
May  5 10:07:10 zone systemd[1]: Stopped ZoneMinder CCTV recording and surveillance system.
May  5 10:07:10 zone systemd[1]: Starting ZoneMinder CCTV recording and surveillance system...
May  5 10:07:10 zone systemd[1]: Started Session c12065 of user www-data.
May  5 10:07:10 zone systemd[1]: session-c12065.scope: Succeeded.
May  5 10:07:10 zone systemd[1]: Started Session c12066 of user www-data.
May  5 10:07:11 zone systemd[1]: session-c12066.scope: Succeeded.
May  5 10:07:11 zone systemd[1]: zoneminder.service: Control process exited, code=exited, status=1/FAILURE
May  5 10:07:11 zone systemd[1]: zoneminder.service: Failed with result 'exit-code'.
May  5 10:07:11 zone systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.
Trying to find out what is wrong basically says nothing:

Code: Select all

root@zone:~# systemctl status zoneminder
● zoneminder.service - ZoneMinder CCTV recording and surveillance system
   Loaded: loaded (/lib/systemd/system/zoneminder.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2020-05-05 10:14:42 EEST; 8s ago
  Process: 3098 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=1/FAILURE)

May 05 10:14:42 zone systemd[1]: zoneminder.service: Control process exited, code=exited, status=1/FAILURE
May 05 10:14:42 zone systemd[1]: zoneminder.service: Failed with result 'exit-code'.
May 05 10:14:42 zone systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.

Code: Select all

May 05 10:16:16 zone su[3250]: (to www-data) root on none
May 05 10:16:16 zone su[3250]: pam_unix(su:session): session opened for user www-data by (uid=0)
May 05 10:16:16 zone systemd[1]: session-c12169.scope: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit session-c12169.scope has successfully entered the 'dead' state.
May 05 10:16:16 zone systemd[1]: Started Session c12170 of user www-data.
-- Subject: A start job for unit session-c12170.scope has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit session-c12170.scope has finished successfully.
--
-- The job identifier is 1146589.
May 05 10:16:17 zone su[3250]: pam_unix(su:session): session closed for user www-data
May 05 10:16:17 zone systemd[1]: zoneminder.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit zoneminder.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
May 05 10:16:17 zone systemd[1]: zoneminder.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit zoneminder.service has entered the 'failed' state with result 'exit-code'.
May 05 10:16:17 zone systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.
-- Subject: A start job for unit zoneminder.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
Strangely enough running it by hand:

Code: Select all

root@zone:~# /usr/bin/zmpkg.pl status
05/05/2020 10:17:51.537340 zmpkg[3391].INF [main:310] [Sanity checking States table...]
05/05/2020 10:17:51.537758 zmpkg[3391].INF [main:95] [Command: status]
running
I believe I failed to install properly the service but I'm unable t find out what I did wrong. Any idea will be more than appreciated.

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Tue May 05, 2020 7:37 am
by gruiarew
Ok, that was stupid, sorry about that.

In "/lib/systemd/system/zoneminder.service" had

#User=www-data

Changed it to:
User=www-data

And now seems fine.

zoneminder.service: will not start!

Posted: Sat Aug 08, 2020 11:02 am
by sarge
I'm glad your zm is fixed and you're able to run it. I have the same issue you did, but the cause is apparently different because my zoneminder.service already has User=www-data. I just installed zm version 1.32.3-2ubuntu2 from my repository. I'm running Kubuntu 20.04LTS.

Code: Select all

mark@AMD-64:~$ systemctl status zoneminder.service
● zoneminder.service - ZoneMinder CCTV recording and surveillance system
     Loaded: loaded (/lib/systemd/system/zoneminder.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2020-08-08 05:48:56 CDT; 38s ago
       Docs: http://zoneminder.readthedocs.org/en/latest/
    Process: 56699 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=255/EXCEPTION)

Aug 08 05:48:56 AMD-64 zmpkg.pl[56699]: DBI connect('database=;host=','',...) failed: Access denied for user 'www-data'@'localhost' (using password: NO) at /usr/share/perl5/ZoneMinder/Config.pm line>
Aug 08 05:48:56 AMD-64 zmpkg.pl[56699]: Can't connect to db at /usr/share/perl5/ZoneMinder/Config.pm line 166.
Aug 08 05:48:56 AMD-64 zmpkg.pl[56699]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 166.
Aug 08 05:48:56 AMD-64 zmpkg.pl[56699]: Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.
Aug 08 05:48:56 AMD-64 zmpkg.pl[56699]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.
Aug 08 05:48:56 AMD-64 zmpkg.pl[56699]: Compilation failed in require at /usr/bin/zmpkg.pl line 34.
Aug 08 05:48:56 AMD-64 zmpkg.pl[56699]: BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 34.
Aug 08 05:48:56 AMD-64 systemd[1]: zoneminder.service: Control process exited, code=exited, status=255/EXCEPTION
Aug 08 05:48:56 AMD-64 systemd[1]: zoneminder.service: Failed with result 'exit-code'.
Aug 08 05:48:56 AMD-64 systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.
Any help would be greatly appreciated.

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Sat Aug 08, 2020 11:48 am
by sarge
Allow me to start again for my 2nd post.

I installed v 1.32 from the Kubuntu 20.04LTS repository, NOT 1.34. I have since upgraded to v 1.34.18 and the same error occurred in the config file with a hashtag in front of 'User=www-data'. I corrected that install issue and now have a new issue:

Code: Select all

mark@AMD-64:~$ systemctl status zoneminder.service
● zoneminder.service - ZoneMinder CCTV recording and surveillance system
     Loaded: loaded (/lib/systemd/system/zoneminder.service; disabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2020-08-08 06:47:20 CDT; 3s ago
    Process: 156420 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=255/EXCEPTION)

Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: Compilation failed in require at /usr/bin/zmpkg.pl line 34.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 34.
Aug 08 06:47:20 AMD-64 systemd[1]: zoneminder.service: Control process exited, code=exited, status=255/EXCEPTION
Aug 08 06:47:20 AMD-64 zmpkg[156420]: ERR [Error reconnecting to db: errstr:Access denied for user 'www-data'@'localhost' (using password: NO) error val:]
Aug 08 06:47:20 AMD-64 systemd[1]: zoneminder.service: Failed with result 'exit-code'.
Aug 08 06:47:20 AMD-64 systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.
Any help would be greatly appreciated.

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Sat Aug 08, 2020 2:21 pm
by bbunge
sarge wrote: Sat Aug 08, 2020 11:48 am Allow me to start again for my 2nd post.

I installed v 1.32 from the Kubuntu 20.04LTS repository, NOT 1.34. I have since upgraded to v 1.34.18 and the same error occurred in the config file with a hashtag in front of 'User=www-data'. I corrected that install issue and now have a new issue:

Code: Select all

mark@AMD-64:~$ systemctl status zoneminder.service
● zoneminder.service - ZoneMinder CCTV recording and surveillance system
     Loaded: loaded (/lib/systemd/system/zoneminder.service; disabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2020-08-08 06:47:20 CDT; 3s ago
    Process: 156420 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=255/EXCEPTION)

Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: Compilation failed in require at /usr/bin/zmpkg.pl line 34.
Aug 08 06:47:20 AMD-64 zmpkg.pl[156420]: BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 34.
Aug 08 06:47:20 AMD-64 systemd[1]: zoneminder.service: Control process exited, code=exited, status=255/EXCEPTION
Aug 08 06:47:20 AMD-64 zmpkg[156420]: ERR [Error reconnecting to db: errstr:Access denied for user 'www-data'@'localhost' (using password: NO) error val:]
Aug 08 06:47:20 AMD-64 systemd[1]: zoneminder.service: Failed with result 'exit-code'.
Aug 08 06:47:20 AMD-64 systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.
Any help would be greatly appreciated.
You are better off to start over and install Zoneminder from the PPA. I have never been able to get the version on the Ubuntu repository to work.
My recommendation is to use these install procedures:https://wiki.zoneminder.com/Ubuntu_Serv ... der_1.34.x

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Sat Aug 08, 2020 2:35 pm
by iconnor
It seems to be connecting using the user www-data. While zm runs as www-data, it gets it's db credentials from /etc/zm/zm.conf. Look there.

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Sat Aug 08, 2020 4:15 pm
by sarge
Thank you iconner. I did install 1.34 via ppa. I'll take a look at /etc/zm/zm.config and see if there's anything obvious. Thx again.

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Thu Oct 22, 2020 3:45 pm
by ginbosqueeze
Hello all, help would be greatly appreciated.

I've scoured the internet and this is the only forum that's close to the issue I'm having.

Conner, I am trying to understand what you're meaning about www-data, but I have installed on a fresh Debian 10.6 using your 1.34x Zoneminder installation guide.

I am receiving when i run journalctl -xe:

-- An ExecStart= process belonging to unit zoneminder.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Oct 22 11:43:22 fortress systemd[1]: zoneminder.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit zoneminder.service has entered the 'failed' state with result 'exit-code'.
Oct 22 11:43:22 fortress systemd[1]: Failed to start ZoneMinder CCTV recording and surveillance system.
-- Subject: A start job for unit zoneminder.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit zoneminder.service has finished with a failure.
--
-- The job identifier is 35307 and the job result is failed.
Oct 22 11:43:32 fortress systemd[1]: zoneminder.service: Service RestartSec=10s expired, scheduling restart.
Oct 22 11:43:32 fortress systemd[1]: zoneminder.service: Scheduled restart job, restart counter is at 493.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Automatic restarting of the unit zoneminder.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Oct 22 11:43:32 fortress systemd[1]: Stopped ZoneMinder CCTV recording and surveillance system.
-- Subject: A stop job for unit zoneminder.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A stop job for unit zoneminder.service has finished.
--
-- The job identifier is 35427 and the job result is done.
Oct 22 11:43:32 fortress systemd[1]: Starting ZoneMinder CCTV recording and surveillance system...
-- Subject: A start job for unit zoneminder.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit zoneminder.service has begun execution.
--
-- The job identifier is 35427.
Oct 22 11:43:32 fortress zmpkg[10319]: INF [Sanity checking States table...]
Oct 22 11:43:32 fortress zmpkg[10319]: INF [Command: start]







and when i run systemctl status zoneminder i get:

● zoneminder.service - ZoneMinder CCTV recording and surveillance system
Loaded: loaded (/lib/systemd/system/zoneminder.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2020-10-22 11:44:26 EDT; 6s ago
Process: 10363 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=1/FAILURE)


Please help as I would love to have ZM working on Buster and be able to use ZM Ninja (was having stability issues on Stretch with ZM Ninja and I'm hoping Buster fixes all my issues)

Thanks

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Fri Oct 23, 2020 1:10 am
by burger
The new install steps automate some of the preinstall and postinstall steps which used to be manual. See /var/lib/dpkg/ folder and find . print | grep -i zoneminder where the postinst scripts are. Sometimes these can fail (e.g. mysql not running).

The wiki has some of these steps. Review older Debian vers posts in https://wiki.zoneminder.com/Debian

The install guides for all releases do similar things, so try reviewing the other ones to get an understanding of what is being done during install.

On a fresh install of Debian, this should not be an issue.

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Wed May 05, 2021 7:03 am
by alarmix
The issue is still present in the current debian buster package!
Removing the # from User=www-data in the systemd unit file is fixing it!

Re: zoneminder.service: Failed with result 'exit-code'

Posted: Mon Mar 13, 2023 7:47 pm
by madracer
Hey guys,

I was fighting with this thing for few days, everything was running ok, cameras recording etc only that zoneminder service was restarting every 10sec. I started having this after upgrade from 1.34 to 1.36 from ZM repo.
Indeed was the # at the User=www-data in the /lib/systemd/system/zoneminder.service.
Strange thing was that after editing this file it was not taken into effect and still failing after restarting zoneminder service and also not even after systemctl daemon-reload, so make sure you reboot your container/VM after this change and it should fix this.

Cheers!