Re: Question regarding systemd service unit cleanup

2019-10-17 Thread Michal Schorm
Hello,

Can you specify which packages are the A & B?

I wanted to reproduce the initial situation - that the service
requiring another will put a symlink to the "/usr/lib/systemd/system".
I forged iptables RPM containing service file mentioning
"Requires=firewalld.service" to see the link to be created, but it
wasn't.
(iptables because it builds fast and firewalld because it is already installed)

I wanted to run audit on the location to catch a process which would
create the symlink, in a hope that it won't be systemd itself, but
rather some systemd helper script, which name would be good starting
point for google.
( "auditctl -w /etc/systemd/system/" and "ausearch -f /etc/systemd/system/" )

--

Michal Schorm
Software Engineer
Core Services - Databases Team
Red Hat

--

On Sat, Oct 12, 2019 at 8:12 AM Ravindra Kumar via devel
 wrote:
>
> > You need something like this in a scriptlet:
> > if systemctl is-enabled A; systemctl reenable A; done
> >
> > This will remove the old links and create the new ones.
>
> Thanks Zbigniew for the idea. It seemed very promising and I tried it. 
> Unfortunately, it still did not help because "reenable" command seems to 
> recreate the links based on the service unit file which is newer and does not 
> reference the dropped dependency. So, the old link to service B was still 
> left around.
>
> The only working solution I have found is to disable service B explicitly in 
> post install scriptlet when it is called during upgrade.
>
> Thanks,
> Ravindra
> ___
> devel mailing list -- devel@lists.fedoraproject.org
> To unsubscribe send an email to devel-le...@lists.fedoraproject.org
> Fedora Code of Conduct: 
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: 
> https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org


Re: Question regarding systemd service unit cleanup

2019-10-11 Thread Ravindra Kumar via devel
> You need something like this in a scriptlet:
> if systemctl is-enabled A; systemctl reenable A; done
>
> This will remove the old links and create the new ones.

Thanks Zbigniew for the idea. It seemed very promising and I tried it. 
Unfortunately, it still did not help because "reenable" command seems to 
recreate the links based on the service unit file which is newer and does not 
reference the dropped dependency. So, the old link to service B was still left 
around.

The only working solution I have found is to disable service B explicitly in 
post install scriptlet when it is called during upgrade.

Thanks,
Ravindra
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org


RE: Question regarding systemd service unit cleanup

2019-10-11 Thread Ravindra Kumar via devel
> systemctl daemon-reload?

Thanks Dridi. I had forgotten to mention that I had tried daemon-reload and 
that did not help.

> Isn't this handled automatically by the %systemd scriptlets?

%systemd_post macro is a no-op for upgrade case - 
https://github.com/systemd/systemd/blob/master/src/core/macros.systemd.in#L46 
($1 would be "2" for upgrade in "post" scriptlet - 
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/).

- Ravindra
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org


Re: Question regarding systemd service unit cleanup

2019-10-08 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Oct 09, 2019 at 06:04:39AM +, Dridi Boukelmoune wrote:
> On Tue, Oct 8, 2019 at 6:45 PM Ravindra Kumar via devel
>  wrote:
> >
> > Hi,
> >
> >
> >
> > I have removed dependency on service B from service A and all references to 
> > service B. The new package works well for fresh install (service A can be 
> > started normally), but it does not work for upgrades from previous versions 
> > where service A used to depend on service B (starting service A fails as it 
> > can’t fine the service unit for service B). After upgrade from a previous 
> > version of the package, I noticed that a symlink to service B is left under 
> > /etc/system/system/A.service.requires dir that is causing the issue:
> >
> > # ls -l /etc/systemd/system/A.service.requires
> >
> > total 0
> >
> > lrwxrwxrwx. 1 root root 45 Oct  8 11:10 B.service -> 
> > /usr/lib/systemd/system/B.service
> >
> >
> >
> > Basically, some cleanup is needed to remove the requires symlink that is no 
> > longer needed.

You need something like this in a scriptlet:
if systemctl is-enabled A; systemctl reenable A; done

This will remove the old links and create the new ones.

> > Any advice/examples of such cleanup?
> 
> systemctl daemon-reload?
> 
> Isn't this handled automatically by the %systemd scriptlets?
> 
> Dridi
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org


Re: Question regarding systemd service unit cleanup

2019-10-08 Thread Dridi Boukelmoune
On Tue, Oct 8, 2019 at 6:45 PM Ravindra Kumar via devel
 wrote:
>
> Hi,
>
>
>
> I have removed dependency on service B from service A and all references to 
> service B. The new package works well for fresh install (service A can be 
> started normally), but it does not work for upgrades from previous versions 
> where service A used to depend on service B (starting service A fails as it 
> can’t fine the service unit for service B). After upgrade from a previous 
> version of the package, I noticed that a symlink to service B is left under 
> /etc/system/system/A.service.requires dir that is causing the issue:
>
> # ls -l /etc/systemd/system/A.service.requires
>
> total 0
>
> lrwxrwxrwx. 1 root root 45 Oct  8 11:10 B.service -> 
> /usr/lib/systemd/system/B.service
>
>
>
> Basically, some cleanup is needed to remove the requires symlink that is no 
> longer needed.
>
>
>
> Any advice/examples of such cleanup?

systemctl daemon-reload?

Isn't this handled automatically by the %systemd scriptlets?

Dridi
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org