Clamav-daemon systemd unit fails to start, clamd runs fine

Asked by Aaron Li

What I expect:
- `clamav-daemon.service` starts, which allows clamdscan to function.

What happens:
- The `clamav-daemon` systemd unit repeatedly fails to run.
  - Error message: `ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype`
- Running `clamd` manually seems to work while the systemd units for `clamav-daemon` (`clamav-daemon.service`, `clamav-daemon.socket`) are stopped.

What I have tried
- Re-install `clamav-daemon`
- Purge and re-install `clamav-daemon`
  - First time, the condition for `daily.cvd`/`main.cvd` failed
  - After that, it kept failing in the same way as before

From `journalctl -u clamav-daemon --follow`:
```
Oct 01 13:19:58 Hostname systemd[1]: clamav-daemon.service: Consumed 17.956s CPU time.
Oct 01 13:19:58 Hostname systemd[1]: clamav-daemon.service: Scheduled restart job, restart counter is at 191.
Oct 01 13:19:58 Hostname systemd[1]: Starting clamav-daemon.service - Clam AntiVirus userspace daemon...
Oct 01 13:20:16 Hostname clamd[146971]: ERROR: Tue Oct 1 13:20:16 2024 -> TCP: getaddrinfo failed: Servname not supported for ai_socktype
Oct 01 13:20:16 Hostname systemd[1]: clamav-daemon.service: Control process exited, code=exited, status=1/FAILURE
Oct 01 13:20:16 Hostname systemd[1]: clamav-daemon.service: Failed with result 'exit-code'.
Oct 01 13:20:16 Hostname systemd[1]: Failed to start clamav-daemon.service - Clam AntiVirus userspace daemon.
Oct 01 13:20:16 Hostname systemd[1]: clamav-daemon.service: Consumed 17.878s CPU time.
Oct 01 13:20:16 Hostname systemd[1]: clamav-daemon.service: Scheduled restart job, restart counter is at 192.
Oct 01 13:20:16 Hostname systemd[1]: Starting clamav-daemon.service - Clam AntiVirus userspace daemon...
Oct 01 13:20:34 Hostname clamd[147027]: ERROR: Tue Oct 1 13:20:34 2024 -> TCP: getaddrinfo failed: Servname not supported for ai_socktype
Oct 01 13:20:34 Hostname systemd[1]: clamav-daemon.service: Control process exited, code=exited, status=1/FAILURE
Oct 01 13:20:34 Hostname systemd[1]: clamav-daemon.service: Failed with result 'exit-code'.
Oct 01 13:20:34 Hostname systemd[1]: Failed to start clamav-daemon.service - Clam AntiVirus userspace daemon.
Oct 01 13:20:34 Hostname systemd[1]: clamav-daemon.service: Consumed 17.856s CPU time.
Oct 01 13:20:34 Hostname systemd[1]: clamav-daemon.service: Scheduled restart job, restart counter is at 193.
Oct 01 13:20:34 Hostname systemd[1]: Starting clamav-daemon.service - Clam AntiVirus userspace daemon...
Oct 01 13:20:51 Hostname clamd[147059]: ERROR: Tue Oct 1 13:20:51 2024 -> TCP: getaddrinfo failed: Servname not supported for ai_socktype
Oct 01 13:20:52 Hostname systemd[1]: clamav-daemon.service: Control process exited, code=exited, status=1/FAILURE
Oct 01 13:20:52 Hostname systemd[1]: clamav-daemon.service: Failed with result 'exit-code'.
Oct 01 13:20:52 Hostname systemd[1]: Failed to start clamav-daemon.service - Clam AntiVirus userspace daemon.
Oct 01 13:20:52 Hostname systemd[1]: clamav-daemon.service: Consumed 17.296s CPU time.
Oct 01 13:20:52 Hostname systemd[1]: clamav-daemon.service: Scheduled restart job, restart counter is at 194.
Oct 01 13:20:52 Hostname systemd[1]: Starting clamav-daemon.service - Clam AntiVirus userspace daemon...
Oct 01 13:21:09 Hostname clamd[147078]: ERROR: Tue Oct 1 13:21:09 2024 -> TCP: getaddrinfo failed: Servname not supported for ai_socktype
Oct 01 13:21:09 Hostname systemd[1]: clamav-daemon.service: Control process exited, code=exited, status=1/FAILURE
Oct 01 13:21:09 Hostname systemd[1]: clamav-daemon.service: Failed with result 'exit-code'.
Oct 01 13:21:09 Hostname systemd[1]: Failed to start clamav-daemon.service - Clam AntiVirus userspace daemon.
Oct 01 13:21:09 Hostname systemd[1]: clamav-daemon.service: Consumed 17.483s CPU time.
Oct 01 13:21:09 Hostname systemd[1]: clamav-daemon.service: Scheduled restart job, restart counter is at 195.
Oct 01 13:21:10 Hostname systemd[1]: Starting clamav-daemon.service - Clam AntiVirus userspace daemon...
```

From `/var/log/clamav/clamav.log`:
```
Tue Oct 1 13:02:54 2024 -> Loaded 8698985 signatures.
Tue Oct 1 13:02:57 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Tue Oct 1 13:02:57 2024 -> +++ Started at Tue Oct 1 13:02:57 2024
Tue Oct 1 13:02:57 2024 -> Received 1 file descriptor(s) from systemd.
Tue Oct 1 13:02:57 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Tue Oct 1 13:02:57 2024 -> Log file size limited to 4294967295 bytes.
Tue Oct 1 13:02:57 2024 -> Reading databases from /var/lib/clamav
Tue Oct 1 13:02:57 2024 -> Not loading PUA signatures.
Tue Oct 1 13:02:57 2024 -> Bytecode: Security mode set to "TrustSigned".
Tue Oct 1 13:03:12 2024 -> Loaded 8698985 signatures.
Tue Oct 1 13:03:14 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Tue Oct 1 13:03:15 2024 -> +++ Started at Tue Oct 1 13:03:15 2024
Tue Oct 1 13:03:15 2024 -> Received 1 file descriptor(s) from systemd.
Tue Oct 1 13:03:15 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Tue Oct 1 13:03:15 2024 -> Log file size limited to 4294967295 bytes.
Tue Oct 1 13:03:15 2024 -> Reading databases from /var/lib/clamav
Tue Oct 1 13:03:15 2024 -> Not loading PUA signatures.
Tue Oct 1 13:03:15 2024 -> Bytecode: Security mode set to "TrustSigned".
Tue Oct 1 13:03:29 2024 -> Loaded 8698985 signatures.
Tue Oct 1 13:03:32 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Tue Oct 1 13:03:33 2024 -> +++ Started at Tue Oct 1 13:03:33 2024
Tue Oct 1 13:03:33 2024 -> Received 1 file descriptor(s) from systemd.
Tue Oct 1 13:03:33 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Tue Oct 1 13:03:33 2024 -> Log file size limited to 4294967295 bytes.
Tue Oct 1 13:03:33 2024 -> Reading databases from /var/lib/clamav
Tue Oct 1 13:03:33 2024 -> Not loading PUA signatures.
Tue Oct 1 13:03:33 2024 -> Bytecode: Security mode set to "TrustSigned".
Tue Oct 1 13:03:47 2024 -> Loaded 8698985 signatures.
Tue Oct 1 13:03:50 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Tue Oct 1 13:03:50 2024 -> +++ Started at Tue Oct 1 13:03:50 2024
Tue Oct 1 13:03:50 2024 -> Received 1 file descriptor(s) from systemd.
Tue Oct 1 13:03:50 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Tue Oct 1 13:03:50 2024 -> Log file size limited to 4294967295 bytes.
Tue Oct 1 13:03:50 2024 -> Reading databases from /var/lib/clamav
Tue Oct 1 13:03:50 2024 -> Not loading PUA signatures.
Tue Oct 1 13:03:50 2024 -> Bytecode: Security mode set to "TrustSigned".
Tue Oct 1 13:04:05 2024 -> Loaded 8698985 signatures.
Tue Oct 1 13:04:07 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Tue Oct 1 13:04:08 2024 -> +++ Started at Tue Oct 1 13:04:08 2024
Tue Oct 1 13:04:08 2024 -> Received 1 file descriptor(s) from systemd.
Tue Oct 1 13:04:08 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Tue Oct 1 13:04:08 2024 -> Log file size limited to 4294967295 bytes.
Tue Oct 1 13:04:08 2024 -> Reading databases from /var/lib/clamav
Tue Oct 1 13:04:08 2024 -> Not loading PUA signatures.
Tue Oct 1 13:04:08 2024 -> Bytecode: Security mode set to "TrustSigned".
```

