AWstats broken in Debian 6.0 squeeze

I am migrating my virtualmin domains over to a Debian 6.0 machine, and have problems with AWstats. I am getting emails each 10 minutes or so with the following error message for each domain:

Create/Update database for config "/etc/awstats/" by AWStats version 6.95 (build 1.943) From data in log file "/home/"... Phase 1 : First bypass old records, searching new record... Direct access after last parsed record (after line 203) Error: Couldn't open file "/home/" for write: Permission denied Setup ('/etc/awstats/' file, web server or permissions) may be wrong. Check config file, permissions and AWStats documentation (in 'docs' directory).

I checked /home/*/awstats/ but the permissions are exactly the same as on the other system.

drwxr-xr-x 2 4096 Mar 4 14:27 awstats

Any ideas what could be wrong? Is the AWstats cron script not running as root anymore or something?

uh, perhaps I should have mentioned that this is the email subject

Cron www-data@neptune [ -x /usr/share/awstats/tools/ ] && /usr/share/awstats/tools/

so I suspect I just need to deactivate that cron, since virtualmin still has its own cronjobs as root that do the job.

Ok these are the contents of /etc/cron.d/awstats

*/10 * * * * www-data [ -x /usr/share/awstats/tools/ ] && /usr/share/awstats/tools/

Generate static reports:

10 03 * * * www-data [ -x /usr/share/awstats/tools/ ] && /usr/share/awstats/tools/

Now I will comment the first one out. However, even in Debian 5.0 there was something in /etc/cron.d/awstats:

0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/ -a -f /etc/awstats/awstats.conf -a -r /var/log/apache/access.log ] && /usr/lib/cgi-bin/ -config=awstats -update >/dev/null

For some reason, that didn’t cause any problem.
So what shall I do now?

I came across the same problem and it seems that it has to do with directory permissions.

virtualmin has a cron already set in root crontab to update awstats. This is run as root so statistics are updated with no problems.

This /etc/cron.d/awstats file is a maintainers update that does the same thing but is targeted to different configurations than that of virtualmin. Old command was very different so it could run correctly

However, no need to do same thing twice. You can comment this command in /etc/cron.d/awstats and restart cron

The cause of the problem seems to be the following :
If fcgid is enabled, everything runs with user permissions not www-data.

Directories like awstats are not allowed to have permissions for www-data user.

The cron job in /etc/cron.d/awstats is run as user www-data.
It breaks when trying to write to a temporary file in awstats subdirectory under each domain e.g. /home/yourdomain/awstats/ where www-data user is not allowed to write

I had the same problem. On some systems with Debian 6 it works automatically preconfigured when you install it, on others it doesn’t…

BOTH lines in /etc/cron.d/awstats need a comment sign (#) at the beginning so that they are deactivated…

Then awstats should be working fine…

No, it doesn’t even work when I corrected this file… this Virtualmin misconfiguration of awstats is a big problem… I don’t know where the error could … the cron doesn’tt execute automatically… and even when I initiate an awstats update manually the update is endless… say, it never stops although the data to process (the logfile) is very little…

Anybody got more ideas where the error in Virtualmin could be ???

Awstats: I have Same big problem here
Looks same issue as on this thread:


I still couldn’t really fix this issue, but I will give it a guess… it only happens on my VPS server with the lowest performance… Could it be related to Virtualmin running on a system with 512MB RAM ??? maybe during the daily log rotation and awStats run it gets stuck due to low ressources ???