Ubuntu – Can’t run Freshclam


root@msy-Inspiron-One-2020:/home/msy# freshclam
ERROR: Missing argument for option at line 33
ERROR: Can't open/parse the config file /usr/local/etc/freshclam.conf

Here is /usr/local/etc/freshclam.conf:

DatabaseDirectory /var/lib/clamav

## Example config file for freshclam
## Please read the clamav.conf(5) manual before editing this file.
## This file may be optionally merged with clamav.conf.

# You can change the default database directory here.
#DatabaseDirectory /var/lib/clamav
DatabaseDirectory /usr/local/clamav/share/clamav

# Path to the log file (make sure it has proper permissions)
UpdateLogFile /var/log/freshclam.log

# Enable verbose logging.    

# Use system logger (can work together with UpdateLogFile).

# By default when freshclam is started by root it drops privileges and
# switches to the "clamav" user. You can change this behaviour here.
#DatabaseOwner clamav

# The main database mirror is database.clamav.net (this is a round-robin
# DNS that points to many mirrors on the world) and in most cases you
# SHOULD NOT change it.
DatabaseMirror database.clamav.net

# How many attempts to make before giving up.
MaxAttempts 3

# How often check for a new database. We suggest checking for it every
# two hours.    
Checks 12

# Proxy settings
#HTTPProxyServer myproxy.com
#HTTPProxyPort 1234
#HTTPProxyUsername myusername
#HTTPProxyPassword mypass    

# Send the RELOAD command to clamd.
#NotifyClamd [/optional/config/file/path]

# Run command after database update.
#OnUpdateExecute command

# Run command if database update failed.    
#OnErrorExecute command

What's wrong with it?

Best Answer

You're running a default example of the freshclam config file that is missing all sorts of settings.

If you run:

sudo dpkg-reconfigure clamav-freshclam

it will create a new freshclam.conf file in the /etc/clamav/ folder.

Remove the existing freshclam.conf file from the /usr/local/etc/ folder.

sudo rm -f /usr/local/etc/freshclam.conf

Then create a link to the new file so that if you ever have to run it again, the conf file stays updated.

sudo ln -s /etc/clamav/freshclam.conf /usr/local/etc/freshclam.conf

Then run freshclam to update.

sudo freshclam

You might get this error: freshclam: error while loading shared libraries: libclamav.so.7: cannot open shared object file: No such file or directory, which can be fixed by running:

sudo apt-get install --reinstall libclamav6

Or for Ubuntu 16.04:

sudo apt-get install --reinstall libclamav7

Or, I haven't tried this one yet, but it has been said that it works on any distro:

sudo ldconfig
Related Question