Bug 811537 - dracut passes on PWD and SHLVL env vars to systemd
Summary: dracut passes on PWD and SHLVL env vars to systemd
Alias: None
Product: Fedora
Classification: Fedora
Component: dracut
Version: 17
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: dracut-maint
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2012-04-11 11:09 UTC by Lennart Poettering
Modified: 2012-04-11 11:19 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-04-11 11:19:57 UTC
Type: Bug

Attachments (Terms of Use)

Description Lennart Poettering 2012-04-11 11:09:26 UTC

Not sure whether bash or dracut is to blame here, but for some reason it seems that systemd when invoked gets PWD=/ and SHLVL=0 passed in the env block which is then inherited to all system services. And we probably shouldn't do that...

This can easily be checked with "cat /proc/1/environ"

Comment 1 Lennart Poettering 2012-04-11 11:19:57 UTC
Hmm, so it seems that bash always implicitly exports "PWD", "SHLVL" and "_". See comments in:


Given that people might actually invoke us with an exec from an init=/bin/sh boot it probably makes sense for systemd to unconditionally unset these env vars. Also, this behaviour seems to apply to both bash and the busybox shell, hence it's generic enough to be something to unset in systemd. 

I guess that means that there's nothing to fix in dracut. Closing again. Sorry for the noise.

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