Mailing List Archive

[clamav-users] Update policy for clamd@.service
Hi all,

System Fedora 5.2.9-200.fc30.x86_64
ClamAv 0.101.4


I wonder why a DNF update changes my customized
/usr/lib/systemd/clam@,service file.

Background:
I had to add/change the following configurations in above mentioned file
to overcome
a timeout issue.

TimeOutSec = 600
#Restart = on-failure        # to avoid restarting on timeout failure

IMHO an update should not change the service files, but  instead install
a new version of this file(s)
with an appropriate extension. In addition DNF update should inform
about this with a warning.

Kind reagrds,
Herbert

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
[clamav-users] Update policy for clamd@.service [ In reply to ]
Corrected typo in filename.

Hi all,

System Fedora 5.2.9-200.fc30.x86_64
ClamAv 0.101.4


I wonder why a DNF update changes my customized
/usr/lib/systemd/clam@.service file.

Background:
I had to add/change the following configurations in above mentioned file
to overcome
a timeout issue.

TimeOutSec = 600
#Restart = on-failure        # to avoid restarting on timeout failure

IMHO an update should not change the service files, but  instead install
a new version of this file(s)
with an appropriate extension. In addition DNF update should inform
about this with a warning.

Kind reagrds,
Herbert
Re: [clamav-users] Update policy for clamd@.service [ In reply to ]
On Mon, Aug 26, 2019 at 4:18 PM Herbert via clamav-users <
clamav-users@lists.clamav.net> wrote:

> Hi all,
>
> System Fedora 5.2.9-200.fc30.x86_64
> ClamAv 0.101.4
>
>
> I wonder why a DNF update changes my customized
> /usr/lib/systemd/clam@,service file.
>
>
... because you shouldn't have modified that file?
https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/#modifying-existing-systemd-services



> Background:
> I had to add/change the following configurations in above mentioned file
> to overcome
> a timeout issue.
>
> TimeOutSec = 600
> #Restart = on-failure # to avoid restarting on timeout failure
>
>
If it's an addition, you could probably use systemd drop-in configuration
file instead, e.g.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-Managing_Services_with_systemd-Unit_Files#brid-Managing_Services_with_systemd-Extending_Unit_Config


IMHO an update should not change the service files, but instead install
> a new version of this file(s)
> with an appropriate extension. In addition DNF update should inform
> about this with a warning.
>
>
Are you sure you're not confusing /usr/lib/systemd with files under /etc ?
AFAIK what you wrote is correct for files in /etc.

--
Fajar
Re: [clamav-users] Update policy for clamd@.service [ In reply to ]
Thanks for your hints!
Didn't know how to properly customize a service.
Will of course dive into that topic.

On 26.08.2019 11:27, Fajar A. Nugraha via clamav-users wrote:
> On Mon, Aug 26, 2019 at 4:18 PM Herbert via clamav-users
> <clamav-users@lists.clamav.net <mailto:clamav-users@lists.clamav.net>>
> wrote:
>
> Hi all,
>
> System Fedora 5.2.9-200.fc30.x86_64
> ClamAv 0.101.4
>
>
> I wonder why a DNF update changes my customized
> /usr/lib/systemd/clam@,service file.
>
>
> ... because you shouldn't have modified that file?
> https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/#modifying-existing-systemd-services
>
> Background:
> I had to add/change the following configurations in above
> mentioned file
> to overcome
> a timeout issue.
>
> TimeOutSec = 600
> #Restart = on-failure        # to avoid restarting on timeout failure
>
>
> If it's an addition, you could probably use systemd drop-in
> configuration file instead, e.g.
> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-Managing_Services_with_systemd-Unit_Files#brid-Managing_Services_with_systemd-Extending_Unit_Config
>
> IMHO an update should not change the service files, but instead
> install
> a new version of this file(s)
> with an appropriate extension. In addition DNF update should inform
> about this with a warning.
>
>
> Are you sure you're not confusing /usr/lib/systemd with files under
> /etc ? AFAIK what you wrote is correct for files in /etc.
>
> --
> Fajar
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml
Re: [clamav-users] Update policy for clamd@.service [ In reply to ]
On 26/08/2019 12:27, Fajar A. Nugraha via clamav-users wrote:
> On Mon, Aug 26, 2019 at 4:18 PM Herbert via clamav-users
> <clamav-users@lists.clamav.net <mailto:clamav-users@lists.clamav.net>>
> wrote:
>
> Hi all,
>
> System Fedora 5.2.9-200.fc30.x86_64
> ClamAv 0.101.4
>
>
> I wonder why a DNF update changes my customized
> /usr/lib/systemd/clam@,service file.
>
>
> ... because you shouldn't have modified that file?
> https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/#modifying-existing-systemd-services
>

