Bug 63735

Summary: RPM macros and socket activated services uninstall
Product: systemd Reporter: Marcos Mello <marcosfrm>
Component: generalAssignee: systemd-bugs
Status: RESOLVED NOTOURBUG QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Marcos Mello 2013-04-19 17:30:15 UTC
As discussed on opensuse-factory

http://lists.opensuse.org/opensuse-factory/2013-04/msg00285.html

there's a problem with current systemd RPM macros when socket activated services are uninstalled.

In the time window between %preun "systemctl --no-reload disable" and %postun "systemctl daemon-reload" service can be started again.
Comment 1 Lennart Poettering 2013-09-12 18:17:06 UTC
Can you elaborate? 

Note that for socket activated services both the socket and the service unit name need to be listed on the macro invocation.
Comment 2 Marcos Mello 2013-09-16 16:15:04 UTC
After rsyslog removal, its process keeps running and systemctl status shows

# systemctl status rsyslog.service
rsyslog.service
          Loaded: error (Reason: No such file or directory)
          Active: active (running) since Mon, 2013-09-16 13:07:03 BRT; 49s ago
        Main PID: 1913 (rsyslogd)

Sep 16 13:07:03 pentium.localdomain systemd[1]: Started System Logging Service.


On openSUSE 12.3, rpm runs at %preun

D: %preun(rsyslog-7.2.7-2.5.1.i586): scriptlet start
D: %preun(rsyslog-7.2.7-2.5.1.i586): execv(/bin/sh) pid 2369
+ test -n ''
+ FIRST_ARG=0
+ '[' 0 -eq 0 ']'
+ /usr/bin/systemctl --no-reload disable rsyslog.service
+ /usr/bin/systemctl stop rsyslog.service

and at %postun

D: %postun(rsyslog-7.2.7-2.5.1.i586): scriptlet start
D: %postun(rsyslog-7.2.7-2.5.1.i586): execv(/bin/sh) pid 2375
+ /sbin/ldconfig
+ test -n ''
+ FIRST_ARG=0
+ '[' 0 -ge 1 ']'
+ for service in rsyslog.service
+ sysv_service=rsyslog
+ rm -f /var/lib/systemd/migrated/rsyslog
+ /usr/bin/systemctl daemon-reload

So the socket is triggering rsyslog.service between %preun e %postun and rsyslogd is now a zombie...
Comment 3 Marcos Mello 2013-09-16 16:23:18 UTC
Just to mention that rsyslogd PID before uninstall is different from the left over process (i.e. it was started again).
Comment 4 Lennart Poettering 2013-09-16 19:54:03 UTC
Those rpm scriptlets are broken. They need to stop/disable all units they ship with the RPM, i.e. both the socket and the service unit.

Please file a bug against Suse packaging to list them all.
Comment 5 Marcos Mello 2013-09-18 11:11:30 UTC
Thanks Lennart.

Done: https://bugzilla.novell.com/show_bug.cgi?id=840815

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.