Discussion:
Starting 9/15 new error - stat of /var/log/clamav/clamd.log failed
Add Reply
David C. Rankin
2018-09-21 05:37:14 UTC
Reply
Permalink
Archdevs,

Is this a new bug or config issue? Beginning 9/15, I receive a new cron error:

error: stat of /var/log/clamav/clamd.log failed: No such file or directory

But the file is there:

$ l /var/log/clamav/clamd.log
-rw-r--r-- 1 clamav clamav 0 Aug 30 2015 /var/log/clamav/clamd.log


The wiki https://wiki.archlinux.org/index.php/ClamAV doesn't mention the
issue, so is this a bug? If so, upstream or here?
--
David C. Rankin, J.D.,P.E.
David C. Rankin
2018-09-21 21:48:14 UTC
Reply
Permalink
Post by David C. Rankin
$ l /var/log/clamav/clamd.log
-rw-r--r-- 1 clamav clamav 0 Aug 30 2015 /var/log/clamav/clamd.log
Could be a permissions issue. If a user cannot access /example/ then
it cannot see if /example/test exists and will give a no such file or
directory error.
Well, that what I was investigating, but the log is world readable, so that
can't be the case -- and the only permissions needed to stat a file is read
permission.

Also suspect is the log file is empty and 3 years old, so I'm not sure what is
going on with it, but I do know I never got an error about it until 9/15.
--
David C. Rankin, J.D.,P.E.
Ralph Corderoy
2018-09-22 08:06:14 UTC
Reply
Permalink
Hi David,
Post by David C. Rankin
-rw-r--r-- 1 clamav clamav 0 Aug 30 2015 /var/log/clamav/clamd.log
...
and the only permissions needed to stat a file is read permission.
The permissions of clamd.log are ignored when stat(2)ing it. One can
stat a `chmod 0' file. What matters is execute permission on the four
directories leading to it.

Also, don't trust the error message if it seems incorrect. Track down
the cron job and edit it to use strace(1) to learn what system calls
fail and how.
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
Tinu Weber
2018-09-22 08:14:30 UTC
Reply
Permalink
Post by David C. Rankin
Post by David C. Rankin
$ l /var/log/clamav/clamd.log
-rw-r--r-- 1 clamav clamav 0 Aug 30 2015 /var/log/clamav/clamd.log
Could be a permissions issue. If a user cannot access /example/ then
it cannot see if /example/test exists and will give a no such file or
directory error.
Well, that what I was investigating, but the log is world readable, so that
can't be the case -- and the only permissions needed to stat a file is read
permission.
So *all* the parent directories (/var, /var/log, and /var/log/clamav)
are world-readable?

The permissions on /var/log/clamav/clamd.log don't really matter - it
could have permissions 0000 ({read,writ,execut}able by nobody), and one
could still stat it correctly.

Best,
--Tinu

David Rosenstrauch
2018-09-21 22:09:36 UTC
Reply
Permalink
Post by David C. Rankin
Archdevs,
error: stat of /var/log/clamav/clamd.log failed: No such file or directory
$ l /var/log/clamav/clamd.log
-rw-r--r-- 1 clamav clamav 0 Aug 30 2015 /var/log/clamav/clamd.log
The wiki https://wiki.archlinux.org/index.php/ClamAV doesn't mention the
issue, so is this a bug? If so, upstream or here?
I have to think this is something you're triggering yourself. ClamAV
doesn't seem to ship with any cron jobs. (See "pacman -Ql clamav | grep
cron") So this must be either a cron job you've added yourself, or some
old one that's left hanging around.

As far as the clamd log file, I think it's normal to be empty if you're
not running clam as a daemon. That's how mine is:

$ ls -l /var/log/clamav/clamd.log
-rw-r--r-- 1 clamav clamav 0 May 5 2013 /var/log/clamav/clamd.log

Only other remaining explanations I could offer are:

* The drive that /var/log/clamav is on is damaged and unreadable. (See
if you see any errors in either dmesg or /var/log/messages)

* You have a permissions issue on either /var/log/clamav, /var/log, or
/var, whereby the user running the cronjob doesn't have read or execute
permissions to one of those directories.

HTH,

DR
Loading...