Thanks for that link!

I'm having to modify service configuration as well due to fairly
outdated hardware where clamd loads about 3 minutes.

Probably ought to bugrep it to Fedora/CentOS etc.

Thanks,
Reio
Re: [clamav-users] Update policy for clamd@.service [ In reply to ]
Followed instructions on how to custimize an existing systemd service:

1) Created new folder /etc/systemd/system/clamd@.service.d

2) Created new file /etc/systemd/system/clamd@.service.d/custom.conf
[Unit]
Description = Customized clamd scanner (%i) daemon
Documentation=man:clamd(8) man:clamd.conf(5)
https://www.clamav.net/documents/
# Check for database existence
# ConditionPathExistsGlob=@DBDIR@/main.{c[vl]d,inc}
# ConditionPathExistsGlob=@DBDIR@/daily.{c[vl]d,inc}
After = syslog.target nss-lookup.target network.target
[Service]
Type = forking
ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf
#Restart = on-failure
TimeoutSec = 600

3) systemctl status clamd@scan.service reports an error:
Warning: The unit file, source configuration file or drop-ins of
clamd@scan.service changed on disk. Run 'systemctl daemon-reload' to
reload units.
? clamd@scan.service - Customized clamd scanner (scan) daemon
   Loaded: bad-setting (Reason: Unit clamd@scan.service has a bad unit
file setting.)
  Drop-In: /etc/systemd/system/clamd@.service.d
           ??custom.conf
   Active: inactive (dead)
     Docs: man:clamd(8)
           man:clamd.conf(5)
           https://www.clamav.net/documents/
           man:clamd(8)
           man:clamd.conf(5)
           https://www.clamav.net/documents/

clamd@scan.service: Service has more than one ExecStart= setting, which
is only allowed for Type=oneshot services. Refusing.

What am I missing?


On 26.08.2019 12:08, Reio Remma via clamav-users wrote:
> On 26/08/2019 12:27, Fajar A. Nugraha via clamav-users wrote:
>> On Mon, Aug 26, 2019 at 4:18 PM Herbert via clamav-users
>> <clamav-users@lists.clamav.net
>> <mailto:clamav-users@lists.clamav.net>> wrote:
>>
>> Hi all,
>>
>> System Fedora 5.2.9-200.fc30.x86_64
>> ClamAv 0.101.4
>>
>>
>> I wonder why a DNF update changes my customized
>> /usr/lib/systemd/clam@,service file.
>>
>>
>> ... because you shouldn't have modified that file?
>> https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/#modifying-existing-systemd-services
>>
>
> Thanks for that link!
>
> I'm having to modify service configuration as well due to fairly
> outdated hardware where clamd loads about 3 minutes.
>
> Probably ought to bugrep it to Fedora/CentOS etc.
>
> Thanks,
> Reio
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml
Re: [clamav-users] Update policy for clamd@.service [ In reply to ]
You only need:

[Service]
TimeoutSec = 600

Good luck,
Reio

