Errors: Cannot open bayes database

I am wondering if this is related to a previous post: Permission denied /.spamassassin/bayes_* R/O

I am seeing the following in my log:

2024-10-17T17:02:09.081202-04:00 neco spamd[1969]: bayes: cannot open bayes databases /var/lib/spamassassin/.spamassassin/bayes_* R/O: tie failed: Permission denied
2024-10-17T17:02:09.096958-04:00 neco spamd[1969]: bayes: cannot open bayes databases /var/lib/spamassassin/.spamassassin/bayes_* R/O: tie failed: Permission denied
2024-10-17T17:03:53.961348-04:00 neco spamd[1969]: bayes: cannot open bayes databases /var/lib/spamassassin/.spamassassin/bayes_* R/O: tie failed: Permission denied

The bayes files are owned by debian-spamd, and that is also the user that is set in SPAMD_USER in the sieve script. I’m just assuming it’s related to spamham based off the post I mentioned being similar. I could be very wrong though.

@sahsanu Any idea bud? :slight_smile:

Thanks!

I can’t reproduce it on my server so I’ve no idea what’s going on but did you try the fix I provided in the other post?

Also, show the output of this command:

namei -mo /var/lib/spamassassin/.spamassassin/*
f: /var/lib/spamassassin/.spamassassin/bayes_seen
 drwxr-xr-x root         root         /
 drwxr-xr-x root         root         var
 drwxr-xr-x root         root         lib
 drwxr-xr-x debian-spamd debian-spamd spamassassin
 drwx------ debian-spamd debian-spamd .spamassassin
 -rw------- debian-spamd debian-spamd bayes_seen
f: /var/lib/spamassassin/.spamassassin/bayes_toks
 drwxr-xr-x root         root         /
 drwxr-xr-x root         root         var
 drwxr-xr-x root         root         lib
 drwxr-xr-x debian-spamd debian-spamd spamassassin
 drwx------ debian-spamd debian-spamd .spamassassin
 -rw------- root         root         bayes_toks
f: /var/lib/spamassassin/.spamassassin/sa-compile.cache
 drwxr-xr-x root         root         /
 drwxr-xr-x root         root         var
 drwxr-xr-x root         root         lib
 drwxr-xr-x debian-spamd debian-spamd spamassassin
 drwx------ debian-spamd debian-spamd .spamassassin
 drwxr-xr-x debian-spamd debian-spamd sa-compile.cache
f: /var/lib/spamassassin/.spamassassin/user_prefs
 drwxr-xr-x root         root         /
 drwxr-xr-x root         root         var
 drwxr-xr-x root         root         lib
 drwxr-xr-x debian-spamd debian-spamd spamassassin
 drwx------ debian-spamd debian-spamd .spamassassin
 -rw-r--r-- debian-spamd debian-spamd user_prefs

I’ll try the solution from the other post and let you know. Thanks @sahsanu !

1 Like

I don’t know the reason sa-learn changes the owner and group to root instead of debian-spamd for bayes_toks db but if you use the fix it should not happen again… I hope so :smiley:

1 Like

That didn’t seem to be the problem and now I see that I get the error any incoming mail, so I don’t think it’s actually an issue with your script after all. I’ll eventually figure it out, thanks for the help @sahsanu !

But the owner and group is still root or it changed to debian-spamd? If it is root then change it manually.

chown debian-spamd:debian-spamd /var/lib/spamassassin/.spamassassin/bayes_toks

I had changed it manually, and today I double checked that things seem to be working. I’m still getting spam in my in box but maybe I still haven’t reached 200 yet. It’s still a mystery how it became owned by root, but it seems fine now. Thanks so much for the help @sahsanu !!!

1 Like