AWstats broken in Debian 6.0 squeeze

8 posts / 0 new
Last post
#1 Sat, 03/05/2011 - 14:30
Hal9000

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/awstats.example.com.conf" by AWStats version 6.95 (build 1.943)
From data in log file "/home/example.com/logs/access_log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 203)
Error: Couldn't open file "/home/example.com/awstats/awstats032011.example.com.tmp.31875" for write: Permission denied
Setup ('/etc/awstats/awstats.example.com.conf' 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 example.com example.com 4096 Mar  4 14:27 awstats

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

Sat, 03/05/2011 - 14:33
Hal9000

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

Cron <www-data@neptune> [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh

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

Sat, 03/05/2011 - 14:40
Hal9000

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

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

# Generate static reports:
10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh

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/awstats.pl -a -f /etc/awstats/awstats.conf -a -r /var/log/apache/access.log ] && /usr/lib/cgi-bin/awstats.pl -config=awstats -update >/dev/null

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

Wed, 12/28/2011 - 12:08 (Reply to #3)
web_support@web...

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

Sat, 10/27/2012 - 03:31
marco1492
marco1492's picture

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...

Mon, 10/29/2012 - 11:49
marco1492
marco1492's picture

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 ????

Tue, 11/13/2012 - 13:18
beat

Awstats: I have Same big problem here Looks same issue as on this thread: https://www.virtualmin.com/node/21766#comment-108213

?

Thu, 05/16/2013 - 15:36
marco1492
marco1492's picture

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 ????

Topic locked