2

Trying to get clamav and clamav-daemon uninstalled but seems apt and dpkg are stuck and nothing can complete without this error:

dpkg --remove output:

(Reading database ... 385080 files and directories currently installed.)
Removing clamav-daemon (0.99.2+dfsg-0ubuntu0.16.04.2) ...
Failed to stop clamav-daemon.socket: Unit clamav-daemon.socket not loaded.
dpkg: error processing package clamav-daemon (--remove):
 subprocess installed pre-removal script returned error exit status 5
/usr/bin/deb-systemd-helper: error: unable to read clamav-daemon.service
/usr/bin/deb-systemd-helper: error: unable to read clamav-daemon.socket
Errors were encountered while processing:
 clamav-daemon

And any sort of apt command adds this to the end:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 clamav-daemon : Depends: clamav-base (= 0.99.2+dfsg-0ubuntu0.16.04.2) but 0.99.3+addedllvm-0ubuntu0.16.04.1 is installed
                 Recommends: clamdscan but it is not installed
E: Unmet dependencies. Try using -f.

I've tried the apt -f install, tried dpkg --configure -a, tried installing and then removing, tried making fake files called clamav-daemon.service/socket to hope the script will accept it and continue. Nothing has helped and I'm out of ideas.

Any help is greatly appreciated.

galoget
  • 223
  • 1
  • 9
eskimo
  • 123
  • 1
  • 3

1 Answers1

4

The pre-removal script can be found in the following path.

/var/lib/dpkg/info/clamav-daemon.prerm

You should be able to edit this script to remove the part that is failing. Alternatively you can remove the script completely but that may skip other cleanup steps.

galoget
  • 223
  • 1
  • 9
Peter Green
  • 4,056
  • 10
  • 29
  • Interestingly enough, the only things in that script were the 2 files it couldn't remove because they didn't exist. Thanks :) – eskimo Jan 31 '18 at 13:17