clamav upgrade bug stops other upgrades prcessing correctly

Asked by Alan

A recent (reported yesterday) bug in the CLAMAV upgrade process seems to have made it impossible to upgrade any part of my system.

One thing that might be relevant - once my upgrade to 16:04 was completed the CLAMAV Daemon and Freshclam Daemon would not be started, and would no longer longer run if run by command. However this did not seem to affect the operation of CLAMAV malware system either as a email malware detector or as a standard file malware checker.

The errors coming from my startup script (reproduced below) would indicate that the CLAMAV upgrade process expects these daemons to be running, and the errors seem to start when the process cannot detect/stop the daemons.

I have reported / confirmed the bug.

I would appreciate any advice on this issue.

Thanks
Alan

My System:
/==================================
Fri Sep 02 10:39 /home/alan => hostnamectl status
   Static hostname: DALEK-UB
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: b4fa9fa1ef2f208b0154856d55df53b9
           Boot ID: 7e8a0d8c22c04c45b04356a46acd0d02
  Operating System: Ubuntu 16.04.1 LTS
            Kernel: Linux 4.4.0-36-generic
      Architecture: x86-64
//=============================================

The update script I run every morning:
//=============================================

## Bash shell
## APDW 5/9/2015 startup
# run updates and cleanup
echo
echo Startup script running
echo apt-get update running
echo
apt-get update
echo
echo apt-get update complete
echo
echo apt-get dist-upgrade running
echo
apt-get dist-upgrade
echo
echo apt-get dist-upgrade complete
echo
echo apt-get upgrade running
echo
apt-get upgrade
echo
echo apt-get upgrade complete
echo
echo apt-get autoclean running
echo
apt-get autoclean
echo
echo apt-get autoclean complete
echo
echo apt-get autoremove running
echo
apt-get autoremove
echo
echo autoremove complete
echo

# stop daemons including nessus daemon, refresh ClamAV sigs and restart Clamav daemons

echo Refresh ClamAV sigs and restart the deamon
echo
echo stopping daemons
echo
# stop nessus it starts automatically
service nessusd stop

#service clamav-daemon stop no longer needed clamav daemon doesnt run under 16.04
#service freshclam-daemon stop no longer needed daemon doesnt run under 16.04
service clamav-freshclam stop
echo
echo daemons stopped
echo
echo running freshclam
echo
freshclam
echo
echo starting daemon
service clamav-freshclam start
#service clamav-daemon start no longer needed
#service freshclam-daemon start no longer needed
echo
echo Done
echo

echo starting unclutter
unclutter &
echo
echo All Done
echo
//====================================================================

Terminal output from the script
//======================================================================
Fri Sep 02 10:25 /home/alan => sudo ./startup
[sudo] password for alan:

Startup script running
apt-get update running

Ign:1 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial InRelease
Ign:2 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial Release
Ign:3 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 Packages
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Ign:5 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main i386 Packages
Hit:6 http://gb.archive.ubuntu.com/ubuntu xenial InRelease
Ign:7 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main all Packages
Hit:8 http://gb.archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:9 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en_GB
Ign:10 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en
Ign:11 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 DEP-11 Metadata
Ign:12 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main DEP-11 64x64 Icons
Ign:3 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 Packages
Ign:5 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main i386 Packages
Ign:7 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main all Packages
Ign:9 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en_GB
Ign:10 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en
Ign:11 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 DEP-11 Metadata
Ign:12 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main DEP-11 64x64 Icons
Ign:3 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 Packages
Ign:5 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main i386 Packages
Ign:7 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main all Packages
Ign:9 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en_GB
Ign:10 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en
Ign:11 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 DEP-11 Metadata
Ign:12 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main DEP-11 64x64 Icons
Ign:3 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 Packages
Ign:5 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main i386 Packages
Ign:7 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main all Packages
Ign:9 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en_GB
Ign:10 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en
Ign:11 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 DEP-11 Metadata
Ign:12 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main DEP-11 64x64 Icons
Ign:3 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 Packages
Ign:5 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main i386 Packages
Ign:7 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main all Packages
Ign:9 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en_GB
Ign:10 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en
Ign:11 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 DEP-11 Metadata
Ign:12 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main DEP-11 64x64 Icons
Err:3 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 Packages
  404 Not Found