`clamav-daemon` version:
```
1.0.7+dfsg-0ubuntu0.24.04.1
```

# System Details Report
---

## Report details
- **Date generated:** 2024-10-01 16:44:39

## Hardware Information:
- **Hardware Model:** Intel Corporation SandyBridge Platform
- **Memory:** 16.0 GiB
- **Processor:** Intel® Xeon® E3-1220 V2 × 4
- **Graphics:** NVD9
- **Disk Capacity:** 3.2 TB

## Software Information:
- **Firmware Version:** S1200BT.86B.02.00.0035.030220120927
- **OS Name:** Ubuntu 24.04.1 LTS
- **OS Build:** (null)
- **OS Type:** 64-bit
- **GNOME Version:** 46
- **Windowing System:** Wayland
- **Kernel Version:** Linux 6.8.0-45-generic

Question information

Language:
English Edit question
Status:
Open
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

apt-cache policy `dpkg -l | grep -i clam | awk {'print$2'}`

Thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#2
Revision history for this message
Aaron Li (abclop99) said :
#3

The output of apt-cache policy `dpkg -l | grep -i clam | awk {'print$2'}`is:

```
clamav-base:
  Installed: 1.0.7+dfsg-0ubuntu0.24.04.1
  Candidate: 1.0.7+dfsg-0ubuntu0.24.04.1
  Version table:
 *** 1.0.7+dfsg-0ubuntu0.24.04.1 500
        500 http://ca.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://ca.archive.ubuntu.com/ubuntu noble-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages
        100 /var/lib/dpkg/status
     1.0.5+dfsg-1.1ubuntu3 500
        500 http://ca.archive.ubuntu.com/ubuntu noble/main amd64 Packages
        500 http://ca.archive.ubuntu.com/ubuntu noble/main i386 Packages
clamav-daemon:
  Installed: 1.0.7+dfsg-0ubuntu0.24.04.1
  Candidate: 1.0.7+dfsg-0ubuntu0.24.04.1
  Version table:
 *** 1.0.7+dfsg-0ubuntu0.24.04.1 500
        500 http://ca.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     1.0.5+dfsg-1.1ubuntu3 500
        500 http://ca.archive.ubuntu.com/ubuntu noble/main amd64 Packages
clamav-freshclam:
  Installed: 1.0.7+dfsg-0ubuntu0.24.04.1
  Candidate: 1.0.7+dfsg-0ubuntu0.24.04.1
  Version table:
 *** 1.0.7+dfsg-0ubuntu0.24.04.1 500
        500 http://ca.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     1.0.5+dfsg-1.1ubuntu3 500
        500 http://ca.archive.ubuntu.com/ubuntu noble/main amd64 Packages
clamdscan:
  Installed: 1.0.7+dfsg-0ubuntu0.24.04.1
  Candidate: 1.0.7+dfsg-0ubuntu0.24.04.1
  Version table:
 *** 1.0.7+dfsg-0ubuntu0.24.04.1 500
        500 http://ca.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     1.0.5+dfsg-1.1ubuntu3 500
        500 http://ca.archive.ubuntu.com/ubuntu noble/main amd64 Packages
libclamav11t64:
  Installed: 1.0.7+dfsg-0ubuntu0.24.04.1
  Candidate: 1.0.7+dfsg-0ubuntu0.24.04.1
  Version table:
 *** 1.0.7+dfsg-0ubuntu0.24.04.1 500
        500 http://ca.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     1.0.5+dfsg-1.1ubuntu3 500
        500 http://ca.archive.ubuntu.com/ubuntu noble/main amd64 Packages
```

ls -l /etc/services:
```
-rw-r--r-- 1 root root 12813 Mar 27 2021 /etc/services
```

Revision history for this message
Aaron Li (abclop99) said :
#4

I ran `sudo dpkg-reconfigure clamav-daemon`, and now the log `/var/log/clamav/clamav.log` shows:

