Red Hat Bugzilla – Bug 811537
dracut passes on PWD and SHLVL env vars to systemd
Last modified: 2012-04-11 07:19:57 EDT
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"
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.