Bug 1255031

Summary: remain-after-exit doesn't work in transient units
Product: Red Hat Enterprise Linux 7 Reporter: Jakub Prokes <jprokes>
Component: systemdAssignee: systemd-maint
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: lnykryn, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-19 22:48:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jakub Prokes 2015-08-19 13:10:00 UTC
Description of problem:
According to documentation systemd-run and systemd.service, unit should stay in "active" status after process end, but thats not happen.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.systemd-run --unit test2 true --remain-after-exit
2.systemctl -l status test2.service
3.

Actual results:
[0 root@qeos-48 test]# systemd-run --unit test2 true --remain-after-exit
Running as unit test2.service.
[0 root@qeos-48 test]# systemctl -l status test2.service
● test2.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

Aug 19 09:08:10 qeos-48.lab.eng.rdu2.redhat.com systemd[1]: Started /usr/bin/true --remain-after-exit.
Aug 19 09:08:10 qeos-48.lab.eng.rdu2.redhat.com systemd[1]: Starting /usr/bin/true --remain-after-exit...

Expected results:


Additional info:

Comment 2 Lukáš Nykrýn 2015-08-19 22:48:24 UTC
I think that the problem is that the remain-after-exit parameter is added to the command true, you should call
systemd-run --unit test2 --remain-after-exit true
then, at least on fedora, it works fine.

Comment 3 Jakub Prokes 2015-08-24 14:05:50 UTC
Thats true, I have been writing comment in parallel to you. Automated test works now. Sorry for disturbing.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: unit --remain-after-exit
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'systemd-run --unit test --remain-after-exit true' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl -l status test.service' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl stop test.service' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl -l status test.service' (Expected 3, got 3)
:: [   PASS   ] :: Command 'systemd-run --unit test true' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl -l status test.service' (Expected 3, got 3)
:: [   PASS   ] :: Command 'systemctl stop test.service' (Expected 5, got 5)
:: [   LOG    ] :: Duration: 11s
:: [   LOG    ] :: Assertions: 7 good, 0 bad
:: [   PASS   ] :: RESULT: unit --remain-after-exit