Koozali.org: home of the SME Server

How to check if services are running after reboot?

Offline holck

  • ****
  • 317
  • +1/-0
How to check if services are running after reboot?
« on: September 13, 2022, 09:57:36 AM »
I have SME10 running as a virtual machine under Proxmox. Unfortunately, sometimes after rebooting the Proxmox host, some of the SME10 services fail to start. I think this is due to some network interfaces, supplied by Proxmox, not being ready when SME10 starts.

I have made a small script to test for this, and start services as necessary:
Code: [Select]
#!/bin/sh
for SERVICE in mailman fail2ban squeezeboxserver nmbd dovecot
do
  if systemctl is-enabled --quiet $SERVICE; then
    echo "$SERVICE is enabled"
  else
    echo "Enabling $SERVICE ..."
    systemctl enable $SERVICE
  fi
  if systemctl is-active --quiet $SERVICE; then
    echo "$SERVICE is running"
  else
    echo "Starting $SERVICE ..."
    systemctl start $SERVICE
  fi
done
Where is the proper way to place this script? I want in to run 30 seconds after SME is started.
......

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: How to check if services are running after reboot?
« Reply #1 on: September 13, 2022, 12:50:41 PM »
proper way is to identify those services and check:

- they are indeed enabled
systemctl status servicename


- what says their unit section. If they really need to have network up then you should see in unit section After=network-online.target
systemct cat servicename


checking the log for the issue might also help

journalctl -u servicename

and

also the service log itself in /var/log

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: How to check if services are running after reboot?
« Reply #2 on: September 13, 2022, 10:16:00 PM »
I think this is due to some network interfaces, supplied by Proxmox, not being ready when SME10 starts.

What makes you think they are not ready? What symptoms?

What spec is the Prox box and the SME VM?

Prox version. SME version.

Run the SME server manager debug so we can see what else you have installed.

You could post the Prox VM config.

Are you over provisioned? Slow server?

A lot of us run SME on a variety of Prox/hardware and I've not seen this so interested to see what the issue is.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline holck

  • ****
  • 317
  • +1/-0
Re: How to check if services are running after reboot?
« Reply #3 on: September 14, 2022, 10:06:32 PM »
Thanks for your comments and questions. Here's an example from dovecot's log, as it tries to start after reboot:
Code: [Select]
Sep 12 22:31:38 sme10 dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
Sep 12 22:35:26 sme10 dovecot: master: Error: bind(192.168.1.11, 110) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 110) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(pop3-login): listen(192.168.1.11, 110) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 995) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(pop3-login): listen(192.168.1.11, 995) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 143) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(imap-login): listen(192.168.1.11, 143) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 993) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(imap-login): listen(192.168.1.11, 993) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Fatal: Failed to start listeners
Sep 12 22:35:27 sme10 dovecot: master: Error: service(pop3-login): listen(192.168.1.11, 110) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: master: Error: bind(192.168.1.11, 995) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: master: Error: service(pop3-login): listen(192.168.1.11, 995) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: master: Error: bind(192.168.1.11, 143) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: master: Error: service(imap-login): listen(192.168.1.11, 143) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: master: Error: bind(192.168.1.11, 993) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: master: Error: service(imap-login): listen(192.168.1.11, 993) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 110) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(pop3-login): listen(192.168.1.11, 110) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 995) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(pop3-login): listen(192.168.1.11, 995) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 143) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(imap-login): listen(192.168.1.11, 143) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: bind(192.168.1.11, 993) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Error: service(imap-login): listen(192.168.1.11, 993) failed: Cannot assign requested address
Sep 12 22:35:27 sme10 dovecot: Fatal: Failed to start listeners
Sep 12 22:35:27 sme10 dovecot: master: Fatal: Failed to start listeners
...
I run SME10 on Proxmox 7.2-7. The VM is allocated 20 GB memory. The hardware is a HP Microserver Gen10 Plus with 32 GB memory. I use ZFS, using 3 mirrored disks, each 1 TB.

I believe my problems with mailman and squeezeboxserver are mostly due to the fact that I haven't found the correct way to enable them across reboots. So each time I restart the server, I seem to need to re-enable them.
......

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: How to check if services are running after reboot?
« Reply #4 on: September 14, 2022, 11:17:59 PM »
Not sure why the services aren't starting but not sure it's what you think it is.

Please post these so we can see what else you have going on.

Code: [Select]
/sbin/e-smith/audittools/newrpms
/sbin/e-smith/audittools/templates

Regarding mailman if you are using the contrib it should just work.

Regarding squeezebox you need to read the wiki on how to use systemd and integrate to SME. There are some tricks you need to learn.

You'll need a confg entry and a systemd template/override at a minimum. Look at how it is done with other services.

Or chat to us on Rocket.....
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: How to check if services are running after reboot?
« Reply #5 on: September 15, 2022, 01:47:15 PM »
I believe my problems with mailman and squeezeboxserver are mostly due to the fact that I haven't found the correct way to enable them across reboots. So each time I restart the server, I seem to need to re-enable them.

These notes might help you figure out how to get mailman and squeezeboxserver to start autmoatically:
https://wiki.koozali.org/KnownProblems#Manualy_install_a_service_on_SME_10_and_newer
https://forums.koozali.org/index.php/topic,54838.msg288340.html#msg288340

Summary:
* You must create an "enabled" service entry for each service in the config db
* If that doesn't solve the problem, you may need a custom template for systemd -> system-preset

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: How to check if services are running after reboot?
« Reply #6 on: September 15, 2022, 02:32:00 PM »
These notes might help you figure out how to get mailman and squeezeboxserver to start autmoatically:

Thanks Mike - I was on mobile and couldn't find those links!!

(As I mentioned, mailman should just work if it is via the contrib)
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: How to check if services are running after reboot?
« Reply #7 on: September 15, 2022, 04:15:32 PM »
question regarding boot and network. any other vm your sme is relying on ?

like a firewall or dhcp?
if yes then you should use the boot order in proxmox to make sure that when sme start booting the prerequesite are already there. 

dovecot can you show
systemctl cat dovecot


for other services and option you have already the answers there.