LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-17-2009, 07:31 AM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 51
Can't lock database directory: /var/lib/clamav/


hi

I have clamav installed on Debian Etch:
Code:
# dpkg -l | grep clamav
ii  clamav                            0.90.1dfsg-4etch19                              antivirus scanner for Unix
ii  clamav-base                       0.90.1dfsg-4etch19                              base package for clamav, an anti-virus utili
ii  clamav-daemon                     0.90.1dfsg-4etch19                              antivirus scanner daemon
ii  clamav-freshclam                  0.90.1dfsg-4etch19                              downloads clamav virus databases from the In
ii  libclamav2                        0.90.1dfsg-4etch19                              virus scanner library
If I start freshclam then I'm getting this Error message:
Code:
# freshclam                                                        
ERROR: Can't lock database directory: /var/lib/clamav/
Code:
# cd  /var/lib/clamav/
# ls -la
total 748
drwxr-xr-x  3 clamav clamav   4096 2009-06-16 11:31 .
drwxr-xr-x 45 root   root     4096 2009-06-16 11:18 ..
-rw-r--r--  1 clamav clamav 744484 2009-06-16 11:19 daily.cvd
-rwxrwxr--  1 clamav clamav      0 2009-06-16 12:33 .dbLock
drwxr-xr-x  2 clamav clamav   4096 2009-06-16 11:19 main.inc
-rw-------  1 clamav clamav    104 2009-06-16 11:30 mirrors.dat
howto solve this problem?
 
Old 06-17-2009, 08:13 AM   #2
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359
Blog Entries: 1

Rep: Reputation: 31
In my experience you often need to run antivirus as root. Depending on different distribution it varies.
Try running FreshClam as root and see what that happens.
 
Old 06-17-2009, 08:15 AM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by Steel_J View Post
In my experience you often need to run antivirus as root. Depending on different distribution it varies.
Try running FreshClam as root and see what that happens.
that was running as root user
 
Old 06-17-2009, 08:24 AM   #4
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Is it already running? If you can reboot, does that clear it up? If it's actually not running there's probably a lock file you have to remove. Try /etc/init.d/clamav-freshclam restart
 
Old 06-17-2009, 05:52 PM   #5
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359
Blog Entries: 1

Rep: Reputation: 31
Sorry I replied from my mobile phone so the text is really tiny...

My bad!

I have seen bugs like this in other software where removing the lock file is a common fix.

You may have to reboot for this to be succesfull though.
 
Old 06-17-2009, 06:51 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Since /var/lib/clamav is owned by clamav, it shouldn't be just a permissions problem. Have you tried stopping all of the *clam* processes and removing /var/lib/clamav/.dbLock? The only info I saw using google that might be relevant was here (as Steel_J noted in his post), although according to this you might get some more data by running:
Code:
strace clamav &> strace.dump
egrep '^open|exec' strace.dump
I'd also recommend checking the logs (/var/log/freshclam.log and /var/log/clamd.log?) for more info.
 
Old 06-23-2009, 07:39 PM   #7
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
to remove .dbLock doesn't help, because will be created again.
 
Old 06-23-2009, 07:45 PM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Are you sure you are using the clamav user? IIRC, frechclam picks up user info from clamd.conf (or similar). There should be a user specified in there ("User clamav" for example).
 
Old 06-23-2009, 07:50 PM   #9
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by billymayday View Post
Are you sure you are using the clamav user? IIRC, frechclam picks up user info from clamd.conf (or similar). There should be a user specified in there ("User clamav" for example).
the clamav user already exists and ist configured in /etc/clamav/clamd.conf

Last edited by cccc; 06-24-2009 at 01:49 AM.
 
Old 06-23-2009, 08:03 PM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
That wasn't the point of my post if you re-read it. Do you have a clamd.conf (or similar under Debian), and what is the prescibed user nominated in it.
 
Old 06-24-2009, 01:51 AM   #11
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
my /etc/clamav/clamd.conf:
Code:
#Automatically Generated by clamav-base postinst
#To reconfigure clamd run #dpkg-reconfigure clamav-base
#Please read /usr/share/doc/clamav-base/README.Debian.gz for details
LocalSocket /var/run/clamav/clamd.ctl
FixStaleSocket true
User clamav
AllowSupplementaryGroups true
ScanMail true
ScanArchive true
ArchiveMaxRecursion 5
ArchiveMaxFiles 1000
ArchiveMaxFileSize 10M
ArchiveMaxCompressionRatio 250
ArchiveLimitMemoryUsage false
ArchiveBlockEncrypted false
MaxDirectoryRecursion 15
FollowDirectorySymlinks false
FollowFileSymlinks false
ReadTimeout 180
MaxThreads 12
MaxConnectionQueueLength 15
StreamMaxLength 10M
LogSyslog false
LogFacility LOG_LOCAL6
LogClean false
LogVerbose false
PidFile /var/run/clamav/clamd.pid
DatabaseDirectory /var/lib/clamav
TemporaryDirectory /tmp
SelfCheck 3600
Foreground false
Debug false
ScanPE true
ScanOLE2 true
ScanHTML true
DetectBrokenExecutables false
MailFollowURLs false
ArchiveBlockMax false
ExitOnOOM false
LeaveTemporaryFiles false
AlgorithmicDetection true
ScanELF true
NodalCoreAcceleration false
IdleTimeout 30
MailMaxRecursion 64
PhishingSignatures true
LogFile /var/log/clamav/clamav.log
LogTime true
LogFileUnlock false
LogFileMaxSize 0
 
Old 06-24-2009, 02:03 AM   #12
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Have you confirmed some other clamav process hasn't already got it locked?

Try "ps aux | grep clam"
 
Old 06-24-2009, 11:14 AM   #13
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by billymayday View Post
Have you confirmed some other clamav process hasn't already got it locked?

Try "ps aux | grep clam"
Code:
# freshclam
ERROR: Can't lock database directory: /var/lib/clamav/
# ps aux | grep clam
clamav    2448 99.4  3.6  52956 47840 ?        Rs   17:34  37:51 /usr/sbin/clamd
clamav    2535  0.0  0.0   5488   700 ?        Ss   17:34   0:00 /usr/bin/freshclam -d --quiet
root      2929  0.0  0.0   2852   696 pts/0    D+   18:12   0:00 grep clam
 
Old 06-24-2009, 11:34 AM   #14
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
See, it's already running.
 
Old 06-24-2009, 03:50 PM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Quote:
Originally Posted by AlucardZero View Post
See, it's already running.
Clamd running shouldn't cause freshclam a problem
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable) phreakshew Linux - Newbie 24 04-12-2019 10:42 AM
Unable to lock the administration directory (/var/lib/dpkg/) cccc Debian 11 12-05-2017 08:33 PM
could not get lock /var/lib/dpkg/ netstat Debian 1 09-08-2008 08:52 PM
Could not get lock /var/lib/dpkg/lock thelonius Debian 5 07-31-2006 07:48 PM
error:cannot get exclusive lock on /var/lib/rmp/packages mateka Linux - Newbie 1 06-26-2004 10:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration