Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1426214

Summary: Backport PassEnvironment= support in systemd.exec
Product: Red Hat Enterprise Linux 7 Reporter: Robert Scheck <redhat-bugzilla>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Branislav Blaškovič <bblaskov>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: bblaskov, fsumsal, jsynacek, robert.scheck, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-219-33.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 09:14:52 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 Robert Scheck 2017-02-23 12:47:39 UTC
Description of problem:
The setting PassEnvironment= in systemd.exec was introduced in 2015 to allow
passing environment variables to daemons, which makes especially sense when the
system is inside a container. Upstream discussion:

  https://lists.freedesktop.org/archives/systemd-devel/2015-June/033130.html

Please backport the PassEnvironment= support in systemd.exec into RHEL 7.x.

Version-Release number of selected component (if applicable):
systemd-219-30.el7_3.6.x86_64

Actual results:
No PassEnvironment= support in systemd.exec.

Expected results:
PassEnvironment= support in systemd.exec ;-)

Comment 2 Robert Scheck 2017-02-23 12:50:06 UTC
Cross-filed case #01798185 on the Red Hat customer portal.

Comment 4 Jan Synacek 2017-02-28 10:52:33 UTC
A possible test scenario:

1)

# systemctl set-environment TEST_ENV=ttt1 TEST=t2t
# cat /etc/systemd/system/test.service 
[Unit]
Description=Test
[Service]
Environment=FOO=fffff BAR=bbbbb
PassEnvironment=TEST_ENV TEST I_DONT_EXIST TEST
ExecStart=/usr/bin/bash -c 'echo "$TEST_ENV::$TEST::$FOO::$BAR" ; /usr/bin/sleep 60'

# systemctl start test
# # Grep for expected/unexpected output in systemctl status

2)

# # Again, set some environment as in 1).
# systemd-run -p "PassEnvironment=TEST" /usr/bin/bash -c 'echo $TEST ; sleep 30'
# # Grep for expected/unexpected output in systemctl status


Ideally, it would be great to test for various combination of Environment and PassEnvironment, trying to set the values several times, passing nonexistent environment, etc.

Comment 5 Jan Synacek 2017-03-07 08:21:53 UTC
https://github.com/lnykryn/systemd-rhel/pull/98

Comment 11 errata-xmlrpc 2017-08-01 09:14:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2297