Bug 783134

Summary: no error reported when Key=value appeared outside of a [Section]
Product: [Fedora] Fedora Reporter: Kostas Georgiou <k.georgiou>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: devrim, hhorak, johannbg, lpoetter, metherid, mschmidt, notting, plautrba, systemd-maint, tgl
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-37-19.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-21 19:10:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kostas Georgiou 2012-01-19 13:51:28 UTC
Description of problem:
Unable to override environment variables in service file

Steps to Reproduce:
# cat > /etc/systemd/system/postgresql.service
.include /lib/systemd/system/postgresql.service
Environment=PGPORT=5432
Environment=PGDATA=/foo/pgsql/data
^D
# systemctl daemon-reload

Actual results:
# systemctl show postgresql.service  | grep Environment
Environment=PGPORT=5432 PGDATA=/var/lib/pgsql/data

Expected results:
# systemctl show postgresql.service  | grep Environment
Environment=PGPORT=5432 PGDATA=/foo/pgsql/data

Additional info:
Not sure if it is a systemd limitation or not but if it is
then instead of using Environment= something like 
EnvironmentFile=/etc/sysconfig/pgsql/postgres (does %p work there?)
similar to what many other services use.

Having to do a cp /lib/systemd/system/postgresql.service /etc/systemd/system/
isn't really an option.

Comment 1 Tom Lane 2012-01-19 14:45:06 UTC
Hm, yeah, I'd expect that to work too. But if it doesn't, it's a systemd bug not a bug in the particular service file.

Comment 2 Kostas Georgiou 2012-01-19 14:46:15 UTC
My bad, Adding [Service] fixes it

Comment 3 Tom Lane 2012-01-19 14:57:47 UTC
If that was it, shouldn't systemd have complained that the lines were in the wrong section?  It still seems like a bug, but in the nature of crummy error reporting rather than functionality.

Comment 4 Lennart Poettering 2012-03-13 01:43:07 UTC
systemd git will now generate a warning message in cases like this.

Comment 5 Fedora Update System 2012-03-16 02:02:02 UTC
systemd-44-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/systemd-44-1.fc17

Comment 6 Fedora Update System 2012-03-16 19:02:23 UTC
Package systemd-44-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-44-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-3918/systemd-44-1.fc17
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2012-03-21 19:10:18 UTC
systemd-44-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2012-04-17 08:15:56 UTC
systemd-37-19.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/systemd-37-19.fc16

Comment 9 Fedora Update System 2012-04-26 03:31:23 UTC
systemd-37-19.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.