| Summary: | systemd-nspawn --setenv is too strict | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Miroslav Suchý <msuchy> |
| Component: | systemd | Assignee: | systemd-maint |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 25 | CC: | johannbg, jsynacek, lnykryn, msekleta, muadda, s, systemd-maint, zbyszek |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | systemd-229-1.fc24 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-08-04 05:00:28 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: | |
|
Description
Miroslav Suchý
2016-02-26 15:22:13 UTC
Works for me... $ rpm -q systemd systemd-222-14.fc23.x86_64 $ sudo systemd-nspawn -bM rawhide --setenv='PROMPT_COMMAND=printf "\x1b]0;<mock-chroot>\x07<mock-chroot>"' <Boots fine...> In the container: # cat /proc/1/environ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bincontainer=systemd-nspawnTERM=xterm-256colorHOME=/rootUSER=rootLOGNAME=rootPROMPT_COMMAND=printf "\x1b]0;<mock-chroot>\x07<mock-chroot>" # sudo env | grep PROMPT # sudo systemctl show-environment | grep PROMPT The --setenv only passes the environment to the init of the container. I'm not sure if it's currently possible to pass an environment variable to the entire container. Maybe Zbyszek knows? I can't reproduce the problem using nspawn directly either. https://github.com/systemd/systemd/pull/2880 adds some more tests. I tried setting config_opts['environment']['PROMPT_COMMAND'] in mock config in various ways and it doesn't seem to have any effect when --new-chroot is specified. Maybe you need one more level of escaping? This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle. Changing version to '25'. Passing of the environment variable seems to work fine. The variable is set for the init process in the container. To pass it to child processes, PassEnvironment should be used: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#PassEnvironment= (added in systemd-228). OK, I can confirm that with systemd-229-8.fc24.x86_64 it works. Even the reproducer from #0. |