1

Topic: iredapd doesn't start at boot

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7 MARIADB edition
- Linux/BSD distribution name and version: Debian 9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL (MariaDB)
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Following a fresh install, the issue is simple: the service iredapd doesn't start automatically at boot.
I have to manually start the service thru the command: /usr/bin/python /opt/iredapd/iredapd.py
Nothing in logs... After manually starting the service, I have to restart amavis (I don't know why but I have to do that whereas connection is refused between postfix and amavis).

Thank you!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iredapd doesn't start at boot

How much memory does this server have?

3

Re: iredapd doesn't start at boot

ZhangHuangbin wrote:

How much memory does this server have?

Hi,
First it's a dedicated server (not a vps)
Second:
root@-----:# free -h
              total        used        free      shared  buff/cache   available
Mem:           3,9G        1,1G        658M         38M        2,1G        2,5G
Swap:          2,0G          0B        2,0G

4

Re: iredapd doesn't start at boot

Do then start automatically after running commands below?

systemctl enable iredapd
systemctl enable amavis

Then reboot server and check.

5

Re: iredapd doesn't start at boot

Hi,

root@----:~# systemctl enable iredapd
Failed to enable unit: File iredapd.service: No such file or directory

root@----:~# systemctl enable amavis
amavis.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable amavis

6

Re: iredapd doesn't start at boot

Try to copy file /opt/iredapd/rc_scripts/iredapd.service to /etc/systemd/system/multi*/, then enable iredapd service again.

7

Re: iredapd doesn't start at boot

Hi,

File/link already exists:

root@----:~# ls -lah /etc/systemd/system/multi-user.target.wants/
[...]
lrwxrwxrwx 1 root root   39 févr. 26 20:37 iredapd.service -> /opt/iredapd/rc_scripts/iredapd.service
[...]

root@----:~# cat /etc/systemd/system/multi-user.target.wants/iredapd.service
[Unit]
Description=iRedAPD (A simple posfix policy server)
After=network.target

[Service]
Type=forking
PIDFile=/run/iredapd.pid
ExecStart=/usr/bin/python /opt/iredapd/iredapd.py
KillMode=control-group
KillSignal=SIGQUIT
TimeoutStopSec=5
PrivateTmp=true

[Install]
WantedBy=multi-user.target

8

Re: iredapd doesn't start at boot

Try this:

- Remove file /etc/systemd/system/multi-user.target.wants/iredapd.service
- Link file /opt/iredapd/rc_scripts/iredapd.service to /lib/systemd/system/iredapd.service
- Enable iredapd service and try to start it with systemctl command.

9

Re: iredapd doesn't start at boot

Hi,

root@----:~# rm /etc/systemd/system/multi-user.target.wants/iredapd.service
root@----:~# ln -s /opt/iredapd/rc_scripts/iredapd.service /lib/systemd/system/iredapd.service
root@----:~# systemctl enable iredapd
Created symlink /etc/systemd/system/multi-user.target.wants/iredapd.service → /opt/iredapd/rc_scripts/iredapd.service.
Created symlink /etc/systemd/system/iredapd.service → /opt/iredapd/rc_scripts/iredapd.service.
root@----:~# reboot

Then sad :
root@amac:~# ps faux | grep iredapd
root      1198  0.0  0.0  12784  1016 pts/0    S+   02:40   0:00          \_ grep iredapd

So I have to:
root@----:~# /usr/bin/python /opt/iredapd/iredapd.py
root@----:~# ps faux | grep iredapd
root      1246  0.0  0.0  12784   956 pts/0    S+   02:41   0:00          \_ grep iredapd
iredapd   1204  0.0  0.4  76000 19336 ?        S    02:40   0:00 /usr/bin/python /opt/iredapd/iredapd.py
root@----:~# service amavis restart

10

Re: iredapd doesn't start at boot

No idea right now, need direct ssh access for debugging (it will cost a support ticket).
Or, you can try to reinstall server OS, then install iRedMail.

11 (edited by FHDumay 2018-04-25 00:34:58)

Re: iredapd doesn't start at boot

Hi,
I experienced the same problem, and as a work-around i did the following:
1. Disable the iredapd service (the service does not get triggered anyways):
2. Add an entry to crontab for user root.

systemctl disable iredapd.service
sudo su -
crontab -e 

Add this lines to the end of the file:

## ==============================================================================
## Make sure iredapd service starts, as the service definition seems to be broken
## ==============================================================================
@reboot     /usr/bin/python /opt/iredapd/iredapd.py

Exit the editor (for vi(m), that would be [ESC]:wq)
On the next reboot, the iredapd service will run as expected.

I did not add entries for restarting Amavis, as everything was running as expected.

12

Re: iredapd doesn't start at boot

Question: do you have /opt mounted on, for example, an external disk, a network file system like NFS?

13 (edited by FHDumay 2018-04-25 17:44:10)

Re: iredapd doesn't start at boot

ZhangHuangbin wrote:

Question: do you have /opt mounted on, for example, an external disk, a network file system like NFS?

No, i it is mounted on a local file system. However, it DOES use an LVM volume, although i dd not expect(ed) that this could be the problem. I run this instance of iRedMail on a virtual machine, and apart from this small issue, it works like a charm

What is also interesting is the fact that if you try to start the service

root@mx10 ~ # service iredapd start
Failed to start iredapd.service: Unit iredapd.service not found.
root@mx10 ~ # 

you get a message that the service could not be found - but it DOES exist in /etc/systemd/system/iredapd.service
Then i re-enable the service:

root@mx10 ~ # systemctl enable iredapd
root@mx10 ~ # 

And then i can start the service, as usual:

root@mx10 ~ # service iredapd start
root@mx10 ~ # service iredapd status
● iredapd.service - iRedAPD (A simple posfix policy server)
   Loaded: loaded (/opt/iredapd/rc_scripts/iredapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-04-25 11:20:35 CEST; 13s ago
  Process: 2729 ExecStart=/usr/bin/python /opt/iredapd/iredapd.py (code=exited, status=0/SUCCESS)
 Main PID: 2731 (python)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/iredapd.service
           └─2731 /usr/bin/python /opt/iredapd/iredapd.py

Apr 25 11:20:35 mx10 systemd[1]: Starting iRedAPD (A simple posfix policy server)...
Apr 25 11:20:35 mx10 systemd[1]: Started iRedAPD (A simple posfix policy server).
root@mx10 ~ # 

But as soon as i reboot, i have to repeat the process.
Note: there is no difference in behavior if i use the systemctl instead of the service command directly after a reboot - they both don't seem to work.

If i look at the system log, it seems that shortly after the system starts booting, the service does get triggered:

Apr 25 11:17:18 mx10 systemd[1]: Starting iRedAPD (A simple posfix policy server)...
Apr 25 11:17:19 mx10 systemd[1]: iredapd.service: PID file /run/iredapd.pid not readable (yet?) after start: No such file or directory
Apr 25 11:17:19 mx10 systemd[1]: iredapd.service: Supervising process 2697 which is not our child. We'll most likely not notice when it exits.
Apr 25 11:17:19 mx10 systemd[1]: Started iRedAPD (A simple posfix policy server).

But once i logon, it seems to have ended.

14

Re: iredapd doesn't start at boot

Try this: Open file /etc/systemd/system/iredapd.service, replace the "After=" line by:

After=network.target local-fs.target remote-fs.target

Then reboot server for testing.

You can use a testing virtual machine for this test.

15

Re: iredapd doesn't start at boot

Hi,

Tried that - but no joy - once the server is backup again, the iredapd service is not active (anymore).

16

Re: iredapd doesn't start at boot

Any error in /var/log/syslog (or "messages")? If system tried to start iredapd service, there must be some log.

17

Re: iredapd doesn't start at boot

I'm having this same problem on an Ubuntu 18.04 install.  Two different boxes, same layout and hardware.  I do have /opt/ as its own partition on the same SSD.
I tried the:
After=network.target local-fs.target remote-fs.target
and that did not work. The @reboot int eh cron trick did work.  I did see these in the syslog:

Jun  5 18:11:26 promail01 systemd[1]: Configuration file /opt/iredapd/rc_scripts/iredapd.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.

Thats really all I can find in the syslog. So the only thing I can think of is I installed the ifupdown package in case I wanted old school control of the server.  Otherwise it is vanilla ubuntu 18.04 LTS with all recent updates.

18

Re: iredapd doesn't start at boot

The service seems to be in the wrong place. It's linking /etc/... to /lib/... which is a link to /opt/.... This is what I did to resolve the problem:

rm -f /lib/systemd/system/iredapd.service
cp /opt/iredapd/rc_scripts/iredapd.service /lib/systemd/system
rm -f /etc/systemd/system/multi-user.target.wants/iredapd.service
rm -f /etc/systemd/system/iredapd.service
systemctl enable iredapd

But if you're really hard up to get it fixed, just disable the service and add the crontab entry. It's clunky but it works.

19

Re: iredapd doesn't start at boot

NoOneYouKnow wrote:

rm -f /lib/systemd/system/iredapd.service
cp /opt/iredapd/rc_scripts/iredapd.service /lib/systemd/system
rm -f /etc/systemd/system/multi-user.target.wants/iredapd.service
rm -f /etc/systemd/system/iredapd.service
systemctl enable iredapd

This is exactly how/what iRedMail does to enable iredapd service.

20

Re: iredapd doesn't start at boot

ZhangHuangbin wrote:
NoOneYouKnow wrote:

rm -f /lib/systemd/system/iredapd.service
cp /opt/iredapd/rc_scripts/iredapd.service /lib/systemd/system
rm -f /etc/systemd/system/multi-user.target.wants/iredapd.service
rm -f /etc/systemd/system/iredapd.service
systemctl enable iredapd

This is exactly how/what iRedMail does to enable iredapd service.

I have build a VM (VMWARE) using Ubuntu 18.04.1. The second "disk" was made in to a Volume Group (vg00) and /opt is a logical volume of vg00.

I repeated the steps that NoOneYouKnow supplied and it worked perfectly!!! Thanks!!

Greg