1

Topic: warning: connect to 127.0.0.1:7777: Connection refused

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version: Debian
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  Mysql
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

This seems to happen to a lot of users. To our newly configured server it happens every Sunday for some reason I can't yet understand.
This is the last thing report on iredapd.log before restart (I removed the addresses):

2015-09-21 04:48:42 INFO [217.172.183.15] RCPT, *@*.co.ua -> *@*.de, DUNNO
2015-09-21 05:31:58 INFO [144.76.198.186] RCPT, *@b.dev.*.de -> *@*.de, DUNNO
2015-09-21 05:56:56 INFO [83.143.85.107] RCPT, *@*.com -> *@*.de, DUNNO
2015-09-21 06:52:23 INFO [210.72.149.119] RCPT, *@*.com -> *@*.de, DUNNO
2015-09-21 07:17:46 INFO [91.220.49.17] RCPT, SRS0=fdyhsW=J3=xing.com=mailrobot@srs.hosting-agency.de -> *@*.de, DUNNO

And this right after restart of iredapd:

2015-09-21 07:35:16 INFO Starting iRedAPD (version: 1.6.0, backend: mysql), listening on 127.0.0.1:7777.
2015-09-21 07:35:16 INFO Loading plugin: reject_null_sender
2015-09-21 07:35:16 INFO Loading plugin: amavisd_message_size_limit
2015-09-21 07:35:16 INFO Loading plugin: amavisd_wblist
2015-09-21 07:35:16 INFO Loading plugin: sql_alias_access_policy
2015-09-21 08:02:08 INFO [91.192.42.28] RCPT, g-12080044578-12310-1201557846-1442808063557@bounce.n.westwing.de -> nicole@solebich.de, DUNNO
2015-09-21 08:55:54 INFO Starting iRedAPD (version: 1.6.0, backend: mysql), listening on 127.0.0.1:7777.
2015-09-21 08:55:54 INFO Loading plugin: reject_null_sender
2015-09-21 08:55:54 INFO Loading plugin: amavisd_message_size_limit
2015-09-21 08:55:54 INFO Loading plugin: amavisd_wblist
2015-09-21 08:55:54 INFO Loading plugin: sql_alias_access_policy

Apart from the fact that we had to restart the service on the 7th, 14th and 21st of September, I do not have any other information at the moment.

The only modifications I've done from the initial installation of iredmail are:
1) This in headers_check:

/From:.*dev@____.de/ REDIRECT trap@____.de
/From:.*trap@___.de/ REJECT Mailtrap isn't allowed to send emails.

2) a whitelist (ignoreip) in fail2ban/jail.conf

I expect this to break again next Sunday, I'll be monitoring it.

----

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

2

Re: warning: connect to 127.0.0.1:7777: Connection refused

Oh, and SoGO is installed, but nobody uses it.

Should I remove it? How?

3

Re: warning: connect to 127.0.0.1:7777: Connection refused

bserem wrote:

To our newly configured server it happens every Sunday for some reason I can't yet understand.

Any regular operations on Sunday? e.g. your server will receive some emails at the same time?

bserem wrote:

SoGO is installed, but nobody uses it.
Should I remove it? How?

Remove the sogo packages.

4 (edited by bserem 2015-09-22 15:12:13)

Re: warning: connect to 127.0.0.1:7777: Connection refused

ZhangHuangbin wrote:

Any regular operations on Sunday? e.g. your server will receive some emails at the same time?

None that I know of.
I didn't add anything cron-related myself either, after the installation, 4-5 weeks ago.

5

Re: warning: connect to 127.0.0.1:7777: Connection refused

*) Not just cron. is it possible that someone (or some devices) sends email to your server regularly?
*) Or, any same thing happen on the 7th, 14th and 21st of September?

6

Re: warning: connect to 127.0.0.1:7777: Connection refused

I really can't think of something. But I'm monitoring it now.

My personal mail server (which has a LOT of communication with the mailserver with the problem) doesn't have any such kind of issues.

I'll update this post if/when I find more information.

7

Re: warning: connect to 127.0.0.1:7777: Connection refused

Related issue:
http://www.iredmail.org/forum/topic9934 … fused.html


iredapd got stuck again yesterday (Sunday). Only log I have is:

/etc/cron.daily/logrotate:
ERROR  Unable to contact server. Is it running?
error: error running non-shared postrotate script for /var/log/fail2ban.log of '/var/log/fail2ban.log '
Stopping iredapd ...
Starting iredapd ...
run-parts: /etc/cron.daily/logrotate exited with return code 1
/etc/cron.daily/spamassassin:
Job for spamassassin.service failed. See 'systemctl status spamassassin.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript spamassassin, action "reload" failed.
/etc/cron.daily/tmpreaper:
Please read /usr/share/doc/tmpreaper/README.security.gz first;
edit /etc/tmpreaper.conf to remove this message (look for SHOWWARNING).

8

Re: warning: connect to 127.0.0.1:7777: Connection refused

Could you please try to rotate the iRedAPD log file and see whether logrotate correctly restarts iredapd service? for example:

# logrotate -f /etc/logrotate.d/iredapd

9

Re: warning: connect to 127.0.0.1:7777: Connection refused

logrotate restarts iredapd without any problems.

I'll also try this next sunday, where I expect the mail server to stop again, and post more feedback then.

10

Re: warning: connect to 127.0.0.1:7777: Connection refused

I also have this same problem. iredapd stops on Sunday or Monday and has to be restarted every week. I have tried logging with iredapd running in debug mode, but there is no log information that is kicked out as the process dies. Something happens when cron runs iredmail cleanup tasks (the weekly ones that fire off Sunday/Monday) and iredapd stops working resulting in this problem. I haven't had much time to investigate it yet and I found it hard to believe that more people haven't had this problem since it seems to be pretty consistent.

11

Re: warning: connect to 127.0.0.1:7777: Connection refused

Sounds like logrotate cause this issue, could you please try to change the logrotate interval setting in /etc/logrotate.d/iredapd and keep monitoring this issue? For example, change to rotate everyday with setting 'daily'.

12

Re: warning: connect to 127.0.0.1:7777: Connection refused

Done! I don't know if there is any service that needs to be restarted (who calls logrotate?) but I'm keeping an eye on this.

Expect more information soon smile

13

Re: warning: connect to 127.0.0.1:7777: Connection refused

It happened again, just after logrotate tried to restart iredapd. Here is some information I think might help:

mail:~# systemctl status iredapd
● iredapd.service - LSB: Control iredapd daemon.
   Loaded: loaded (/etc/init.d/iredapd)
   Active: active (exited) since Thu 2015-09-24 16:21:14 CEST; 5 days ago
  Process: 2928 ExecStart=/etc/init.d/iredapd start (code=exited, status=0/SUCCESS)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

This came by email:

/etc/cron.daily/logrotate:
Stopping iredapd ...
Starting iredapd ...
/etc/cron.daily/tmpreaper:
Please read /usr/share/doc/tmpreaper/README.security.gz first;
edit /etc/tmpreaper.conf to remove this message (look for SHOWWARNING).

14

Re: warning: connect to 127.0.0.1:7777: Connection refused

Could you please show me full content in file /etc/logrotate.d/iredapd and /etc/cron.daily/tmpreaper?

15

Re: warning: connect to 127.0.0.1:7777: Connection refused

tmpreaper (untouched, should be as it was installed by v0.9.2):

#!/bin/sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin

# in case of `dpkg -r' leaving conffile.
if ! [ -x /usr/sbin/tmpreaper ]; then
    exit 0
fi

# Remove `/tmp/...' files not accessed in X time (configured in
# /etc/tmpreaper.conf, default 7 days), protecting the .X, .ICE, .iroha and
# .ki2 files; but removing symlinks. For directories not the access time, but
# the modification time is used (--mtime-dir), as reading a directory to check
# the contents will update the access time!
#
# In the default, /tmp/. is used, not the plain /tmp you might expect, as this
# accomodates the situation where /tmp is a symlink to some other place.
#
# Note that the sockets are safe even without the `--protect', unless `--all'
# is given, and the `.X*-lock' files would be safe also, as long as they have
# no write permissions, so this particular protect is mainly illustrative, and
# redundant.  For best results, don't try to get fancy with the moustache
# expansions.  KISS.  Always --test your protect patterns.
#
# Immutable files (such as ext3fs' .journal) are not (cannot be) removed;
# when such a file is encountered when trying to remove it, no error is given
# unless you use the --verbose option in which case a message is given.
#
# In case you're wondering: .iroha is for cannaserver and .ki2 is for kinput2
# (japanese software, lock files).
# journal.dat is for (older) ext3 filesystems
# quota.user, quota.group is for (duh) quotas.

# Set config defaults
SHOWWARNING=''

# get the TMPREAPER_TIME value from /etc/default/rcS

if grep '^TMPTIME=' /etc/default/rcS >/dev/null 2>&1; then
    eval $(grep '^TMPTIME=' /etc/default/rcS)
    if [ -n "$TMPTIME" ]; then
        # Don't clean files if TMPTIME is negative or 'infinite'
        # to mimic the way /lib/init/bootclean.sh works.
        case "$TMPTIME" in
          -*|infinite|infinity)
                # don't use this as default
                ;;
           *)
                if [ "$TMPTIME" -gt 0 ]; then
                    TMPREAPER_TIME=${TMPTIME}d
                else
                    TMPREAPER_TIME=7d
                fi
                ;;
        esac
    fi
fi

# ! Important !  The "set -f" below prevents the shell from expanding
#                file paths, which is vital for the configuration below to work.

set -f

# preserve environment setting of TMPREAPER_DELAY to allow manual override when
# running the cron.daily script by hand:
if [ -n "$TMPREAPER_DELAY" ]; then
    # check for digits only
    case "$TMPREAPER_DELAY" in
        [0-9]*) TMPREAPER_DELAY_SAVED="$TMPREAPER_DELAY";;
        *)      ;;
    esac
fi

if [ -s /etc/tmpreaper.conf ]; then
    . /etc/tmpreaper.conf
fi

# Now restore the saved value of TMPREAPER_DELAY (if any):
if [ -n "$TMPREAPER_DELAY_SAVED" ]; then
    TMPREAPER_DELAY="$TMPREAPER_DELAY_SAVED"
else
    # set default in case it's not given in tmpreaper.conf:
    TMPREAPER_DELAY=${TMPREAPER_DELAY:-256}
fi

if [ "$SHOWWARNING" = true ]; then
    echo "Please read /usr/share/doc/tmpreaper/README.security.gz first;"
    echo "edit /etc/tmpreaper.conf to remove this message (look for SHOWWARNING)."
    exit 0
fi

# Verify that these variables are set, and if not, set them to default values
# This will work even if the required lines are not specified in the included
# file above, but the file itself does exist.
TMPREAPER_TIME=${TMPREAPER_TIME:-7d}
TMPREAPER_PROTECT_EXTRA=${TMPREAPER_PROTECT_EXTRA:-''}
TMPREAPER_DIRS=${TMPREAPER_DIRS:-'/tmp/.'}

nice -n10 tmpreaper --delay=$TMPREAPER_DELAY --mtime-dir --symlinks $TMPREAPER_TIME  \
  $TMPREAPER_ADDITIONALOPTIONS \
  --ctime \
  --protect '/tmp/.X*-{lock,unix,unix/*}' \
  --protect '/tmp/.ICE-{unix,unix/*}' \
  --protect '/tmp/.iroha_{unix,unix/*}' \
  --protect '/tmp/.ki2-{unix,unix/*}' \
  --protect '/tmp/lost+found' \
  --protect '/tmp/journal.dat' \
  --protect '/tmp/quota.{user,group}' \
  `for i in $TMPREAPER_PROTECT_EXTRA; do echo --protect "$i"; done` \
  $TMPREAPER_DIRS

logrotate.d/iredapd (untouched except from the weekly->daily modification):

#
# File generated by iRedMail (2015.08.25.04.27.36):
#
# Version:  0.9.2
# Project:  http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#

/var/log/iredapd.log {
    compress
    #weekly
    daily
    rotate 10
    create 0600 root root
    missingok

    # Use bzip2 for compress.
    compresscmd /bin/bzip2
    uncompresscmd /bin/bunzip2
    compressoptions -9
    compressext .bz2

    postrotate
        /etc/init.d/iredapd restart
    endscript
}

16

Re: warning: connect to 127.0.0.1:7777: Connection refused

Looks like it's caused by iRedAPD logrotate, but no clear idea why it causes this issue. iRedAPD will re-open log file after it was restarted by logrotate.

Could you please try to comment out 3 lines in /etc/logrotate.d/iredapd and try again?

    postrotate
        /etc/init.d/iredapd restart
    endscript

iRedAPD may not be able to log to /var/log/iredapd.log after commenting out above lines, but it will keep running.

17 (edited by bserem 2015-10-01 07:07:51)

Re: warning: connect to 127.0.0.1:7777: Connection refused

I commented them out, I'll post feedback in a couple of hours smile

On a side note, I tried to uninstall sogo and this is the output:

root@mail:~# aptitude remove sogo sogo-activesync                                                                                                                                    
The following packages will be REMOVED:  
  autotools-dev{u} gnustep-make{u} gobjc{u} gobjc-4.9{u} libglib2.0-0{u} libglib2.0-data{u} liblasso3{u} libmemcached11{u} libobjc-4.9-dev{u} libsbjson2.3{u} 
  libsope-appserver4.9{u} libsope-ldap4.9{u} libsope-mime4.9{u} libwbxml2-0{u} libxmlsec1{u} libxmlsec1-openssl{u} memcached{u} shared-mime-info{u} sogo sogo-activesync 
  sope4.9-libxmlsaxdriver{u} tmpreaper{u} xdg-user-dirs{u} 
0 packages upgraded, 0 newly installed, 23 to remove and 71 not upgraded.
Need to get 0 B of archives. After unpacking 63.9 MB will be freed.
Do you want to continue? [Y/n/?] n
Abort.

Note that tmpreaper is in there.

In an older iredmail installation (0.9.0) which doesn't have sogo, the tmpreaper package is also not installed.
Could it be that the sogo installs tmpreaper (or some other package) and this breaks iredapd?
Is it safe to remove sogo packages including all packages that aptitude wants to remove?

18

Re: warning: connect to 127.0.0.1:7777: Connection refused

bserem wrote:

Is it safe to remove sogo packages including all packages that aptitude wants to remove?

I'm not sure about those 2: "libglib2.0-0{u} libglib2.0-data{u}". others are sogo or sogo dependencies, it's ok to remove.

Btw, does this issue happen again if you just remove tmpreaper (and keep sogo)?

19

Re: warning: connect to 127.0.0.1:7777: Connection refused

As expected, iredapd stopped writing to the log but continued to work.
Trying to remove tmpreaper forces removal of sogo packages, which forces removal of all aforementioned 23 packages.

Trying with apt-get allows me to not remove everything.

root@mail:~# apt-get remove tmpreaper
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  autotools-dev gnustep-make gobjc gobjc-4.9 libglib2.0-0 libglib2.0-data liblasso3 libmemcached11 libobjc-4.9-dev libsbjson2.3 libsope-appserver4.9 libsope-ldap4.9 libsope-mime4.9
  libwbxml2-0 libxmlsec1 libxmlsec1-openssl memcached shared-mime-info sope4.9-libxmlsaxdriver xdg-user-dirs
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libsbjson2.3 libsope-appserver4.9 libsope-core4.9 libsope-gdl1-4.9 libsope-ldap4.9 libsope-mime4.9 libsope-xml4.9
The following packages will be REMOVED:
  sogo sogo-activesync tmpreaper
The following packages will be upgraded:
  libsbjson2.3 libsope-appserver4.9 libsope-core4.9 libsope-gdl1-4.9 libsope-ldap4.9 libsope-mime4.9 libsope-xml4.9
7 upgraded, 0 newly installed, 3 to remove and 69 not upgraded.
Need to get 1,803 kB of archives.
After this operation, 16.2 MB disk space will be freed.
Do you want to continue? [Y/n] 
Get:1 http://inverse.ca/debian/ jessie/jessie libsbjson2.3 amd64 4.9.r1664.20150916 [14.5 kB]
Get:2 http://inverse.ca/debian/ jessie/jessie libsope-xml4.9 amd64 4.9.r1664.20150916 [127 kB]
Get:3 http://inverse.ca/debian/ jessie/jessie libsope-core4.9 amd64 4.9.r1664.20150916 [313 kB]
Get:4 http://inverse.ca/debian/ jessie/jessie libsope-mime4.9 amd64 4.9.r1664.20150916 [283 kB]
Get:5 http://inverse.ca/debian/ jessie/jessie libsope-appserver4.9 amd64 4.9.r1664.20150916 [869 kB]
Get:6 http://inverse.ca/debian/ jessie/jessie libsope-gdl1-4.9 amd64 4.9.r1664.20150916 [151 kB]
Get:7 http://inverse.ca/debian/ jessie/jessie libsope-ldap4.9 amd64 4.9.r1664.20150916 [45.8 kB]
Fetched 1,803 kB in 3s (532 kB/s)     
Reading changelogs... Done
(Reading database ... 40035 files and directories currently installed.)
Removing sogo-activesync (2.3.1-1) ...
Removing sogo:amd64 (2.3.1-1) ...
Removing tmpreaper (1.6.13+nmu1) ...
Processing triggers for libc-bin (2.19-18) ...
Processing triggers for man-db (2.7.0.2-5) ...
(Reading database ... 37862 files and directories currently installed.)
Preparing to unpack .../libsbjson2.3_4.9.r1664.20150916_amd64.deb ...
Unpacking libsbjson2.3 (4.9.r1664.20150916) over (4.9.r1664.20150723) ...
Preparing to unpack .../libsope-xml4.9_4.9.r1664.20150916_amd64.deb ...
Unpacking libsope-xml4.9 (4.9.r1664.20150916) over (4.9.r1664.20150723) ...
Preparing to unpack .../libsope-core4.9_4.9.r1664.20150916_amd64.deb ...
Unpacking libsope-core4.9 (4.9.r1664.20150916) over (4.9.r1664.20150723) ...
Preparing to unpack .../libsope-mime4.9_4.9.r1664.20150916_amd64.deb ...
Unpacking libsope-mime4.9 (4.9.r1664.20150916) over (4.9.r1664.20150723) ...
Preparing to unpack .../libsope-appserver4.9_4.9.r1664.20150916_amd64.deb ...
Unpacking libsope-appserver4.9 (4.9.r1664.20150916) over (4.9.r1664.20150723) ...
Preparing to unpack .../libsope-gdl1-4.9_4.9.r1664.20150916_amd64.deb ...
Unpacking libsope-gdl1-4.9 (4.9.r1664.20150916) over (4.9.r1664.20150723) ...
Preparing to unpack .../libsope-ldap4.9_4.9.r1664.20150916_amd64.deb ...
Unpacking libsope-ldap4.9 (4.9.r1664.20150916) over (4.9.r1664.20150723) ...
Setting up libsbjson2.3 (4.9.r1664.20150916) ...
Setting up libsope-xml4.9 (4.9.r1664.20150916) ...
Setting up libsope-core4.9 (4.9.r1664.20150916) ...
Setting up libsope-mime4.9 (4.9.r1664.20150916) ...
Setting up libsope-appserver4.9 (4.9.r1664.20150916) ...
Setting up libsope-gdl1-4.9 (4.9.r1664.20150916) ...
Setting up libsope-ldap4.9 (4.9.r1664.20150916) ...
Processing triggers for libc-bin (2.19-18) ...

20

Re: warning: connect to 127.0.0.1:7777: Connection refused

I will rewrite iRedAPD logging with Python builtin rotate function, this way we don't need 'logrotate' program and /etc/logrotate.d/iredapd.

21

Re: warning: connect to 127.0.0.1:7777: Connection refused

Sounds like a lot of work... May the force be with you smile

In the meanwhile I'll keep you up to date about things without tmpreaper.

22

Re: warning: connect to 127.0.0.1:7777: Connection refused

UPDATE:

iRedAPD has been rewritten to support auto-rotate log files. To make this feature correctly working, we have to create /var/log/iredapd/ directory to store iRedAPD log files, and the log file will be set to /var/log/iredapd/iredapd.log.

With default setting, iRedAPD will rotate the log file when it reaches 100MB, and keep 10 backup copies. You can switch to rotate based on time, e.g. rotate every week. Needless to say, the rotate setting is customizable.

Note: you don't need to worry about this during upgrading iRedAPD, the upgrade script 'tools/upgrade_iredapd.sh' (shipped in new iRedAPD release) will handle them all for you.

23

Re: warning: connect to 127.0.0.1:7777: Connection refused

Ok, I will wait for the next release to fix this.

Thanks a lot

24

Re: warning: connect to 127.0.0.1:7777: Connection refused

Topic closed. If new iRedAPD release (v1.7.0) doesn't fix this issue, please create a new forum topic.