Bug 801994 - freshclam (clamav-update) does not integrate with systemd or SYSV sysinit at installation
freshclam (clamav-update) does not integrate with systemd or SYSV sysinit at ...
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: clamav (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Nick Bebout
Fedora Extras Quality Assurance
: EasyFix, Patch, Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-10 00:22 EST by Scott Marshall
Modified: 2016-12-20 07:11 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-20 07:11:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Tar file containing necessary additional config files for freshclam to work with systemd and tmpfiles (10.00 KB, application/tar)
2012-03-10 00:22 EST, Scott Marshall
no flags Details

  None (edit)
Description Scott Marshall 2012-03-10 00:22:41 EST
Created attachment 569039 [details]
Tar file containing necessary additional config files for freshclam to work with systemd and tmpfiles

Description of problem:
Installation of the freshclam (clamav-update) package does not setup SYSV initscripts nor does it setup a systemd service unit.  Thus freshclam cannot be easily setup to automagically update at system startup.

Version-Release number of selected component (if applicable):
clamav-update-0.97.3-1600.fc16.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install the clamav-update package
2. Check the init.d and/or /lib/systemd/system directories
  
Actual results:
No service unit or init scripts present


Expected results:
A systemd or SYSV initscript should at least be present, even if not enabled.

Additional info:

I've created a systemd service unit config file, and a tmpfiles.d config file to integrate freshclam into the new Fedora 16 systemd and tmpfs environment.

My /etc/freshclam.conf contains the following active settings:

Checks 3
DatabaseDirectory /var/lib/clamav
DatabaseOwner clamupdate
LogFacility LOG_LOCAL6
LogFileMaxSize 2M
LogSyslog yes
LogTime yes
PidFile /var/run/freshclam.pid
UpdateLogFile /var/log/freshclam.log

With these settings, I can execute a 'systemctl enable clamav.updater.service' and 'systemctl start clamav.updater.service', and freshclam will keep clamav up-to-date.
Comment 1 Scott Marshall 2012-03-10 00:41:12 EST
Given that systemd is the direction in which Fedora is moving, there is probably no need to create a separate -initscripts or -systemd sub-package containing these config files.  It would be simpler to just ensure that the existing clamav-update package has these files, and have the clamav-update.rpm postinstall scriptlet invoke a "systemd-tmpfiles --create /etc/tmpfiles.d/freshclam.conf" command.

A new preuninstall scriptlet should be created and added to the RPM to stop the service if running.

Also, in my original post, the service name shown should have been "clamd.updater.service", to keep it aligned to the "clamd.scan.service" name.

The "clamd.updater.service" is the actual name of the systemd file contained within the tar file.
Comment 2 Enrico Scholz 2012-04-23 04:12:40 EDT
freshclam is invoked by a cron job atm.  What are the reasons why you want to execute it as a long running daemon?
Comment 3 Sergio Monteiro Basto 2012-04-23 15:30:15 EDT
(In reply to comment #2)
> freshclam is invoked by a cron job atm.  What are the reasons why you want to
> execute it as a long running daemon?

ok I add me has CC , because thought that has about: systemd for clamav 


chkconfig --list I got 

clamd           0:off   1:off   2:on    3:on    4:on    5:on    6:off


yeah I have  
/etc/rc.d/init.d/clamd
/etc/rc.d/init.d/clamd-wrapper

rpm -qf /etc/rc.d/init.d/clamd-wrapper 
clamav-server-sysvinit-0.97.3-1600.fc16.noarch
Comment 4 Scott Marshall 2012-04-23 20:45:07 EDT
(In reply to comment #2)
> freshclam is invoked by a cron job atm.  What are the reasons why you want to
> execute it as a long running daemon?

When I installed the freshclam package, it did appear to create a cron job, and all the information I read about freshclam was pointing to running it as a daemon when automating the updates.

I say that no cron job was created because a 'crontab -l' as root didn't show any jobs, nor was anything created in /var/spool/cron/crontabs.

In the freshclam man page, there is no reference to cron, just the daemon mode for automated updating.

Of course, one can infer from the fact that freshclam works as a command-line tool to update the clamav databases that it can be invoked via cron, however I was attempting to get freshclam to automatically update as per its documented capabilities and felt that the necessary systemd and tmpfiles.d configuration control files should have been included as part of the package.
Comment 5 Scott Marshall 2012-04-23 20:46:11 EDT
Sorry - in the above reply, I meant to say "... did NOT appear to create ...."
Comment 6 Sergio Monteiro Basto 2012-04-24 18:20:09 EDT
(In reply to comment #2)
> freshclam is invoked by a cron job atm.  What are the reasons why you want to
> execute it as a long running daemon?

would be nice , have 
systemctl stop freshclam.service or 
systemctl  start freshclam.service 
instead edit /etc/sysconfig/freshclam to do that .
Comment 7 Scott Marshall 2012-04-24 21:07:27 EDT
(In reply to comment #6)
> 
> would be nice , have 
> systemctl stop freshclam.service or 
> systemctl  start freshclam.service 
> instead edit /etc/sysconfig/freshclam to do that .

I agree, which is why I created the systemd service unit file in the tarball attached to this Bugzilla record.

Download the tarball to your system, then execute the following commands (as root):

# cd /
# tar xf /path/to/freshclam.f16.integration.tar
# systemd-tmpfiles --create /etc/tmpfiles.d/freshclam.conf
# systemctl enable clamd.updater.service
# systemctl start clamd.updater.service

There is a presumption that the Fedora standard "clamupdate" user has been created when the original "clamav-update" RPM package was installed.
Don't forget to ensure that you've modified /etc/freshclam.conf to reflect your preferences.

My original posting shows my setup, which is based upon the Fedora defaults but tuned to my preferences.
Comment 8 Scott Marshall 2012-04-24 21:19:02 EDT
After much stuffing around, I *did* finally find the cron job for freshclam - it was located in /etc/cron.d - specifically /etc/cron.d/clamav-update

I find at least two things annoying about this setup.
1) crontab -l (even running as root) doesn't report cron jobs located in /etc/cron.d
2) If you modify the periodicity of the job in /etc/cron.d, you then have to *ALSO* change /etc/sysconfig/freshclam to reflect that change.

To me, having to make the same change in two (or more) different config files is brain-dead.  At least with the daemon approach, the only location needed to determine how many times to run the update check is in /etc/freshclam.conf

Needless to say, I immediately deleted /etc/cron.d/clamav-update
Now, freshclam only runs based upon the number of checks per 24 hours that *I* specify in /etc/freshclam.conf, not some weird combination of an invisible cron job and a "partner" file in /etc/sysconfig.
Comment 9 Fedora End Of Life 2013-01-16 08:29:38 EST
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 10 Fedora End Of Life 2013-02-13 09:19:11 EST
Fedora 16 changed to end-of-life (EOL) status on 2013-02-12. Fedora 16 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 11 Sergio Monteiro Basto 2013-02-17 22:40:22 EST
still valid on F17
Comment 12 Fedora Admin XMLRPC Client 2013-02-27 16:06:14 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 13 Fedora End Of Life 2013-07-03 21:17:23 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 14 Sergio Monteiro Basto 2013-07-04 17:35:59 EDT
I think this still need review ...
Comment 15 Sergio Monteiro Basto 2013-10-12 22:43:12 EDT
(In reply to Scott Marshall from comment #8)
> After much stuffing around, I *did* finally find the cron job for freshclam
> - it was located in /etc/cron.d - specifically /etc/cron.d/clamav-update
> 
> I find at least two things annoying about this setup.
> 1) crontab -l (even running as root) doesn't report cron jobs located in
> /etc/cron.d
> 2) If you modify the periodicity of the job in /etc/cron.d, you then have to
> *ALSO* change /etc/sysconfig/freshclam to reflect that change.
> 
> To me, having to make the same change in two (or more) different config
> files is brain-dead.  At least with the daemon approach, the only location
> needed to determine how many times to run the update check is in
> /etc/freshclam.conf
> 
> Needless to say, I immediately deleted /etc/cron.d/clamav-update
> Now, freshclam only runs based upon the number of checks per 24 hours that
> *I* specify in /etc/freshclam.conf, not some weird combination of an
> invisible cron job and a "partner" file in /etc/sysconfig.

still this in F19
Comment 16 William Graham 2014-01-17 14:52:10 EST
I was thinking of writing a patch myself until I saw this older bug. I think it would make sense to have a timer service like yum does.

A good example is

/usr/lib/systemd/system/yum-makecache.service
/usr/lib/systemd/system/yum-makecache.timer

In those files, timer file invokes the service every hour but only after the system has been booted for 10 minutes. Also, the timer doesn't start it's hour count until the service is complete.
Comment 17 Jan Kurik 2015-07-15 11:11:02 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
Comment 18 Fedora End Of Life 2016-11-24 05:37:40 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 19 Fedora End Of Life 2016-12-20 07:11:50 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.