> On 26 Aug 2019, at 14:22, Herbert via clamav-users <clamav-users@lists.clamav.net> wrote:
>
> Followed instructions on how to custimize an existing systemd service:
>
> 1) Created new folder /etc/systemd/system/clamd@.service.d
>
> 2) Created new file /etc/systemd/system/clamd@.service.d/custom.conf
> [Unit]
> Description = Customized clamd scanner (%i) daemon
> Documentation=man:clamd(8) man:clamd.conf(5) https://www.clamav.net/documents/
> # Check for database existence
> # ConditionPathExistsGlob=@DBDIR@/main.{c[vl]d,inc}
> # ConditionPathExistsGlob=@DBDIR@/daily.{c[vl]d,inc}
> After = syslog.target nss-lookup.target network.target
> [Service]
> Type = forking
> ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf
> #Restart = on-failure
> TimeoutSec = 600
>
> 3) systemctl status clamd@scan.service reports an error:
> Warning: The unit file, source configuration file or drop-ins of clamd@scan.service changed on disk. Run 'systemctl daemon-reload' to reload units.
> ? clamd@scan.service - Customized clamd scanner (scan) daemon
> Loaded: bad-setting (Reason: Unit clamd@scan.service has a bad unit file setting.)
> Drop-In: /etc/systemd/system/clamd@.service.d
> ??custom.conf
> Active: inactive (dead)
> Docs: man:clamd(8)
> man:clamd.conf(5)
> https://www.clamav.net/documents/
> man:clamd(8)
> man:clamd.conf(5)
> https://www.clamav.net/documents/
>
> clamd@scan.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
>
> What am I missing?
>
>
>> On 26.08.2019 12:08, Reio Remma via clamav-users wrote:
>>> On 26/08/2019 12:27, Fajar A. Nugraha via clamav-users wrote:
>>> On Mon, Aug 26, 2019 at 4:18 PM Herbert via clamav-users <clamav-users@lists.clamav.net> wrote:
>>>> Hi all,
>>>>
>>>> System Fedora 5.2.9-200.fc30.x86_64
>>>> ClamAv 0.101.4
>>>>
>>>>
>>>> I wonder why a DNF update changes my customized
>>>> /usr/lib/systemd/clam@,service file.
>>>>
>>>
>>> ... because you shouldn't have modified that file?
>>> https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/#modifying-existing-systemd-services
>>>
>>>
>>
>> Thanks for that link!
>>
>> I'm having to modify service configuration as well due to fairly outdated hardware where clamd loads about 3 minutes.
>>
>> Probably ought to bugrep it to Fedora/CentOS etc.
>>
>> Thanks,
>> Reio
>>
>>
>> _______________________________________________
>>
>> clamav-users mailing list
>> clamav-users@lists.clamav.net
>> https://lists.clamav.net/mailman/listinfo/clamav-users
>>
>>
>> Help us build a comprehensive ClamAV guide:
>> https://github.com/vrtadmin/clamav-faq
>>
>> http://www.clamav.net/contact.html#ml
>
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml
Re: [clamav-users] Update policy for clamd@.service [ In reply to ]
RESOLVED with help of
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-Managing_Services_with_systemd-Unit_Files#brid-Managing_Services_with_systemd-Extending_Unit_Config

I simply had to (removed former approach first):

1) cp /usr/lib/systemd/clam@.service  /etc/systemd/system/
2) made my changes in copied file
3) perfomed systemctl daemon-reload
4) Checked changes with systemd-delta:
[.. snippet ..]
[OVERRIDDEN] /etc/systemd/system/clamd@.service ?
/usr/lib/systemd/system/clamd@.service

--- /usr/lib/systemd/system/clamd@.service      2019-08-23
17:07:29.000000000 +0200
+++ /etc/systemd/system/clamd@.service  2019-08-26 14:17:31.144758369 +0200
@@ -1,5 +1,5 @@
 [Unit]
-Description = clamd scanner (%i) daemon
+Description = Customized clamd scanner (%i) daemon
 Documentation=man:clamd(8) man:clamd.conf(5)
https://www.clamav.net/documents/
 # Check for database existence
 # ConditionPathExistsGlob=@DBDIR@/main.{c[vl]d,inc}
@@ -9,4 +9,5 @@
 [Service]
 Type = forking
 ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf
-Restart = on-failure
+#Restart = on-failure
+TimeoutSec = 600

Thanks to everyone who helped. Great community indeed!



On 26.08.2019 11:27, Fajar A. Nugraha via clamav-users wrote:
> On Mon, Aug 26, 2019 at 4:18 PM Herbert via clamav-users
> <clamav-users@lists.clamav.net <mailto:clamav-users@lists.clamav.net>>
> wrote:
>
> Hi all,
>
> System Fedora 5.2.9-200.fc30.x86_64
> ClamAv 0.101.4
>
>
> I wonder why a DNF update changes my customized
> /usr/lib/systemd/clam@,service file.
>
>
> ... because you shouldn't have modified that file?
> https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/#modifying-existing-systemd-services
>
> Background:
> I had to add/change the following configurations in above
> mentioned file
> to overcome
> a timeout issue.
>
> TimeOutSec = 600
> #Restart = on-failure        # to avoid restarting on timeout failure
>
>
> If it's an addition, you could probably use systemd drop-in
> configuration file instead, e.g.
> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-Managing_Services_with_systemd-Unit_Files#brid-Managing_Services_with_systemd-Extending_Unit_Config
>
> IMHO an update should not change the service files, but instead
> install
> a new version of this file(s)
> with an appropriate extension. In addition DNF update should inform
> about this with a warning.
>
>
> Are you sure you're not confusing /usr/lib/systemd with files under
> /etc ? AFAIK what you wrote is correct for files in /etc.
>
> --
> Fajar
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml