Mailing List Archive

Assistance needed with "LOCAL: Socket file /var/run/clamav/clamd.ctl is in use" error in Debian Docker image
Dear Community,

I hope this email finds you well. I am writing to seek assistance regarding an issue I am facing after installing a custom Debian Linux Docker image. The error message I am encountering is as follows: "LOCAL: Socket file /var/run/clamav/clamd.ctl is in use by another process."

I have attempted various troubleshooting steps to resolve the issue, including:

* Using the Official ClamAV image with both freshclam and clamd.
* Restarting freshclam and clamd using the command "service clamav-freshclam restart."
* Reconfiguring freshclam by executing "dpkg-reconfigure clamav-freshclam."
* Removing the files "clamd.ctl" and "freshclam.pid."
* Killing both processes.

Despite these efforts, the issue persists and I have been unable to resolve it. As I intend to deploy the application on a live EKS (Elastic Kubernetes Service) environment once the problem is resolved, I require assistance from an active member of the community.

Docker file:
FROM debian:latest
RUN apt-get update && \
apt-get install -y clamav-daemon clamav-freshclam
RUN mkdir -p /var/run/clamav && chown -R clamav:clamav /var/run/clamav
RUN freshclam
CMD ["/usr/sbin/clamd"]

clamd error:
root@2d7d8f3e55b0:/# clamd
ERROR: Mon Jul 3 09:58:01 2023 -> LOCAL: Socket file /var/run/clamav/clamd.ctl is in use by another process.

If you could kindly provide guidance or suggestions to help resolve this error, I would greatly appreciate it, please do share them as well. Screenshot and files attached for reference.

Thank you very much for your time and support. I look forward to your response.

Best regards,
-
PARMESHWAR GUDADHE
Mobile: +91-8855919797 | Email: paramscc@outlook.com | param@mail.com
Re: Assistance needed with "LOCAL: Socket file /var/run/clamav/clamd.ctl is in use" error in Debian Docker image [ In reply to ]
On Mon, 3 Jul 2023 11:18:47 +0000
Parmeshwar G via clamav-users <clamav-users@lists.clamav.net> wrote:
> Docker file:
> FROM debian:latest
> RUN apt-get update && \
> apt-get install -y clamav-daemon clamav-freshclam
> RUN mkdir -p /var/run/clamav && chown -R clamav:clamav /var/run/clamav
> RUN freshclam
> CMD ["/usr/sbin/clamd"]
>
> clamd error:
> root@2d7d8f3e55b0:/# clamd
> ERROR: Mon Jul 3 09:58:01 2023 -> LOCAL: Socket file
> /var/run/clamav/clamd.ctl is in use by another process.

I suspect it's just because you're trying to start clamd again when
it's already running (and thus using that socket) - it will be started
by default once you install it, I believe - it certainly does for me.

You shouldn't need to do anything; `freshclam` should poke clamd via
the socket if it needs to reload anything, so you should be able to
omit the `CMD ["/usr/sbin/clamd"]`.

If you want to be double certain, instead of trying to launch `clamd`
directly like that, use the systemd service that will be created, e.g.:

`CMD ["/usr/bin/service clamav-daemon restart"]`

... or similar.


BTW, you should get `clamav-freshclam` automatically anyway if you
install `clamav-daemon`, so you don't *need* to specify it, but it
doesn't hurt to.

Also, you shouldn't have to create & chown stuff in `/var/run/clamav` -
the Debian package should handle all that when it's installed.


_______________________________________________

Manage your clamav-users mailing list subscription / unsubscribe:
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/Cisco-Talos/clamav-documentation

https://docs.clamav.net/#mailing-lists-and-chat
Re: Assistance needed with "LOCAL: Socket file /var/run/clamav/clamd.ctl is in use" error in Debian Docker image [ In reply to ]
"lsof" will tell you what has it open and that should set you in the right direction

-----Original Message-----
From: clamav-users [mailto:clamav-users-bounces@lists.clamav.net] On Behalf Of David Precious via clamav-users
Sent: 03 July 2023 12:40
To: clamav-users@lists.clamav.net
Cc: David Precious
Subject: Re: [clamav-users] Assistance needed with "LOCAL: Socket file /var/run/clamav/clamd.ctl is in use" error in Debian Docker image

On Mon, 3 Jul 2023 11:18:47 +0000
Parmeshwar G via clamav-users <clamav-users@lists.clamav.net> wrote:
> Docker file:
> FROM debian:latest
> RUN apt-get update && \
> apt-get install -y clamav-daemon clamav-freshclam RUN mkdir -p
> /var/run/clamav && chown -R clamav:clamav /var/run/clamav RUN
> freshclam CMD ["/usr/sbin/clamd"]
>
> clamd error:
> root@2d7d8f3e55b0:/# clamd
> ERROR: Mon Jul 3 09:58:01 2023 -> LOCAL: Socket file
> /var/run/clamav/clamd.ctl is in use by another process.

I suspect it's just because you're trying to start clamd again when it's already running (and thus using that socket) - it will be started by default once you install it, I believe - it certainly does for me.

You shouldn't need to do anything; `freshclam` should poke clamd via the socket if it needs to reload anything, so you should be able to omit the `CMD ["/usr/sbin/clamd"]`.

If you want to be double certain, instead of trying to launch `clamd` directly like that, use the systemd service that will be created, e.g.:

`CMD ["/usr/bin/service clamav-daemon restart"]`

... or similar.


BTW, you should get `clamav-freshclam` automatically anyway if you install `clamav-daemon`, so you don't *need* to specify it, but it doesn't hurt to.

Also, you shouldn't have to create & chown stuff in `/var/run/clamav` - the Debian package should handle all that when it's installed.


_______________________________________________

Manage your clamav-users mailing list subscription / unsubscribe:
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/Cisco-Talos/clamav-documentation

https://docs.clamav.net/#mailing-lists-and-chat
_______________________________________________

Manage your clamav-users mailing list subscription / unsubscribe:
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/Cisco-Talos/clamav-documentation

https://docs.clamav.net/#mailing-lists-and-chat