1

Topic: Update iRedAPD-2.7 - service failed

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9 MARIADB edition
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version: Ubuntu 18.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- 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.
====

After receiving the mail informing us that iRedAPD-2.7 had been released, I followed this link (https://forum.iredmail.org/topic15488-i … eased.html) and then followed these (https://docs.iredmail.org/upgrade.iredapd.html) instructions, but unfortunately received the following:

--------------------------------------
root@mail:~/iRedAPD-2.7/tools# bash upgrade_iredapd.sh
* Detected Linux/BSD distribution: UBUNTU
* Found iRedAPD directory: /opt/iredapd, symbol link of iRedAPD-2.4
* Found iRedAPD config file: /opt/iredapd/settings.py
* Add new SQL tables - if there's any
* Checking dependent Python modules:
  + [required] python-sqlalchemy
  + [required] dnspython
* Create directory /opt/iRedAPD-2.7.
* Copying new version to /opt/iRedAPD-2.7
* Copy old config file: settings.py (/opt/iredapd/settings.py -> /opt/iRedAPD-2.7/settings.py)
* Copy custom plugins: iRedAPD-2.4/plugins/custom_*.py.
* Set correct owner and permission for /opt/iRedAPD-2.7: root:root, 0500.
* Set permission for iRedAPD config file: /opt/iRedAPD-2.7/settings.py -> 0400.
* Re-create symbol link: /opt/iredapd -> /opt/iRedAPD-2.7
* Remove existing systemd service files.
* Copy systemd service file: /opt/iredapd/rc_scripts/iredapd.service -> /lib/systemd/system/iredapd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/iredapd.service → /lib/systemd/system/iredapd.service.
* Remove deprecated plugins.
* Rename old plugins.
* Remove all *.pyc files.
* Restarting iRedAPD service.
Job for iredapd.service failed because the control process exited with error code.
See "systemctl status iredapd.service" and "journalctl -xe" for details.
Failed, please restart iRedAPD service manually.
* Upgrade completed.

< NOTE > If iRedAPD doesn't work as expected, please post your issue in our
< NOTE > online support forum: http://www.iredmail.org/forum/
< NOTE >
< NOTE > * Turn on debug mode: http://www.iredmail.org/docs/debug.iredapd.html
< NOTE > * iRedAPD log file is /var/log/iredapd/iredapd.log.

root@mail:~/iRedAPD-2.7/tools#
--------------------------------------

Followed by this:
--------------------------------------
root@mail:~# systemctl status iredapd.service
● iredapd.service - iRedAPD (A simple posfix policy server)
   Loaded: loaded (/lib/systemd/system/iredapd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-04-04 08:45:32 BST; 19min ago
  Process: 2995 ExecStart=/usr/bin/python2 /opt/iredapd/iredapd.py (code=exited, status=1/FAILURE)

Apr 04 08:45:32 mail python2[2995]: iredapd INFO: Loading plugin (priority: 40): amavisd_wblist
Apr 04 08:45:32 mail python2[2995]: Traceback (most recent call last):
Apr 04 08:45:32 mail python2[2995]:   File "/opt/iredapd/iredapd.py", line 111, in <module>
Apr 04 08:45:32 mail python2[2995]:     main()
Apr 04 08:45:32 mail python2[2995]:   File "/opt/iredapd/iredapd.py", line 49, in main
Apr 04 08:45:32 mail python2[2995]:     if (settings.srs_secrets and settings.srs_domain):
Apr 04 08:45:32 mail python2[2995]: AttributeError: 'module' object has no attribute 'srs_secrets'
Apr 04 08:45:32 mail systemd[1]: iredapd.service: Control process exited, code=exited status=1
Apr 04 08:45:32 mail systemd[1]: iredapd.service: Failed with result 'exit-code'.
Apr 04 08:45:32 mail systemd[1]: Failed to start iRedAPD (A simple posfix policy server).
root@mail:~#

--------------------------------------

I'm not sure where to set 'settings.srs_secrets' or indeed what its value should be.

Would appreciate any help.

Many thanks!

----

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

2

Re: Update iRedAPD-2.7 - service failed

Please add parameter "srs_secrets =" in /opt/iredapd/settings.py like this:

srs_secrets = ["48ebdd35c362eb11c56dcb4c7ead9554"]

You should replace "48ebdd35c362eb11c56dcb4c7ead9554" by another secret string so that no one knows it but you. then restart iredapd service.

3 (edited by derrickr 2019-04-05 03:44:00)

Re: Update iRedAPD-2.7 - service failed

Thanks.

I did the above, but am now getting:

--------------------------------------
root@mail:~# systemctl status iredapd.service
● iredapd.service - iRedAPD (A simple posfix policy server)
   Loaded: loaded (/lib/systemd/system/iredapd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-04-04 09:18:39 BST; 2s ago
  Process: 3842 ExecStart=/usr/bin/python2 /opt/iredapd/iredapd.py (code=exited, status=1/FAILURE)

Apr 04 09:18:39 mail systemd[1]: Starting iRedAPD (A simple posfix policy server)...
Apr 04 09:18:39 mail python2[3842]: Traceback (most recent call last):
Apr 04 09:18:39 mail python2[3842]:   File "/opt/iredapd/iredapd.py", line 19, in <module>
Apr 04 09:18:39 mail python2[3842]:     import settings
Apr 04 09:18:39 mail python2[3842]:   File "/opt/iRedAPD-2.7/settings.py", line 67, in <module>
Apr 04 09:18:39 mail python2[3842]:     srs_domain = mail.<redacted>.com
Apr 04 09:18:39 mail python2[3842]: NameError: name 'mail' is not defined
Apr 04 09:18:39 mail systemd[1]: iredapd.service: Control process exited, code=exited status=1
Apr 04 09:18:39 mail systemd[1]: iredapd.service: Failed with result 'exit-code'.
Apr 04 09:18:39 mail systemd[1]: Failed to start iRedAPD (A simple posfix policy server).
--------------------------------------

This is a separate mail server from my main domain. I've tried setting 'srs_domain' in settings.py to this mail server's sub domain (mail.<redacted>.com) and also simply (<redacted>.com), but am still receiving:

NameError: name 'mail' is not defined

or

NameError: name '<redacted>' is not defined

*where <redacted> is my top level domain name.

4

Re: Update iRedAPD-2.7 - service failed

Do you know if anyone else has had similar issues?

I'm also now receiving lots of cron errors from '/opt/iredapd/tools/cleanup_db.py' and '/opt/iredapd/tools/spf_to_greylist_whitelists.py', so I'm now thinking that perhaps I should revert to my last backup from a few days ago, before I attempted this upgrade.

However, I'd much rather have an up-to-date working instance, so would really appreciate any help / ideas.

Many Thanks

5

Re: Update iRedAPD-2.7 - service failed

Make sure your /opt/iredapd/settings.py has required parameters:

srs_forward_port = 7778
srs_reverse_port = 7779
srs_domain = "mail.<redacted>.com"
srs_secrets = ["<secret>"]

Ports 7778 and 7779 are used by iRedAPD by default. Althoug you're free to change them, but not recommended unless you have to.
"srs_domain" should contain a string which is a valid domain name, and it must be resolvable by DNS query, mx record of srs_domain must be pointed to this iRedMail server.
srs_secrets is a (Python) list, it contains at least one secret string used for hash.

Read this for more details:
https://docs.iredmail.org/srs.html

6

Re: Update iRedAPD-2.7 - service failed

Hey thanks.

I added those additional srs_forward_port and srs_reverse_port settings, but unfortunately it made no difference, even after restarting postfix and ireadapd.

I can confirm that the srs_domain string ("mail.<redacted>.com") is correct and resovable by DNS query, which I tested on dnsquery.org showing: "We got authoritative results from ns1.digitalocean.com."

But I'm still getting:
----------------------------
root@mail:~# systemctl restart iredapd
Job for iredapd.service failed because the control process exited with error code.
See "systemctl status iredapd.service" and "journalctl -xe" for details.
root@mail:~# systemctl status iredapd.service
● iredapd.service - iRedAPD (A simple posfix policy server)
   Loaded: loaded (/lib/systemd/system/iredapd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-04-05 10:37:10 BST; 5s ago
  Process: 7858 ExecStart=/usr/bin/python2 /opt/iredapd/iredapd.py (code=exited, status=1/FAILURE)

Apr 05 10:37:10 mail.derrickrobinson.com systemd[1]: Starting iRedAPD (A simple posfix policy server)...
Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]: Traceback (most recent call last):
Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]:   File "/opt/iredapd/iredapd.py", line 19, in <module>
Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]:     import settings
Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]:   File "/opt/iRedAPD-2.7/settings.py", line 67, in <module>
Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]:     srs_domain = mail.<redacted>.com
Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]: NameError: name 'mail' is not defined
Apr 05 10:37:10 mail.derrickrobinson.com systemd[1]: iredapd.service: Control process exited, code=exited status=1
Apr 05 10:37:10 mail.derrickrobinson.com systemd[1]: iredapd.service: Failed with result 'exit-code'.
Apr 05 10:37:10 mail.derrickrobinson.com systemd[1]: Failed to start iRedAPD (A simple posfix policy server).
----------------------------

I also followed https://docs.iredmail.org/srs.html (yesterday) and perhaps that might provide a clue to where its failing since I can't successfully test SRS as per the instructions included within that page.

7

Re: Update iRedAPD-2.7 - service failed

derrickr wrote:

Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]:     srs_domain = mail.<redacted>.com
Apr 05 10:37:10 mail.derrickrobinson.com python2[7858]: NameError: name 'mail' is not defined

The value of "srs_domain" must be a string (in Python), you need to quote it with either single quotes or double quotes like this:

srs_domain = "mail.<redacted>.com"
srs_domain = 'mail.<redacted>.com'

8

Re: Update iRedAPD-2.7 - service failed

Thanks, that did it. Can't believe I mad such a newbie mistake!