Ign:5 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main i386 Packages
Ign:7 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main all Packages
Ign:9 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en_GB
Ign:10 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main Translation-en
Ign:11 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main amd64 DEP-11 Metadata
Ign:12 http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial/main DEP-11 64x64 Icons
Fetched 94.5 kB in 1s (54.1 kB/s)
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

apt-get update complete

apt-get dist-upgrade running

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  clamav-daemon gnome-sudoku
2 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
1 not fully installed or removed.
Need to get 754 kB/949 kB of archives.
After this operation, 65.5 kB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 gnome-sudoku amd64 1:3.18.4-0ubuntu2 [754 kB]
Fetched 754 kB in 1s (609 kB/s)
Preconfiguring packages ...
(Reading database ... 356701 files and directories currently installed.)
Preparing to unpack .../clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb ...
Failed to stop clamav-daemon.socket: Unit clamav-daemon.socket not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead ...
Failed to stop clamav-daemon.socket: Unit clamav-daemon.socket not loaded.
dpkg: error processing archive /var/cache/apt/archives/clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 5
insserv: script virtualbox: service vboxdrv already provided!
insserv: script virtualbox: service virtualbox already provided!
Failed to start clamav-daemon.service: Unit clamav-daemon.socket is not loaded properly: Invalid argument.
See system logs and 'systemctl status clamav-daemon.service' for details.
invoke-rc.d: initscript clamav-daemon, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Preparing to unpack .../gnome-sudoku_1%3a3.18.4-0ubuntu2_amd64.deb ...
Unpacking gnome-sudoku (1:3.18.4-0ubuntu2) over (1:3.18.2-1) ...
Processing triggers for libglib2.0-0:amd64 (2.48.1-1~ubuntu16.04.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160701-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt-get dist-upgrade complete

apt-get upgrade running

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  clamav-daemon
1 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
Need to get 0 B/195 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 356701 files and directories currently installed.)
Preparing to unpack .../clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb ...
Failed to stop clamav-daemon.socket: Unit clamav-daemon.socket not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead ...
Failed to stop clamav-daemon.socket: Unit clamav-daemon.socket not loaded.
dpkg: error processing archive /var/cache/apt/archives/clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 5
insserv: script virtualbox: service vboxdrv already provided!
insserv: script virtualbox: service virtualbox already provided!
Failed to start clamav-daemon.service: Unit clamav-daemon.socket is not loaded properly: Invalid argument.
See system logs and 'systemctl status clamav-daemon.service' for details.
invoke-rc.d: initscript clamav-daemon, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt-get upgrade complete

apt-get autoclean running

Reading package lists... Done
Building dependency tree
Reading state information... Done

apt-get autoclean complete

apt-get autoremove running

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  clamav-daemon
Suggested packages:
  clamav-docs daemon
The following packages will be upgraded:
  clamav-daemon
1 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
Need to get 0 B/195 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 356701 files and directories currently installed.)
Preparing to unpack .../clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb ...
Failed to stop clamav-daemon.socket: Unit clamav-daemon.socket not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead ...
Failed to stop clamav-daemon.socket: Unit clamav-daemon.socket not loaded.
dpkg: error processing archive /var/cache/apt/archives/clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 5
insserv: script virtualbox: service vboxdrv already provided!
insserv: script virtualbox: service virtualbox already provided!
Failed to start clamav-daemon.service: Unit clamav-daemon.socket is not loaded properly: Invalid argument.
See system logs and 'systemctl status clamav-daemon.service' for details.
invoke-rc.d: initscript clamav-daemon, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/clamav-daemon_0.99+dfsg-1ubuntu1.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

autoremove complete

Refresh ClamAV sigs and restart the deamon

stopping daemons

daemons stopped

running freshclam

ClamAV update process started at Fri Sep 2 10:27:15 2016
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.99 Recommended version: 0.99.2
DON'T PANIC! Read http://www.clamav.net/support/faq
main.cvd is up to date (version: 57, sigs: 4218790, f-level: 60, builder: amishhammer)
daily.cld is up to date (version: 22171, sigs: 573036, f-level: 63, builder: neo)
bytecode.cld is up to date (version: 283, sigs: 53, f-level: 63, builder: neo)

starting daemon

Done

starting unclutter

All Done

Fri Sep 02 10:27 /home/alan =>

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Alan
Solved:
Last query:
Last reply:
Revision history for this message
Alan (alan-pd-watson) said :
#1

Following some hints on a related thread, as the key issue is the none installation / starting of the clamav-daemon and the clamav-daemon.socket, I tried this:

 Wed Sep 07 18:09 /home/alan => sudo service clamav-daemon start
Failed to start clamav-daemon.socket: Unit clamav-daemon.socket is not loaded properly: Invalid argument.
See system logs and 'systemctl status clamav-daemon.socket' for details.
Failed to start clamav-daemon.service: Unit clamav-daemon.socket is not loaded properly: Invalid argument.
See system logs and 'systemctl status clamav-daemon.service' for details.
Wed Sep 07 18:10 /home/alan => systemctl status clamav-daemon.socket
● clamav-daemon.socket - Socket for Clam AntiVirus userspace daemon
   Loaded: error (Reason: Invalid argument)
  Drop-In: /etc/systemd/system/clamav-daemon.socket.d
           └─extend.conf
   Active: inactive (dead)
     Docs: man:clamd(8)
           man:clamd.conf(5)
           http://www.clamav.net/lang/en/doc/

Sep 07 17:54:31 DALEK-UB systemd[1]: [/etc/systemd/system/clamav-daemon.socket.d/extend.conf:4] Failed to parse address value, i
Sep 07 17:54:31 DALEK-UB systemd[1]: clamav-daemon.socket: Unit lacks Listen setting. Refusing.
Sep 07 17:54:32 DALEK-UB systemd[1]: [/etc/systemd/system/clamav-daemon.socket.d/extend.conf:4] Failed to parse address value, i
Sep 07 17:54:32 DALEK-UB systemd[1]: clamav-daemon.socket: Unit lacks Listen setting. Refusing.
lines 1-13/13 (END)

extend.conf contains the following:
//==============================================

Wed Sep 07 18:21 /etc/systemd/system/clamav-daemon.socket.d => more extend.conf
[Socket]
ListenStream=
SocketUser=clamav
ListenStream=localhost:3310
Wed Sep 07 18:21 /etc/systemd/system/clamav-daemon.socket.d =>
//==============================================

Does this shine akly light on the issue?

Revision history for this message
Alan (alan-pd-watson) said :
#2

Hi Again,

I just ran the following:

//==================================================================================
Wed Sep 07 18:37 /etc/systemd/system/clamav-daemon.socket.d => systemctl status clamav-daemon.socket
● clamav-daemon.socket - Socket for Clam AntiVirus userspace daemon
   Loaded: error (Reason: Invalid argument)
  Drop-In: /etc/systemd/system/clamav-daemon.socket.d
           └─extend.conf
   Active: inactive (dead)
     Docs: man:clamd(8)
           man:clamd.conf(5)
           http://www.clamav.net/lang/en/doc/

Sep 07 17:54:31 DALEK-UB systemd[1]: [/etc/systemd/system/clamav-daemon.socket.d/extend.conf:4] Failed
Sep 07 17:54:31 DALEK-UB systemd[1]: clamav-daemon.socket: Unit lacks Listen setting. Refusing.
Sep 07 17:54:32 DALEK-UB systemd[1]: [/etc/systemd/system/clamav-daemon.socket.d/extend.conf:4] Failed
Sep 07 17:54:32 DALEK-UB systemd[1]: clamav-daemon.socket: Unit lacks Listen setting. Refusing.
Warning: clamav-daemon.socket changed on disk. Run 'systemctl daemon-reload' to reload units.
//=============================================================================

