mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
8.58k stars 1.15k forks source link

Could not enable Sieve script: Internal error occurred. Refer to server log for more information. #3964

Closed bluewalk closed 3 years ago

bluewalk commented 3 years ago

Prior to placing the issue, please check following: (fill out each checkbox with an X once done)

Summary

Adjusting Sieve filters and saving them ends up with the error Could not enable Sieve script: Internal error occurred. Refer to server log for more information.

Logs

sogo

sogo-mailcow_1       | Feb  4 06:48:58 1cd390fe3a2b sogod [949]: [WARN] <0x0x559226112090[SOGoSieveManager]> Could not delete Sieve script: Cannot delete the active Sieve script.
sogo-mailcow_1       | Feb  4 06:48:58 1cd390fe3a2b sogod [949]: [ERROR] <0x0x559226112090[SOGoSieveManager]> Could not enable Sieve script: Internal error occurred. Refer to server log for more information. [2021-02-04 06:48:58]
sogo-mailcow_1       | Feb  4 06:48:58 1cd390fe3a2b sogod [949]: 192.168.100.110 "POST /SOGo/so/my@email.com/Preferences/save HTTP/1.0" 500 134/9219 0.084 - - 0 - 46

dovecot

dovecot-mailcow_1    | Feb  4 06:48:58 ac278e3a6a8c dovecot: managesieve(my@email.com)<13795><R9GMQny63NesFgH4>: Error: sieve: file storage: Failed to deactivate Sieve: unlink(/var/vmail/sieve/my@email.com.sieve) failed: Permission denied
dovecot-mailcow_1    | Feb  4 06:48:58 ac278e3a6a8c dovecot: managesieve(my@email.com)<13795><R9GMQny63NesFgH4>: Failed to deactivate script: Internal error occurred. Refer to server log for more information. [2021-02-04 06:48:58]
dovecot-mailcow_1    | Feb  4 06:48:58 ac278e3a6a8c dovecot: managesieve(my@email.com)<13795><R9GMQny63NesFgH4>: Failed to delete script `sogo': Cannot delete the active Sieve script.
dovecot-mailcow_1    | Feb  4 06:48:58 ac278e3a6a8c dovecot: managesieve(my@email.com)<13795><R9GMQny63NesFgH4>: Error: sieve: file storage: Creating symlink() /var/vmail/sieve/my@email.com.sieve-new.1612417738.P13795M836990.ac278e3a6a8c to /var/vmail/email.com/my/sieve/sogo.sieve failed: Permission denied
dovecot-mailcow_1    | Feb  4 06:48:58 ac278e3a6a8c dovecot: managesieve(my@email.com)<13795><R9GMQny63NesFgH4>: Failed to activate script `sogo': Internal error occurred. Refer to server log for more information. [2021-02-04 06:48:58]
dovecot-mailcow_1    | Feb  4 06:48:58 ac278e3a6a8c dovecot: managesieve(my@email.com)<13795><R9GMQny63NesFgH4>: Connection closed bytes=2487/310
root@ac278e3a6a8c:/var/vmail/sieve# ls -al
total 40
dr-xr-xr-x 2 vmail vmail 4096 Feb  4 01:00 .
dr-xr-xr-x 7 vmail vmail 4096 Apr  7  2020 ..
lrwxrwxrwx 1 vmail vmail   53 Nov  2 14:59 my@email.com.sieve -> /var/vmail/email.com/my/sieve/sogo.sieve
-rw------- 1 vmail vmail 1502 Oct 29 12:33 my@email.com.sieve.log
-rw------- 1 vmail vmail 2194 Nov  2 15:36 my@email.com.svbin
-r--r--r-- 1 vmail vmail  413 May 30  2019 global.sieve
-r--r--r-- 1 vmail vmail  481 May 30  2019 global.svbin
-r--r--r-- 1 vmail vmail  610 Feb  4 01:00 global_sieve_after.sieve
-r--r--r-- 1 vmail vmail  524 Feb  4 01:00 global_sieve_after.svbin
-r--r--r-- 1 vmail vmail  343 Feb  4 01:00 global_sieve_before.sieve
-r--r--r-- 1 vmail vmail  313 Feb  4 01:00 global_sieve_before.svbin
root@ac278e3a6a8c:/var/vmail/email.com/my/sieve# ls -al
total 16
drwx------  3 vmail vmail 4096 Feb  4 06:48 .
drwx------ 79 vmail vmail 4096 Feb  4 06:40 ..
-rw-------  1 vmail vmail 2406 Feb  4 06:48 sogo.sieve
drwx------  2 vmail vmail 4096 Feb  4 06:48 tmp

Reproduction

Try saving the filters in sogo. Looking at the sieve files the changes do seem to have been saved.

Furthermore the custom logo was also deleted, seems the upgrade went wrong?

System information

Question Answer
My operating system Ubuntu 20.04.1
Is Apparmor, SELinux or similar active? No
Virtualization technlogy (KVM, VMware, Xen, etc - LXC and OpenVZ are not supported VMware
Server/VM specifications (Memory, CPU Cores) 4GB, 2 Cores
Docker Version (docker version) 20.10.2
Docker-Compose Version (docker-compose version) 1.28.2, build 67630359
Reverse proxy (custom solution) HaProxy
andryyy commented 3 years ago

Hi,

You probably mount vmail from a storage? The file permissions are not correct. Did you at any point restore a backup or mount an external storage?

Default:

ll /var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/
total 20
drwxr-xr-x 5 5000 5000 4096 Jan 19 13:36 .
drwxr-xr-x 3 root root 4096 Jan 15 09:57 ..
drwx------ 4 5000 5000 4096 Jan 19 13:36 develcow.de
drwxr-xr-x 2 5000 5000 4096 Jan 15 09:57 _garbage
-rw-r--r-- 1 5000 5000    0 Jan 19 13:36 shared-mailboxes.db
drwxr-xr-x 2 5000 5000 4096 Feb  3 07:45 sieve
bluewalk commented 3 years ago

Hi @andryyy,

Yes, it's mounting from a storage. I have indeed restored from a backup a while ago. Checking the same folder as you it seems permissions are the same:

root@cs01:/mailcow/data/vmail# ls -al
total 28
dr-xr-xr-x  7          5000          5000 4096 Apr  7  2020 .
drwxrwxr-x 10 administrator administrator 4096 Dec 19 15:36 ..
dr-xr-xr-x  2          5000          5000 4096 Jul 12  2019 _garbage
drwx------  6          5000          5000 4096 Jun 30  2019 email.com
-r--r--r--  1          5000          5000    0 Apr  7  2020 shared-mailboxes.db
dr-xr-xr-x  2          5000          5000 4096 Feb  4 01:00 sieve

Funny thing is that my changes in Sogo are written to the sieve file though.

andryyy commented 3 years ago

The backup was probably not correct either. :)

bluewalk commented 3 years ago

That could be a possibility yes ;-) How do I go ahead to fix the permissions?

andryyy commented 3 years ago

You can check my "ls" from above and apply the same permissions.

bluewalk commented 3 years ago

I totally didn't notice the difference in the sieve folder permissions, after checking it for the 10th time I've noticed the difference.

chmod 755 sieve -R solved it. Still curious how it did manage to save the settings and throw the error ;-)