Page 1 of 1

can not update Clamav virus database

Posted: Tue Mar 15, 2016 10:13 am
by baijianpeng
I saw Clamav virus database updating warning in the log file. So I tried to update the virus database manually:

Code: Select all

[root@ ~]# sudo freshclam
ERROR: Can't create temporary directory /var/lib/clamav/clamav-9cf77befbabaa420357e9f96c9845c29.tmp
Hint: The database directory must be writable for UID 1001 or GID 1001
It seems that some file/directory permission error occurred.

How to solve this ?

Thank you.

Re: can not update Clamav virus database

Posted: Tue Mar 15, 2016 9:38 pm
by skamasle
Try chmod 775 clamav directory.

Re: can not update Clamav virus database

Posted: Wed Mar 16, 2016 12:05 am
by baijianpeng
I tried your suggestion, it did not work:

Code: Select all

[root@ ~]# chmod 775 /var/lib/clamav/
[root@ ~]# sudo freshclam
ERROR: Can't create temporary directory /var/lib/clamav/clamav-b66cc590377020bed528d61f99a29b2e.tmp
Hint: The database directory must be writable for UID 1001 or GID 1001
But your idea inspired me. I changed permission to 777, then the virus database can be updated. After updating finished, I changed the permission back to 755.

Is this a safe way?

Thank you.

Re: can not update Clamav virus database

Posted: Wed Mar 16, 2016 7:15 pm
by skamasle
baijianpeng wrote:I tried your suggestion, it did not work:

Code: Select all

[root@ ~]# chmod 775 /var/lib/clamav/
[root@ ~]# sudo freshclam
ERROR: Can't create temporary directory /var/lib/clamav/clamav-b66cc590377020bed528d61f99a29b2e.tmp
Hint: The database directory must be writable for UID 1001 or GID 1001
But your idea inspired me. I changed permission to 777, then the virus database can be updated. After updating finished, I changed the permission back to 755.

Is this a safe way?

Thank you.
Why not ?

I think problem are owener of that dir.

Re: can not update Clamav virus database

Posted: Thu Mar 17, 2016 12:46 am
by baijianpeng
I checked that directory, the owner is :

Code: Select all

[root@ lib]# ls clam* -dl
drwxr-xr-x 2 775 clamupdate 4096 Mar 16 08:06 clamav
According to former warning message, it should be "writable for UID 1001 or GID 1001". But I don't know how to change the owner to UID 1001 or GID 1001.

Maybe if I change the owner to correct one, then Clamav will be updated automatically.

Re: can not update Clamav virus database

Posted: Thu Mar 17, 2016 6:54 am
by pandabb
chown clam:clam ?

Re: can not update Clamav virus database

Posted: Thu Mar 17, 2016 10:11 am
by baijianpeng
Correct!

Code: Select all

[root@  ~]# chown clam:clam /var/lib/clamav/
[root@  ~]# sudo freshclam
ClamAV update process started at Thu Mar 17 18:10:41 2016
Thank you!

Re: can not update Clamav virus database

Posted: Mon Aug 30, 2021 8:04 am
by thunder1
baijianpeng wrote:
Thu Mar 17, 2016 10:11 am
Correct!

Code: Select all

[root@  ~]# chown clam:clam /var/lib/clamav/
[root@  ~]# sudo freshclam
ClamAV update process started at Thu Mar 17 18:10:41 2016
Thank you!
Thanks, this solved the issue!

Re: can not update Clamav virus database

Posted: Sun Nov 07, 2021 5:31 pm
by Ankyurtgtgtg
I suppose that you cannot update clamav database due to it being locked by running daemon. Presumably Ubuntu proceeds with an automatic update.