Cacti service failed to start.

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
bogdan
Posts: 5
Joined: Sun Dec 01, 2024 4:53 am

Cacti service failed to start.

Post by bogdan »

Hello team,

I am a new in Cacti. I tried to install Cacti following this article https://docs.cacti.net/Installing-Under ... units-file but when I try to start service using command "systemctl start cactid" I getting below error:

Job for cactid.service failed because the control process exited with error code.
See "systemctl status cactid.service" and "journalctl -xeu cactid.service" for details.


In output of systemctl status cactid.service I see below:

Job for cactid.service failed because the control process exited with error code.
See "systemctl status cactid.service" and "journalctl -xeu cactid.service" for details.
bogdan@cacti:/var/www/html/cacti$ systemctl status cactid.service
● cactid.service - Cacti Daemon Main Poller Service
Loaded: loaded (/etc/systemd/system/cactid.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2024-12-01 10:03:29 UTC; 2s ago
Process: 4546 ExecStart=/var/www/html/cacti/cactid.php (code=exited, status=217/USER)
CPU: 3ms

Dec 01 10:03:29 cacti systemd[1]: cactid.service: Control process exited, code=exited, status=217/USER
Dec 01 10:03:29 cacti systemd[1]: cactid.service: Failed with result 'exit-code'.
Dec 01 10:03:29 cacti systemd[1]: Failed to start Cacti Daemon Main Poller Service.



In output of journalctl -xeu cactid.service I see this:

Dec 01 10:03:50 cacti systemd[4552]: cactid.service: Failed to determine user credentials: No such process
Dec 01 10:03:50 cacti systemd[4552]: cactid.service: Failed at step USER spawning /var/www/html/cacti/cactid.php: No such>
░░ Subject: Process /var/www/html/cacti/cactid.php could not be executed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The process /var/www/html/cacti/cactid.php could not be executed and failed.
░░
░░ The error number returned by this process is ERRNO.
Dec 01 10:03:50 cacti systemd[1]: cactid.service: Control process exited, code=exited, status=217/USER
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit cactid.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 217.
Dec 01 10:03:50 cacti systemd[1]: cactid.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit cactid.service has entered the 'failed' state with result 'exit-code'.
Dec 01 10:03:50 cacti systemd[1]: Failed to start Cacti Daemon Main Poller Service.
░░ Subject: A start job for unit cactid.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit cactid.service has finished with a failure.
░░
░░ The job identifier is 119152 and the job result is failed.



I tried to follow this artticle https://github.com/Cacti/cacti/commit/9 ... e6b2eb7077 but used username "www-data" instead of username from artcile becasue I do not have such user in system. By the way I found this video https://www.youtube.com/watch?v=Ggpwvd2GV1E where username "www-data" is used. Unfortunately steps in article or video did not help me.

Please advice how to troubleshoot this?

Thanks.
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Cacti service failed to start.

Post by TheWitness »

Edit the cactid.service file in /etc/system/systemd and change the user to the correct user, I think www-data, then perform a systemctl daemon-reload followed by systemctl start cactid. Make sure that the entire Cacti website is owned by www-data.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
bogdan
Posts: 5
Joined: Sun Dec 01, 2024 4:53 am

Re: Cacti service failed to start.

Post by bogdan »

TheWitness wrote: Sun Dec 01, 2024 4:24 pm Edit the cactid.service file in /etc/system/systemd and change the user to the correct user, I think www-data, then perform a systemctl daemon-reload followed by systemctl start cactid. Make sure that the entire Cacti website is owned by www-data.
Hello,

Thanks for the reply.

I do not have such folder /etc/system/systemd, but I have service in this folder /var/www/html/cacti/service/cactid.service.

cactid.service file already have correct user. Below what I have in the file:

[Unit]
Description=Cacti Daemon Main Poller Service
After=network.target

[Service]
Type=forking
User=www-data
Group=www-data
EnvironmentFile=/etc/cactid
ExecStart=/var/www/html/cacti/cactid.php
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target



Could you please advice what you mean about "Make sure that the entire Cacti website is owned by www-data"? Where I can check it?

Thanks in advance.
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Cacti service failed to start.

Post by macan »

ls -al /var/www/html/cacti
You check second and third columns. It is user and group (it should be www-data in your case)
Let the Cacti grow!
bogdan
Posts: 5
Joined: Sun Dec 01, 2024 4:53 am

Re: Cacti service failed to start.

Post by bogdan »

macan wrote: Mon Dec 02, 2024 2:45 am ls -al /var/www/html/cacti
You check second and third columns. It is user and group (it should be www-data in your case)
Thanks for the quick reply.

I see that all files owned by another user. Please see below part of the output:

total 2868
drwxrwxr-x 22 bogdan bogdan 4096 Dec 1 07:41 .
drwxr-xr-x 3 root root 4096 Dec 1 07:41 ..
-rw-rw-r-- 1 bogdan bogdan 5669 Dec 1 07:41 about.php
-rw-rw-r-- 1 bogdan bogdan 60883 Dec 1 07:41 aggregate_graphs.php
-rw-rw-r-- 1 bogdan bogdan 25710 Dec 1 07:41 aggregate_templates.php
-rw-rw-r-- 1 bogdan bogdan 16829 Dec 1 07:41 auth_changepassword.php
-rw-rw-r-- 1 bogdan bogdan 15290 Dec 1 07:41 auth_login.php
-rw-rw-r-- 1 bogdan bogdan 19161 Dec 1 07:41 auth_profile.php
-rw-rw-r-- 1 bogdan bogdan 24203 Dec 1 07:41 automation_devices.php
-rw-rw-r-- 1 bogdan bogdan 36742 Dec 1 07:41 automation_graph_rules.php
-rw-rw-r-- 1 bogdan bogdan 42639 Dec 1 07:41 automation_networks.php
-rw-rw-r-- 1 bogdan bogdan 31747 Dec 1 07:41 automation_snmp.php
-rw-rw-r-- 1 bogdan bogdan 18785 Dec 1 07:41 automation_templates.php
-rw-rw-r-- 1 bogdan bogdan 38723 Dec 1 07:41 automation_tree_rules.php
drwxrwxr-x 6 bogdan bogdan 4096 Dec 1 07:41 cache
-rwxrwxr-x 1 bogdan bogdan 7218 Dec 1 07:41 cactid.php



So in this case I have to change ownership for /var/www/html/cacti to www-data right?
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Cacti service failed to start.

Post by macan »

if www-data is your webserver user, then yes
Let the Cacti grow!
bogdan
Posts: 5
Joined: Sun Dec 01, 2024 4:53 am

Re: Cacti service failed to start.

Post by bogdan »

macan wrote: Mon Dec 02, 2024 4:45 am if www-data is your webserver user, then yes
I tried to do that. Now I have changed ownership:

bogdan@cacti:/var/www/html/cacti$ ls -al /var/www/html/cacti
total 2868
drwxrwxr-x 22 www-data www-data 4096 Dec 1 07:41 .
drwxr-xr-x 3 root root 4096 Dec 1 07:41 ..
-rw-rw-r-- 1 www-data www-data 5669 Dec 1 07:41 about.php
-rw-rw-r-- 1 www-data www-data 60883 Dec 1 07:41 aggregate_graphs.php
-rw-rw-r-- 1 www-data www-data 25710 Dec 1 07:41 aggregate_templates.php
-rw-rw-r-- 1 www-data www-data 16829 Dec 1 07:41 auth_changepassword.php
-rw-rw-r-- 1 www-data www-data 15290 Dec 1 07:41 auth_login.php
-rw-rw-r-- 1 www-data www-data 19161 Dec 1 07:41 auth_profile.php
-rw-rw-r-- 1 www-data www-data 24203 Dec 1 07:41 automation_devices.php
-rw-rw-r-- 1 www-data www-data 36742 Dec 1 07:41 automation_graph_rules.php



I ran commands systemctl daemon-reload and systemctl start cactid but still service failed to start.

Output from systemctl status cactid.service


bogdan@cacti:/var/www/html/cacti$ systemctl status cactid.service
● cactid.service - Cacti Daemon Main Poller Service
Loaded: loaded (/etc/systemd/system/cactid.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2024-12-02 09:56:01 UTC; 1s ago
Process: 11982 ExecStart=/var/www/html/cacti/cactid.php (code=exited, status=217/USER)
CPU: 5ms

Dec 02 09:56:01 cacti systemd[1]: cactid.service: Control process exited, code=exited, status=217/USER
Dec 02 09:56:01 cacti systemd[1]: cactid.service: Failed with result 'exit-code'.
Dec 02 09:56:01 cacti systemd[1]: Failed to start Cacti Daemon Main Poller Service.


Output from journalctl -xeu cactid.service:

A start job for unit cactid.service has finished with a failure.
░░
░░ The job identifier is 625609 and the job result is failed.
Dec 02 09:56:12 cacti systemd[1]: cactid.service: Scheduled restart job, restart counter is at 7209.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ Automatic restarting of the unit cactid.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Dec 02 09:56:12 cacti systemd[1]: Stopped Cacti Daemon Main Poller Service.
░░ Subject: A stop job for unit cactid.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A stop job for unit cactid.service has finished.
░░
░░ The job identifier is 625695 and the job result is done.
Dec 02 09:56:12 cacti systemd[1]: Starting Cacti Daemon Main Poller Service...
░░ Subject: A start job for unit cactid.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit cactid.service has begun execution.
░░
░░ The job identifier is 625695.
Dec 02 09:56:12 cacti systemd[1]: cactid.service: Control process exited, code=exited, status=217/USER
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit cactid.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 217.
Dec 02 09:56:12 cacti systemd[1]: cactid.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit cactid.service has entered the 'failed' state with result 'exit-code'.
Dec 02 09:56:12 cacti systemd[1]: Failed to start Cacti Daemon Main Poller Service.
░░ Subject: A start job for unit cactid.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit cactid.service has finished with a failure.
░░
░░ The job identifier is 625695 and the job result is failed.



Could you please advice what else I can check here?

Thanks in advance.
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Cacti service failed to start.

Post by TheWitness »

As the web site user start it by hand this way

Code: Select all

php -q -d display_errors=on ./cactid.php
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
bogdan
Posts: 5
Joined: Sun Dec 01, 2024 4:53 am

Re: Cacti service failed to start.

Post by bogdan »

TheWitness wrote: Mon Dec 02, 2024 8:28 am As the web site user start it by hand this way

Code: Select all

php -q -d display_errors=on ./cactid.php
When I run php -q -d display_errors=on ./cactid.php I getting below error:


FATAL: Connection to Cacti database failed. Please ensure:

- the PHP MySQL module is installed and enabled.
- the database is running.
- the credentials in config.php are valid.



I tried to check PHP and looks loke it is running:

bogdan@cacti:/var/www/html/cacti$ php -v
PHP 8.3.14 (cli) (built: Nov 25 2024 18:07:16) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.14, Copyright (c) Zend Technologies
with Zend OPcache v8.3.14, Copyright (c), by Zend Technologies
bogdan@cacti:/var/www/html/cacti$ ps -aux | grep php
bogdan 21853 0.0 0.1 6480 2304 pts/0 S+ 18:25 0:00 grep --color=auto php



The Database is running. I can logging to DB:

bogdan@cacti:/var/www/html/cacti$ sudo mysql -u root -p
[sudo] password for bogdan:
Sorry, try again.
[sudo] password for bogdan:
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 50
Server version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>



I found config.php in this folder /var/www/html/cacti/include/

Here is part of the config.php file where there is credentials:


$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'cactiuser';
$database_port = '3306';
$database_retries = 5;
$database_ssl = false;
$database_ssl_key = '';
$database_ssl_cert = '';
$database_ssl_ca = '';
$database_persist = false;



I found that I can open DB with command sudo mysql -u root -p -h localhost cacti

But I cannot if use cactiuser from config.php file

Also I tried change username and password to root username and password - this did not help me.

Could you please advice what I am doing wrong?

Thanks.
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Cacti service failed to start.

Post by TheWitness »

Follow the installation instructions on Cacti.net.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest