1

Topic: SOGo and memcached

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? Downloadable Installer
- Linux/BSD distribution name and version: Ubuntu 18:04
- 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.
====

I'm getting lots of these errors in /var/log/sogo/sogo.log:

Nov 28 14:23:14 sogod [21415]: <0x0x561e98bf8d90[SOGoCache]> an error occurred when caching value for key 'user@domain.com+attributes': "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY"

These errors are also occurring when /var/vmail/backup/backup_sogo.sh runs as a cronjob.

I've read on this forum https://forum.iredmail.org/post57940.html#p57940 this maybe due to memcached. Also on this forum it states that memcached is installed as part of the iRedMail installation https://forum.iredmail.org/post56630.html#p56630

Memcached is not installed on my server:

dpkg -L memcached
dpkg-query: package 'memcached' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.

So my question is, is there a way to configure SOGo to not use memcached or should I install memcached?

Many thanks, Steve.

2

Re: SOGo and memcached

Decided to go ahead and install memcached, but before doing so I noticed there was an /etc/memcached.conf file -containing a single line "-l 127.0.0.1" - created at the same time I installed iRedMail which was odd considering iRedMail didn't appear to have installed memcached.

After manually installing memcached it failed to start with the error "ExecStart=/usr/share/memcached/scripts/systemd-memcached-wrapper /etc/memcached.conf (code=exited, status=64)".

This error appears to be caused by explicitly binding the IP address memcached listens on. By commenting-out "-l 127.0.0.1" in /etc/memcached.conf, memcached starts without issue and the "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY" errors in the SOGo log seem to have gone away.

Regards, Steve.

3

Re: SOGo and memcached

tech-otaku wrote:

By commenting-out "-l 127.0.0.1" in /etc/memcached.conf, memcached starts without issue

Comment out this line is not safe, because memcached will listen on all available network interfaces.

This line should work fine with memcached, did you get any detailed error in /var/log/syslog?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

4

Re: SOGo and memcached

~$ sudo systemctl start memcached

Dec  2 19:46:41 mail systemd[1]: Started memcached daemon.
Dec  2 19:46:41 mail systemd-memcached-wrapper[2809]: can't run as root without the -u switch
Dec  2 19:46:41 mail systemd[1]: memcached.service: Main process exited, code=exited, status=64/n/a
Dec  2 19:46:41 mail systemd[1]: memcached.service: Failed with result 'exit-code'.
Dec  2 19:46:42 mail systemd[1]: memcached.service: Service hold-off time over, scheduling restart.
Dec  2 19:46:42 mail systemd[1]: memcached.service: Scheduled restart job, restart counter is at 1.
Dec  2 19:46:42 mail systemd[1]: Stopped memcached daemon.

These messages get repeated another 4 times. Each time the counter is incremented by 1 until it reaches 5 and then the message changes to

Dec  2 19:46:43 mail systemd[1]: memcached.service: Start request repeated too quickly.
Dec  2 19:46:43 mail systemd[1]: memcached.service: Failed with result 'exit-code'.
Dec  2 19:46:43 mail systemd[1]: Failed to start memcached daemon.

Looks like "can't run as root without the -u switch" is the culprit. If it is, I'm not sure how to fix it.

Regards, Steve.

5

Re: SOGo and memcached

When explicitly binding IP 127.0.0.1 as the port memcached listens on, the only way I can get memcached to start is:

~$ /usr/bin/memcached -d

This is what I ended-up doing:

~ $ sudo update-rc.d memcached disable                        # Stop system attempting to start memcached at boot

Added this to user's crontab:

@reboot /usr/bin/memcached -d

To stop memcached:

kill -9 $(pidof memcached)

Using this method, memcached runs as user "steve":

~$ ps aux | grep -e memcached
--> steve     1119  0.0  0.2 419392  5540 ?        Ssl  06:31   0:00 /usr/bin/memcached -d

My question now is, what user should memcached be running as - steve, root, nobody?

Many thanks, Steve.

6

Re: SOGo and memcached

Your /etc/memcached.conf should have a line like below:

-u memcache

It will run memcached as user "memcache" instead of root.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee