Bug 738022 - On sendmail upgrade from sysv initscript to systemd unit files, 'systemctl try-restart sendmail.service' incorrectly stops sm-client.service
Summary: On sendmail upgrade from sysv initscript to systemd unit files, 'systemctl tr...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 16
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-13 16:12 UTC by Jaroslav Škarvada
Modified: 2013-02-12 01:43 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-12 01:43:25 UTC


Attachments (Terms of Use)

Description Jaroslav Škarvada 2011-09-13 16:12:33 UTC
Description of problem:
On sendmail upgrade from sysv initscript to systemd unit files, 'systemctl try-restart sendmail.service' incorrectly stops sm-client.service.

The following code is used in sendmail.spec file:

%triggerun -- sendmail < 8.14.5-3
%{_bindir}/systemd-sysv-convert --save sendmail >/dev/null 2>&1 ||:
/bin/systemctl enable sendmail.service >/dev/null 2>&1
/bin/systemctl enable sm-client.service >/dev/null 2>&1
/sbin/chkconfig --del sendmail >/dev/null 2>&1 || :
/bin/systemctl try-restart sendmail.service >/dev/null 2>&1 || :
/bin/systemctl try-restart sm-client.service >/dev/null 2>&1 || :

The problem is that before the command '/bin/systemctl try-restart sendmail.service >/dev/null 2>&1 || :' both sendmail and sm-client is running, but after it, only sendmail is running.

Version-Release number of selected component (if applicable):
systemd-35-1.fc16.x86_64

How reproducible:
Always

Steps to Reproduce:
1. yum install sendmail-8.14.5-2
2. /etc/init.d/sendmail restart
3. yum install sendmail-8.14.5.3
4. pgrep -lf sendmail
  
Actual results:
18232 sendmail: accepting connections

Expected results:
18232 sendmail: accepting connections
18241 sendmail: Queue runner@1:00:00 for /var/spool/clientmqueue

Additional info:
In sendmail-8.14.5-2 (sysv version of package) sm-client doesn't have initscript and it is directly started from the sendmail initscript. In sendmail-8.14.5-3 (systemd version of package) there is sendmail.service and sm-client.service. 

The sm-client is incorrectly stopped by the following command:
/bin/systemctl try-restart sendmail.service >/dev/null 2>&1 || :

Before the above command the sm-client is running, but the state is not correctly detected by systemd, e.g.:
# systemctl status sm-client.service
sm-client.service - Sendmail Mail Transport Client.
          Loaded: loaded (/lib/systemd/system/sm-client.service; enabled)
          Active: inactive (dead)
          CGroup: name=systemd:/system/sm-client.service

The PID is there and correct:
# cat /run/sm-client.pid
18241
/usr/sbin/sendmail -L sm-msp-queue -Ac -q1h

After manual restart of sm-client, any other try-restart worked as expected.

Comment 1 Lennart Poettering 2011-09-21 18:02:55 UTC
Not sure I fully grok this, but is this a duplicate of bug 735013?

Comment 2 Jaroslav Škarvada 2011-09-30 15:24:34 UTC
(In reply to comment #1)
> Not sure I fully grok this, but is this a duplicate of bug 735013?

Update to systemd-36-4 doesn't help.

The problem in short: sendmail sysv initscript started 2 processes. This initscript was forked into two unit files. The sendmail.service (with the same basename as the original sysv initscript) worked OK, but the newly created sm-client.service is not set to the correct state after update from sysv to systemd. The sm-client process still runs and the PID is there and match the one set in unit file, but the state is detected by inactive (dead). And what worse the sm-client process is killed (and not restarted) after "systemctl try-restart sendmail.service". It requires manual restart of sm-client to get into sync.

Comment 3 Michal Schmidt 2011-09-30 15:47:03 UTC
(In reply to comment #2)
> And what worse the sm-client process is killed (and not restarted) after
> "systemctl try-restart sendmail.service".

Do you get any warnings from systemd about this event in /var/log/messages?

Comment 4 Jaroslav Škarvada 2011-10-02 21:23:48 UTC
(In reply to comment #3)
> Do you get any warnings from systemd about this event in /var/log/messages?
>
Nothing relevant there, only reloading events:
... localhost systemd[1]:  Reloading.

I temporally workarounded it in the triggerun by adding:
 systemctl is-active sendmail.service && ! systemctl is-active sm-client.service && systemctl start sm-client.service

Comment 5 Fedora Admin XMLRPC Client 2011-10-20 16:30:59 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Jóhann B. Guðmundsson 2012-01-29 15:13:38 UTC
From the looks this report this is a bug against the sendmail spec file but before moving it against it is this still an issue?

Comment 7 Jaroslav Škarvada 2012-01-30 10:12:08 UTC
Retested and it is still reproducible. In short: sysv sendmail service that previously controlled two daemons (sendmail and sm-client) was forked into two systemd unitfiles (bound with Wants, i.e. sendmail Wants sm-client). On upgrade from sysv to systemd, sm-client is killed by sendmail try-restart and not restarted.

Steps to Reproduce:
1. yum install sendmail-8.14.5-2
2. /etc/init.d/sendmail restart
3. check that both sm-client and sendmail runs, if not restart them
4. yum upgrade sendmail-8.14.5-4
5. pgrep -lf sendmail

Actual results:
18232 sendmail: accepting connections
(only sendmail runs)

Expected results:
18232 sendmail: accepting connections
18241 sendmail: Queue runner@1:00:00 for /var/spool/clientmqueue
(both sendmail and sm-client run)

This inconsistency happens by 'systemctl try-restart sendmail.service' that is called from triggerun. Also sendmail.service has 'Wants=sm-client.service' and both have forking types and PID files specified. I was unable to narrow this more down.

This is minor problem, because it occurs only once during sysv to systemd upgrade (and I already workaround this in the current sendmail.spec) but I think it is systemd bug.

Comment 8 Jóhann B. Guðmundsson 2012-01-30 10:57:04 UTC
hmm still not seeing how this can be a systemd bug but it might be a rpm one. 
What happens if you put the sm-client bits into trigger run post section?

Duplicating this behaviour should not be problem thou just install a older version of sendmail with the legacy sysv init script then copy/create the unit files in /etc/systemd/system directory, reload the systemd daemon and run the rpm commands.

Comment 9 Jóhann B. Guðmundsson 2012-01-30 10:58:04 UTC
and by rpm commands I mean the commands in the triggerun section of the spec file

Comment 10 Harald Hoyer 2012-02-21 12:18:00 UTC
F17 has in sm-client.service:
BindTo=sendmail.service

Comment 11 Jaroslav Škarvada 2012-02-22 14:31:41 UTC
(In reply to comment #10)
> F17 has in sm-client.service:
> BindTo=sendmail.service

I will check it with bindto.

Comment 12 Fedora End Of Life 2013-01-16 17:41:31 UTC
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 13 Jóhann B. Guðmundsson 2013-02-12 01:43:25 UTC
I assume since there has not been a new comment since 2012-02-22 I assume bindto fixed this issue thus closing.


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