Bug 760069

Summary: clamav does not start after reboot
Product: [Fedora] Fedora Reporter: customercare
Component: eximAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 15CC: dwmw2, jskarvad, mlichvar, ondrejj, redhat-bugzilla, rh-bugzilla, steve
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: exim-4.76-4.fc16.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-21 02:35:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description customercare 2011-12-05 11:38:25 UTC
Description of problem:

systemd is unable to start clamd for exim . 

Fix is included on the end.

Version-Release number of selected component (if applicable):

exim-clamav-4.76-2.fc15.i686
clamav-lib-0.97.3-1500.fc15.i686
clamav-filesystem-0.97.3-1500.fc15.noarch
clamav-0.97.3-1500.fc15.i686
clamav-server-0.97.3-1500.fc15.i686
clamav-data-empty-0.97.3-1500.fc15.noarch
clamav-update-0.97.3-1500.fc15.i686 


How reproducible:

[root@c1 ~]# ls -la /var/run/ | grep clamd
[root@c1 ~]# systemctl start clamd.exim.service
Job failed. See system logs and 'systemctl status' for details.
[root@c1 ~]# mkdir /var/run/clamd.exim
[root@c1 ~]# systemctl start clamd.exim.service
Job failed. See system logs and 'systemctl status' for details. 
[root@c1 ~]# ls -la /var/run/ | grep clamd
drwxr-xr-x   2 root    root      40  5. Dez 12:15 clamd.exim  
[root@c1 ~]# chown exim /var/run/clamd.exim/
[root@c1 ~]# systemctl start clamd.exim.service

[root@c1 ~]# reboot
...
[root@c1 ~]# pstree -u | grep clamd
[root@c1 ~]# ls -la /var/run/|grep clamd  
[root@c1 ~]# grep -E "(clamd|systemd)" /var/log/messages
Dec  5 12:17:27 c1 clamd[1385]: Loaded 1086412 signatures.
Dec  5 12:17:27 c1 clamd[1385]: LOCAL: Socket file /var/run/clamd.exim/clamd.sock could not be bound: No such file or directory
Dec  5 12:17:27 c1 systemd[1]: clamd.exim.service: control process exited, code=exited status=1
Dec  5 12:17:27 c1 systemd[1]: Unit clamd.exim.service entered failed state.
Dec  5 12:17:31 c1 systemd[1]: Startup finished in 538ms 23us (kernel) + 2s 562ms 16us (initrd) + 29s 444ms 31us (userspace) = 32s 544ms 70us.


Actual results:

Dec  5 12:17:27 c1 clamd[1385]: Loaded 1086412 signatures.
Dec  5 12:17:27 c1 clamd[1385]: LOCAL: Socket file /var/run/clamd.exim/clamd.sock could not be bound: No such file or directory
Dec  5 12:17:27 c1 systemd[1]: clamd.exim.service: control process exited, code=exited status=1
Dec  5 12:17:27 c1 systemd[1]: Unit clamd.exim.service entered failed state.
Dec  5 12:17:31 c1 systemd[1]: Startup finished in 538ms 23us (kernel) + 2s 562ms 16us (initrd) + 29s 444ms 31us (userspace) = 32s 544ms 70us.


Expected results:

Dec  5 12:25:40 c1 clamd[1387]: Loaded 1086412 signatures.
Dec  5 12:25:40 c1 clamd[1387]: LOCAL: Unix socket file /var/run/clamd.exim/clamd.sock
Dec  5 12:25:40 c1 clamd[1387]: LOCAL: Setting connection queue length to 200
Dec  5 12:25:40 c1 clamd[1470]: Limits: Global size limit set to 104857600 bytes.
Dec  5 12:25:40 c1 clamd[1470]: Limits: File size limit set to 26214400 bytes.
Dec  5 12:25:40 c1 clamd[1470]: Limits: Recursion level limit set to 16.
Dec  5 12:25:40 c1 clamd[1470]: Limits: Files limit set to 10000.
Dec  5 12:25:40 c1 clamd[1470]: Archive support enabled.
Dec  5 12:25:40 c1 clamd[1470]: Algorithmic detection enabled.
Dec  5 12:25:40 c1 clamd[1470]: Portable Executable support enabled.
Dec  5 12:25:40 c1 clamd[1470]: ELF support enabled.
Dec  5 12:25:40 c1 clamd[1470]: Mail files support enabled.
Dec  5 12:25:40 c1 clamd[1470]: OLE2 support enabled.
Dec  5 12:25:40 c1 clamd[1470]: PDF support enabled.
Dec  5 12:25:40 c1 clamd[1470]: HTML support enabled.
Dec  5 12:25:40 c1 clamd[1470]: Self checking every 600 seconds.                     
Additional info:

O== WHY is it happening ?

Because the run directory gets deleted and the init script does not recreate it.


O== FIX : 

This is just a simple cruel patch for my system.
I guess you will use something like a 777 for /var/run/clamd.exim
or CLAMD_USER for the chown cmd and of couse a TEST if it's missing would be nice.

# diff -c /tmp/clamd-wrapper /usr/share/clamav/clamd-wrapper
*** /tmp/clamd-wrapper  2011-12-05 12:19:59.341303000 +0100
--- /usr/share/clamav/clamd-wrapper     2011-12-05 12:20:49.097302171 +0100
***************
*** 41,46 ****
--- 41,48 ----

  start () {
        echo -n $"Starting $prog: "
+       mkdir /var/run/clamd.exim
+       chown exim /var/run/clamd.exim
        daemon --pidfile=${CLAMD_PIDFILE} \
            exec -a $procname /usr/sbin/clamd \
            ${CLAMD_CONFIGFILE:+-c $CLAMD_CONFIGFILE} ${CLAMD_OPTIONS} --pid ${CLAMD_PIDFILE}

Comment 1 customercare 2012-02-13 09:46:45 UTC
-- 2 months reminder --

Comment 2 Enrico Scholz 2012-02-15 13:36:40 UTC
The package which integrates exim and clamav will have to provide a proper tmpfiles.d description for the socket directory. This seems to be fixed in rawhide already:

  http://pkgs.fedoraproject.org/gitweb/?p=exim.git;a=commitdiff;h=ac41166122e3f3e5c2fc5894d5466e5c163f7527

The clamd-wrapper (which is going to die in the midterm btw) has no way to determine the location of the socket (which can be a TCPSocket too).

Reassigning to exim...

Comment 3 Jaroslav Škarvada 2012-02-15 15:14:14 UTC
The tmpfs issue was fixed in Fedora 17 / Rawhide as part of sysv to systemd migration. It shouldn't be problem to backport to Fedora 15/16 if required.

Comment 4 Jaroslav Škarvada 2012-02-22 15:14:39 UTC
The startup failure is something that couldn't occur, thus I will backport the fix - reassigning to myself.

Comment 5 Fedora Update System 2012-02-24 15:41:48 UTC
exim-4.76-4.fc16.1 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/exim-4.76-4.fc16.1

Comment 6 Fedora Update System 2012-02-24 15:51:20 UTC
exim-4.76-2.fc15.1 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/exim-4.76-2.fc15.1

Comment 7 Fedora Update System 2012-02-25 08:33:26 UTC
Package exim-4.76-4.fc16.1:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing exim-4.76-4.fc16.1'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-2395/exim-4.76-4.fc16.1
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2012-03-21 02:35:21 UTC
exim-4.76-2.fc15.1 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2012-03-21 02:36:13 UTC
exim-4.76-4.fc16.1 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.