# [solved] spamassassin issues: bayes: cannot create lockfile

## mno

Hello everyone, 

I have done quite an extensive search for this error on mailing lists, Google and on the forums, but didn't find something that fixed my problems all the way. I used to get errors for creating any type of user file, but I solved that through the workaround posted of forcing at least one spare child (--min-children=1). However, it didn't fix the issue with the bayes.mutex file permission denied issues. I used to run spamd with the -c option instead of -x (create per-user conf files). With the --min-children=1 flag, it fixed the issue with creating any type of file. But the bayes error persisted. I then switched over to not create a per-user config file. 

I am running SpamAssassin version 3.1.8 running on Perl version 5.8.8.

I am using it through spamd. Here's my spamd config file:

```
SPAMD_OPTS="-H /etc/mail/spamassassin -i 127.0.0.1 -u spamd -x -m 5 -l"

PIDFILE="/var/run/spamd.pid"

SPAMD_NICELEVEL=5
```

I invoke spamc using these options as a bash call (I am running a custom mail server that I wrote):

```
spamc -E -u spamc < emailfile
```

Here's the specific error message that I don't know how to solve:

```
Apr  1 08:40:11 lastochka spamd[24648]: bayes: locker: safe_lock: cannot create lockfile /home/spamd/.spamassassin/bayes.mutex: Permission denied
```

Here's the contents of /home/spamd/.spamassassin:

```
lastochka .spamassassin # ls -lha

total 52K

drwx------ 2 spamd spamd 4.0K Apr  1 07:47 .

drwxr-xr-x 3 spamd spamd 4.0K Mar 31 19:43 ..

-rw------- 1 spamd spamd  12K Apr  1 08:42 auto-whitelist

-rw------- 1 spamd spamd    6 Apr  1 08:42 auto-whitelist.mutex

--w--w--w- 1 spamd spamd    6 Apr  1 07:47 bayes.mutex

-rw-rw-rw- 1 spamd spamd  12K Apr  1 07:47 bayes_seen

-rw-rw-rw- 1 spamd spamd  12K Apr  1 07:47 bayes_toks
```

Since I use the -x option in spamd config, it doesn't create a per-user config file. However, I have no clue why it has the issue with creating the bayes.mutex file - it already exists, and it is owned by the spamd user. Why does it try to create it? Is there a config option that I am missing? Here is the output of my local.cf:

```
# SpamAssassin config file for version 3.x

# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6

# See http://www.yrex.com/spam/spamconfig25.php for earlier versions

# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)

# How many hits before a message is considered spam.

required_score           5.0

# Change the subject of suspected spam

rewrite_header subject         *****SPAM*****

# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)

report_safe             1

# Enable the Bayes system

use_bayes               1

use_bayes_rules         1

#bayes_path             "/var/spamassassin"

bayes_file_mode         0666

# Enable Bayes auto-learning

bayes_auto_learn              1

# Enable or disable network checks

skip_rbl_checks         0

use_razor2              1

#use_dcc                 1

use_pyzor               1

# Mail using languages used in these country codes will not be marked

# as being possibly spam in a foreign language.

#ok_languages            all

# Mail using locales used in these country codes will not be marked

# as being possibly spam in a foreign language.

ok_locales              all
```

Any suggestions would be greatly appreciated!

Oh, just in case, my emerge --info:

```
Portage 2.1.2.2 (default-linux/amd64/2006.0, gcc-4.1.1, glibc-2.5-r0, 2.6.17-gentoo-r4 x86_64)

=================================================================

System uname: 2.6.17-gentoo-r4 x86_64 AMD Opteron(tm) Processor 244

Gentoo Base System release 1.12.9

Timestamp of tree: Sat, 31 Mar 2007 23:00:08 +0000

dev-java/java-config: 1.3.7, 2.0.31-r5

dev-lang/python:     2.4.3-r4

dev-python/pycrypto: 2.0.1-r5

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.13, 2.61

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10

sys-devel/binutils:  2.16.1-r3

sys-devel/gcc-config: 1.3.14

sys-devel/libtool:   1.5.22

virtual/os-headers:  2.6.17-r2

ACCEPT_KEYWORDS="amd64"

AUTOCLEAN="yes"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=k8 -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/php/apache1-php4/ext-active/ /etc/php/apache2-php4/ext-active/ /etc/php/cgi-php4/ext-active/ /etc/php/cli-php4/ext-active/ /etc/revdep-rebuild /etc/terminfo"

CXXFLAGS="-march=k8 -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"

GENTOO_MIRRORS="http://gentoo.mirrors.tds.net/gentoo http://mirror.datapipe.net/gentoo http://gentoo.chem.wisc.edu/gentoo/"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/portage/local/layman/java-overlay"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="alsa amd64 apache2 bcmath berkdb bitmap-fonts bzip2 cli cracklib crypt cups curl dri eds emboss encode exif expat foomaticdb fortran ftp gd gif gpm gstreamer gtk2 iconv imagemagick imap imlib ipv6 isdnlog java java5 jpeg lzw lzw-tiff midi mp3 mpeg mysql ncurses nls nptl nptlonly opengl pam pcre perl php png pppd python qt3 qt4 quicktime readline reflection sdl session sockets spell spl sqlite ssl tcpd threads tiff truetype-fonts type1-fonts unicode usb vhosts xml xorg xpm xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark ati chips cirrus cyrix dummy fbdev glint i128 i810 mga neomagic nv rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
```

Thanks a lot!

----------

## mno

I think I solved this issue by chmoding the bayes.mutex file to 0666.  :Smile: 

----------

