I have Virtualmin installed on my server running Ubuntu 10.04. I am having an issue with the cache files in the directory /etc/webmin/security-updates eating up all the disk space on the server. More and more files appear in this folder until the server crashes and I have to go in and manually delete them all.
Is there any way to periodically delete these files automatically?
FYI the files look like this “available.cache1.webmintmp.9914” where the number at the end just keeps counting up.
Note: this is a sample of files, there are waaay more in the folder.
lsattr yields these results:
------------------- ./available.cache1.webmintmp.29959
------------------- ./available.cache1.webmintmp.30092
------------------- ./available.cache1.webmintmp.30222
------------------- ./available.cache1.webmintmp.16010
------------------- ./available.cache1.webmintmp.6078
------------------- ./available.cache1.webmintmp.29697
I tried that just now and it simply runs the script then exits, no error messages, no output whatsoever. I checked the files in the directory before and after, and they were the same.
The file does exist, I was only showing part of the thousands of available.cache… files that were in the folder. Here is the permissions of available.cache1: #ls -l available.cache1
-rw-r–r-- 1 root root 13582299 2011-01-23 12:30 available.cache1
lsattr available.cache1
------------------- available.cache1
And the permissions on /etc/webmin/security-updates: drwxr-xr-x 2 root root 163840 2011-01-24 00:09 security-updates
Looks to me like they are both writable (by root anyway).
I can touch /etc/webmin/security-updates as well.
I was thinking maybe that the script is being run by something other than root. Does the following line of syslog imply that the collectinfo.pl script is being run by root?
Jan 24 00:09:01 squareoneit CRON[15375]: (root) CMD (/etc/webmin/virtual-server/collectinfo.pl)
I am totally stumped on this. I just keep having to delete all the excess files every couple of days. Very frustrating!
Hmmm, this is strange. I just tried running /etc/webmin/virtual-server/collectinfo.pl again, and it gave me this error: Out of memory!
Terminated
Every time I try re-running this script, including when I’ve deleted all the available.cache1.* files, I get that same error. I tried checking the processes using top in a separate terminal whilst running the command and it appears that the memory usage for collectinfo.pl spikes at one point, then quits with that error.
Is it a memory leak in the script itself?
Here is the contents of /etc/webmin/virtual-server/collectinfo.pl:
#!/usr/bin/perl
open(CONF, “/etc/webmin/miniserv.conf”);
while() {
$root = $1 if (/^root=(.*)/);
}
close(CONF);
$ENV{‘PERLLIB’} = “$root”;
$ENV{‘WEBMIN_CONFIG’} = “/etc/webmin”;
$ENV{‘WEBMIN_VAR’} = “/var/webmin”;
chdir("$root/virtual-server");
exec("$root/virtual-server/collectinfo.pl", @ARGV) || die “Failed to run $root/virtual-server/collectinfo.pl : $!”;
Yes, it looks like the collectinfo.pl was crashing due to lack of RAM, causing incomplete temp files to be left behind. The next version of the security-updates module for Virtualmin will reduce RAM usage significantly in this case, and will fix the problem. We plan to release this new version this week …
So I was quite right with my initial assumption “Those “webmintmp” files sound to me like Webmin was unable to complete some “store stuff temporarily, then later rename/merge/delete files” operation.”, even though for a different reason.
Yes - whenever Webmin writes to any important file, it will first create a file with webmintmp in the name, write to that, and then rename it over the original file. This avoids the problem of a file being partially written due to lack of disk space - not fun if it happens to /etc/passwd .
I just wanted to reply and confirm that everything has been working perfectly for the last week or so since the update was made. The memory problem also appears to be what was causing our DNS server to drop out every couple of days, because that is fixed now too!
Thanks so much for all of your help, the support for this product is incredibly impressive even at the GPL level!