Services Not Starting Despite Having Them Enabled

I have a server running Leap 42.2 and when I boot the server it does not start mysql (mariadb) or apache2 despite the fact the services are enabled using systemctl enable mysql and systemctrl enable apache2. I have to start them manually and I cannot figure out why. I am not real familiar with SystemD and I am guessing the problem is somewhere in there. What do I need to do to get these services to start properly in multiuser mode? Thanks for any help I can get here.

Please post the output of;

systemctl status mysql
systemctl status apache2

and pastebin (use https://paste.opensuse.org/ ) of; journalctl -r -u mysql.service --since "48h ago"
and same for apache.service

Only post the first few dozen lines with the errors (if there are any) - no need to post the entire thing :slight_smile:

I did that and it is at https://paste.opensuse.org/6021582.

I included the whole thing as I do not see any errors and it looks like I am only seeing the manual start done after the boot. It acts like the services are not enabled. But maybe I am missing something obvious here…

According to your output both services are started. What makes you believe they are not?

I manually started them after reboot. They did not automatically start. That is the issue I am trying to resolve. Currently I am baffled.

Are you using Wicked or NetworkManager? All updates installed, naturally?

Then please provide the same output before starting them manually, immediately after boot. Also full output of “journalctl -b” please.

Using Wicked. Updates all installed.

Ok, I’m an idiot. The services are starting fine when I check using systemctl, but monit was reporting they were not started immediately (I was checking too soon). On top of that, I have several programs which start up using old System V Init scripts and they were trying to start before mysql was up and it was leaving the system looking like a total mess. So I guess I need to convert these old startup scripts to SystemD and figure out how to have them start after mysql is up.

Well, thanks for pointing me at the right things to look at as I was totally baffled as to what was happening, but using systemctl and journalctl showed me where the problems were occurring.

You can take a peek at /usr/lib/systemd/system/mysql.service for an example how to write a systemd service file (as well as many resources online) - they’re super easy to write and best of all, you can have systemd keep the services up even they crash for some reason ( Restart=on-failure is your friend :slight_smile: )

Remember to systemctl daemon-reload if you insert new .service files or modify existing ones.