mkCDrec Make CD-ROM Recovery
Clam AntiVirus Utilitiy

Cookbook on how Clam AntiVirus was added to mkCDrec Utilities

First of all download the latest release of clamav from Unpack it as following:

# tar zxvf clamav-0.60.tar.gz

As of this writing version 0.60 was the latest stable release. Of course, download the newest version.

As first step declare the group and user clamav to our system (test system was running RedHat 9.0). Please note, that below commands may vary from system to system.

# groupadd clamav
# useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav

Make sure you download the latest version of mkcdrec and mkcdrec_utilities from mkCDrec's download page and install as described:

# tar xzvf mkCDrec_v0.7.4.tar.gz
# cd mkcdrec
# tar zxvf ../mkCDrec_v0.7.1_utils.tar.gz

Go into mkCDrec directory and add to the "etc/passwd" file the following:

clamav:x:501:501:Clam Antivirus:/home/clamav:/bin/false

and to the "etc/group" file:


and to the "/etc/shadow" file:


Enter the directory of clamav and execute the following set of commands:

$ ./configure --prefix=/usr --sysconfdir=/etc
$ make
$ su -c "make install"

Edit the clamav configuration file "/etc/clamav.conf". Below you see only the uncommented lines:

LocalSocket /tmp/clamd
MaxDirectoryRecursion 15
User clamav
ArchiveMaxFileSize 10M 
ArchiveMaxRecursion 5 
ArchiveMaxFiles 1000

Now you may copy this configuration file to mkcdrec:

# cp /etc/clamav.conf mkcdrec/etc/

Enter the mkcdrec/utilities directory and execute the following:

# mkdir -p clamav/bin
# mkdir -p clamav/lib
# mkdir -p clamav/db

To copy the clamav executables into there new spot do the following:

# cd mkcdrec/utilities/clamav
# ls
bin  db  lib
# objcopy -S /usr/bin/clamscan bin/clamscan
# objcopy -S /usr/bin/sigtool bin/sigtool
# objcopy -S /usr/bin/freshclam bin/freshclam

Check which libraries "clamscan" needs with ldd:

# ldd /usr/bin/clamscan => /usr/lib/ (0x4002b000) => /usr/lib/ (0x40043000) => /lib/tls/ (0x40051000) => /lib/tls/ (0x42000000)
        /lib/ => /lib/ (0x40000000)

We have to make sure all those shared libraries will be included when we compile the rescue image. After you ran "make rescue" inspect the mkcdrec.log file to see whether all those libraries were detected and included. If not, then do the following as for

# cp /usr/lib/libclamav.a lib/
# cp /usr/lib/ lib/
# cp /usr/lib/ lib/
# cd lib
# ln -s
# ln -s

We have to add the following line to mkcdrec/etc/


It is always nice to have some essential man pages concerning clamav on the rescue CD-ROM. Therefore, do the following:

# cd mkcdrec/usr/man
# man clamscan | ul -t dumb | gzip -c >clamscan.gz
# man freshclam | ul -t dumb | gzip -c >freshclam.gz
# man sigtool | ul -t dumb | gzip -c >sigtool.gz
# man clamav.conf | ul -t dumb | gzip -c >clamav.conf.gz

We still have to copy the virus database and signatures to the utilities. Clamav expect them to be in /usr/man/share/clamav. Therefore, we foresee a link:

# cd mkcdrec/usr/share
# ln -s /mnt/cdrom/utilities/clamav/db clamav

Before copying them we better download the latest databases. If needed define a http proxy, e.g.

export http_proxy=""

and finally use the freshclam binary to download these:

# freshclam
Current working dir is /usr/share/clamav
Checking for a new database - started at Sun Oct 26 14:45:09 2003
Connected to
Reading md5 sum (viruses.md5): OK
viruses.db is up to date.
Reading md5 sum (viruses2.md5): OK
Downloading viruses.db2 ....... done
Database updated (containing in total 9882 signatures).
Database updated from

We copy the clamav virus databases to:

# cp /usr/share/clamav/* utilities/clamav/db/
# chown -R clamav:clamav utilities/clamav/db

As a last step before actually making the image is to set up some symbolic links in the mkcdrec/ file. Search for "LINKS=" and add to the already long list the following:


Insert (preferably) a CD-RW into the CD-writer and run:

# cd mkcdrec
# make test
make test output of mkCDrec v0.7.5
Test 1:  Are we root?                                           Passed
Test 2:  missing executables needed by mkCDrec                  Passed
Test 3:  Filesystem for Initial ramdisk allowed?                Passed
Test 4:  loopback device works?                                 Passed
Test 5:  ram device available                                   Passed
Test 6:  romfs supported  by the kernel?                        N/A
Test 7:  cramfs supported  by the kernel?                       N/A
Test 8:  strip (from binutils) available?                       Passed
Test 9:  BOOT_FLOPPY_DENSITY=ED ok?                             Passed
Test 10: cdrecord -scanbus                                      Passed
Test 11: Header files present?                                  Passed
Test 12: DEVFS supported by kernel?                             N/A
Test 13: filesystem tools present?
        ext2:                                                   Passed
        ext3:                                                   Passed
Test 14: initrd must be compiled in kernel!                     Passed
Test 15: Amount of memory available                             261 Mb
Test 16: scripts/ a link?                              Passed
Test 17: serial console                                         N/A
Test 18: supported architecture?                                Passed

# make rescue

and wait until the CD-RW is written.

Do not forget to inspect the mkcdrec.log file for missing libraries! Otherwise, we need to add these as we did for clamav. To test the CD, simply reboot and wait until mkCDrec's menu appears and select option 2 (rescue mode). Login and use clamav as following:

# mount /dev/hda1 /mnt/localfs
# clamscan -r /mnt/localfs


Do not hesitate to visit the web sites listed below:

IT3 Support needed?
   Support mkCDrec    IT3 Consultants    Valid XHTML 1.0 Transitional SourceForge