annomatik
Posts: 15
Joined: Wed Aug 15, 2018 9:34 am

systemd failed

Mon Sep 17, 2018 1:13 pm

Hi! when I start "systemctl status", it shows me "Status: degraded". According to the internet, the failed services can be seen with "systemctl status --failed", which results in the following output:

Code: Select all

# systemctl --failed
  UNIT                         LOAD   ACTIVE SUB    DESCRIPTION
● rc-local.service             loaded failed failed /etc/rc.local Compatibility
● systemd-modules-load.service loaded failed failed Load Kernel Modules

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
#
How can I investigate this further? How can I find out, what prevents rc-local and systemd-modules-load from being active / running?

Also, on a related note, is there an easy way of getting *only* the failed units (e.g. "rc-local, systemd-modules-load"), without the other text, so I can send it to my monitoring in an useful way? Grepping for the "*" maybe?

Thanks!

epoch1970
Posts: 2019
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: systemd failed

Tue Sep 18, 2018 7:28 pm

Did you add something to rc.local? It is a script, you can run it from the command line to check why it fails.
If the module loading error is not cascading from that, please provide more information about what you added to the system.
Or your SD card is the root cause, as per your other post.

Systemd comes with its own logging system, journald. You can use the journalctl command to see error traces.
https://wiki.archlinux.org/index.php/Sy ... emd_errors
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

annomatik
Posts: 15
Joined: Wed Aug 15, 2018 9:34 am

Re: systemd failed

Tue Sep 18, 2018 11:02 pm

Hi, yes, I added two "mount" commands and the start command for the Pandora FMS agent ( https://pandorafms.com ).

Running rc.local manually, it seems to work fine, except it does not want to start the Pandora FMS agent again. Also, the Pandora FMS agent does not start during a reboot, even I put the startup command into the rc.local -- I have to start it manually, which is not very nice. Could this be, why systemd failed, because it cannot start my monitoring agent?

Will look into the journal, thanks.

DirkS
Posts: 9058
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: systemd failed

Wed Sep 19, 2018 8:51 am

annomatik wrote:
Tue Sep 18, 2018 11:02 pm
Hi, yes, I added two "mount" commands and the start command for the Pandora FMS agent ( https://pandorafms.com ).

Running rc.local manually, it seems to work fine, except it does not want to start the Pandora FMS agent again. Also, the Pandora FMS agent does not start during a reboot, even I put the startup command into the rc.local -- I have to start it manually, which is not very nice. Could this be, why systemd failed, because it cannot start my monitoring agent?
Did you put the commands in rc.local before or after 'exit 0'?
They must be *before* the exit otherwise rc.local (and probably systemd) will fail.
The 'exit 0' makes sure that it never fails.

User avatar
RaTTuS
Posts: 10086
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: systemd failed

Wed Sep 19, 2018 8:55 am

don't put mount commands in rc.lcoal - use the systemd.service system for mounting things after the network has come up
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

annomatik
Posts: 15
Joined: Wed Aug 15, 2018 9:34 am

Re: systemd failed

Wed Sep 19, 2018 9:11 am

of course before the exit 0 *lol*

So, if a script isn't started in rc.local, how can I debug that? The mounts should happen automatically, but for some reason, they didn't, so I put them into the rc.local.

DirkS
Posts: 9058
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: systemd failed

Wed Sep 19, 2018 9:32 am

annomatik wrote:
Wed Sep 19, 2018 9:11 am
of course before the exit 0 *lol*
Don't assume anything when troubleshooting. You'll miss the obvious one...
The error message says rc.local failed and that is the most likely cause.

Maybe you can post your rc.local here.
Last edited by DirkS on Wed Sep 19, 2018 9:37 am, edited 1 time in total.

annomatik
Posts: 15
Joined: Wed Aug 15, 2018 9:34 am

Re: systemd failed

Wed Sep 19, 2018 10:28 pm

Sure. Here it is:

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi


/etc/init.d/pandora_agent_daemon start


exit 0
Also, I tried to enable the journal. There's now a binary written into /var/log/journal/<long directory name> -- how can I read it?

Thanks!

DirkS
Posts: 9058
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: systemd failed

Wed Sep 19, 2018 10:34 pm

That pandora thing looks like something that should not be started in rc.local but as a service.

If it's a systemd journal try 'journalctl'. See e.g. https://www.digitalocean.com/community/ ... stemd-logs
You may need to run it with admin permissions (sudo)

epoch1970
Posts: 2019
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: systemd failed

Thu Sep 20, 2018 8:56 am

annomatik wrote:
Wed Sep 19, 2018 10:28 pm
Sure. Here it is:

Code: Select all

#!/bin/sh -e
#
# rc.local
...
/etc/init.d/pandora_agent_daemon start
...
exit 0
That is not correct.
rc.local is intended for ancillary tasks, you're not supposed to manipulate the init system (i.e. run /etc/init.d/ or systemctl or service ... start) from there.

First, remove this line from rc.local.
Then try "sudo systemctl enable pandora_agent_daemon". If the system is happy, reboot and see if the service gets started.

If enabling the script fails, or if the service doesn't start, you might need to look into the /etc/init.d/pandora_agent_daemon file, see what it actually does, and create a native systemd service unit file as a replacement.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Raspbian”

Who is online

Users browsing this forum: No registered users and 20 guests