```
Wed Oct 2 11:10:23 2024 -> Bytecode: Security mode set to "TrustSigned".
Wed Oct 2 11:10:36 2024 -> Loaded 8698991 signatures.
Wed Oct 2 11:10:39 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Wed Oct 2 11:10:39 2024 -> +++ Started at Wed Oct 2 11:10:39 2024
Wed Oct 2 11:10:39 2024 -> Received 1 file descriptor(s) from systemd.
Wed Oct 2 11:10:39 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Wed Oct 2 11:10:39 2024 -> Log file size limited to 4294967295 bytes.
Wed Oct 2 11:10:39 2024 -> Reading databases from /var/lib/clamav
Wed Oct 2 11:10:39 2024 -> Not loading PUA signatures.
Wed Oct 2 11:10:39 2024 -> Bytecode: Security mode set to "TrustSigned".
Wed Oct 2 11:10:53 2024 -> Loaded 8698991 signatures.
Wed Oct 2 11:10:55 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Wed Oct 2 11:10:56 2024 -> +++ Started at Wed Oct 2 11:10:56 2024
Wed Oct 2 11:10:56 2024 -> Received 1 file descriptor(s) from systemd.
Wed Oct 2 11:10:56 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Wed Oct 2 11:10:56 2024 -> Log file size limited to 4294967295 bytes.
Wed Oct 2 11:10:56 2024 -> Reading databases from /var/lib/clamav
Wed Oct 2 11:10:56 2024 -> Not loading PUA signatures.
Wed Oct 2 11:10:56 2024 -> Bytecode: Security mode set to "TrustSigned".
Wed Oct 2 11:11:09 2024 -> Loaded 8698991 signatures.
Wed Oct 2 11:11:12 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Wed Oct 2 11:11:12 2024 -> +++ Started at Wed Oct 2 11:11:12 2024
Wed Oct 2 11:11:12 2024 -> Received 1 file descriptor(s) from systemd.
Wed Oct 2 11:11:12 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Wed Oct 2 11:11:12 2024 -> Log file size limited to 4294967295 bytes.
Wed Oct 2 11:11:12 2024 -> Reading databases from /var/lib/clamav
Wed Oct 2 11:11:12 2024 -> Not loading PUA signatures.
Wed Oct 2 11:11:12 2024 -> Bytecode: Security mode set to "TrustSigned".
Wed Oct 2 11:11:26 2024 -> Loaded 8698991 signatures.
Wed Oct 2 11:11:28 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Wed Oct 2 11:11:29 2024 -> +++ Started at Wed Oct 2 11:11:29 2024
Wed Oct 2 11:11:29 2024 -> Received 1 file descriptor(s) from systemd.
Wed Oct 2 11:11:29 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Wed Oct 2 11:11:29 2024 -> Log file size limited to 4294967295 bytes.
Wed Oct 2 11:11:29 2024 -> Reading databases from /var/lib/clamav
Wed Oct 2 11:11:29 2024 -> Not loading PUA signatures.
Wed Oct 2 11:11:29 2024 -> Bytecode: Security mode set to "TrustSigned".
Wed Oct 2 11:11:42 2024 -> Loaded 8698991 signatures.
Wed Oct 2 11:11:45 2024 -> ERROR: TCP: getaddrinfo failed: Servname not supported for ai_socktype
Wed Oct 2 11:11:45 2024 -> +++ Started at Wed Oct 2 11:11:45 2024
Wed Oct 2 11:11:45 2024 -> Received 1 file descriptor(s) from systemd.
Wed Oct 2 11:11:45 2024 -> clamd daemon 1.0.7 (OS: Linux, ARCH: x86_64, CPU: x86_64)
Wed Oct 2 11:11:45 2024 -> Log file size limited to 4294967295 bytes.
Wed Oct 2 11:11:45 2024 -> Reading databases from /var/lib/clamav
Wed Oct 2 11:11:45 2024 -> Not loading PUA signatures.
Wed Oct 2 11:11:45 2024 -> Bytecode: Security mode set to "TrustSigned".
```

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5
Revision history for this message
Aaron Li (abclop99) said :
#6

It is not https://askubuntu.com/questions/742613/network-applications-throwing-servname-not-supported-for-ai-socktype. Someone already suggested that.

 ❯ ls -l /etc/services
-rw-r--r-- 1 root root 12813 Mar 27 2021 /etc/services

Can you help with this problem?

Provide an answer of your own, or ask Aaron Li for more information if necessary.

To post a message you must log in.