so I followed the advice on the last line:
Wed Sep 07 18:38 /etc/systemd/system/clamav-daemon.socket.d => systemctl daemon-reload

I then ran my upgrade script and the upgrade of clamav-daemon went correctly! I don't know the reason why though so I will leave this Open until I have an answer!
Currently there are 3 clam oriented processes being reported:

Wed Sep 07 18:52 /home/alan => ps -e | grep clam
 7144 ? 00:00:00 clamd
10405 ? 00:00:06 clamd
11010 ? 00:00:00 freshclam
Wed Sep 07 18:52 /home/alan =>

so what exactly is clamav-daemon and clamav-daemon.socket.d, and where does the config file extend .conf fit in?

Revision history for this message
Alan (alan-pd-watson) said :
#3

Hi,

I finally bit the bullet on this one and resolved the issue using brute force and ignorance - i.e. using Synaptic package manager I removed everything related to Clamav, including all configuration files.

Following reboot, again using Synaptic Package manager I reinstalled the Clam system, carefully checking that dependencies and package issues were resolved before installation.
I then reconfigured the ClamAV daemon using:

sudo dpkg-reconfigure clamav-daemon

and accepted all defaults EXCEPT I specified TCP sockets rather than UNIX sockets.

My clam system is now fully working, including scanning of emails and attachments.

I hope this helps.

Revision history for this message
Alan (alan-pd-watson) said :
#4

Hi,

I finally bit the bullet on this one and resolved the issue using brute force and ignorance - i.e. using Synaptic package manager I removed everything related to Clamav, including all configuration files.

Following reboot, again using Synaptic Package manager I reinstalled the Clam system, carefully checking that dependencies and package issues were resolved before installation.
I then reconfigured the ClamAV daemon using:

sudo dpkg-reconfigure clamav-daemon

and accepted all defaults EXCEPT I specified TCP sockets rather than UNIX sockets.

My clam system is now fully working, including scanning of emails and attachments.

What I don't know is why the problem occurred in the first place i.e. on (via apt-get upgrade) upgrade of the CLAM system, which probably still needs resolution.

I hope this helps.

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

A complete removal and new installation of clamav probably was the best solution.

There is one additional issue in your apt configuration:

"... E: Failed to fetch http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead. ..."

You have configured a PPA as additional source, but that PPA does not provide any software for xenial (see http://ppa.launchpad.net/apoleon/ppa-freeorion/ubuntu/dists/ to confirm)

I recommend to remove that PPA from your sources.
Use
grep 'apoleon/ppa-freeorion' /etc/apt/sources.list /etc/apt/sources.list.d/*.list
to identify the configuration file where it is defined.

Revision history for this message
Alan (alan-pd-watson) said :
#6

Thanks Manfred, I have done as you suggested!

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

For verification whether everything is now correct, what is the output of the commands

sudo apt-get update
sudo apt-get dist-upgrade

(If there are no warnings and error messages any more, then you might set the status of this question to 'solved'.)

Revision history for this message
Alan (alan-pd-watson) said :
#8

Hi Manfred,
o/p of commands as requested!

Mon Sep 19 14:38 /home/alan => sudo apt-get update
[sudo] password for alan:
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Fetched 95.7 kB in 0s (147 kB/s)
Reading package lists... Done
Mon Sep 19 14:39 /home/alan =>

Mon Sep 19 14:39 /home/alan => sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
Mon Sep 19 14:40 /home/alan =>

No warnings or error messages. However, we still don't really know what went wrong in the first place except that an upgrade script was expecting clam to be working in a particular fashion, and if not the upgrade failed even though the clam installation was working properly.