clamclamav

Can't stop Clamav deamon in Linux


I am trying to stop Clamav service in Linux, but I am not able to do that. I have installed Clamav in a seperate directory.

When running below command:

$ systemctl stop clamav-daemon

I get this error message:

Warning: Stopping clamav-daemon.service, but it can still be activated by: clamav-daemon.socket

When running:

$ systemctl status clamav-daemon

I get:

 clamav-daemon.service - Clam AntiVirus userspace daemon
   Loaded: loaded (/usr/lib/systemd/system/clamav-daemon.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-04-29 13:23:33 IST; 7s ago
     Docs: man:clamd(8)
           man:clamd.conf(5)
           https://www.clamav.net/documents/
 Main PID: 32213 (clamd)
    Tasks: 1
   CGroup: /system.slice/clamav-daemon.service
           └─32213 /usr/local/sbin/clamd --foreground=true

Any help will be appreciated. Thanks.


Solution

  • When you are logged in as a normal user which can be understood by seeing the $ sign in your command, clamav won't stop. You need to perform the following command.

    It will stop clamav for only logged-in session

    $ sudo systemctl stop clamav-daemon
    

    To see the status

    $ sudo systemctl status clamav-daemon
    

    It will return:

    ● clamav-daemon.service - Clam AntiVirus userspace daemon
         Loaded: loaded (/lib/systemd/system/clamav-daemon.service; disabled; vendor preset: enabled)
        Drop-In: /etc/systemd/system/clamav-daemon.service.d
                 └─extend.conf
         Active: inactive (dead)
           Docs: man:clamd(8)
                 man:clamd.conf(5)
                 https://www.clamav.net/documents/
    
    Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> HTML support enabled.
    Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> XMLDOCS support enabled.
    Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> HWP3 support enabled.
    Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> Self checking every 3600 seconds.
    Aug 20 09:58:53 machine clamd[808]: Thu Aug 20 09:58:53 2020 -> SelfCheck: Database status OK.
    Aug 20 10:57:51 machine systemd[1]: Stopping Clam AntiVirus userspace daemon...
    Aug 20 10:57:52 machine clamd[808]: Thu Aug 20 10:57:52 2020 -> --- Stopped at Thu Aug 20 10:57:52 >
    Aug 20 10:57:52 machine clamd[808]: Thu Aug 20 10:57:52 2020 -> Socket file removed.
    Aug 20 10:57:52 machine systemd[1]: clamav-daemon.service: Succeeded.
    Aug 20 10:57:52 machine systemd[1]: Stopped Clam AntiVirus userspace daemon.
    

    If you have created symbolic link of clamav daemon to start the program automatically when pc boot then you need to remove that link so that clamav shouldn't start automatically

    $ sudo systemctl disable clamav-daemon