-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive env-var replacement not performed for Image=...
of the [Container]
section
#23626
Comments
I tried the example on Fedora CoreOS 40.20240728.1.1 which has systemd 255.10
|
Yeah, sorry about that. This line:
Should actually read like this (mind the curly braces):
The fact that systemd will require the curly I took shortcuts while describing the bug and attempted to write a "cleaner" unit file from scratch, and I wasn't careful enough to pay attention to the braces. (I would've thought it wouldn't make a difference anyway, since inside In any case, the point here is the recursive replacement of |
Yes that fixed it.
|
Take a look at the generated systemd unit and see if the error is present there? |
It's... complicated :-p Short answer first: expansion into Long answer: take for example this
It gets expanded into this
Trying to better understand systemd's behavior I wrote this
Result:
Oops. Not good. Let's try a different one:
This gives:
So... yep. Apparently it never was supposed to work. Systemd never did the substitution. More than that, it actually did escape the That it worked with the But what about the "well documented behavior"? There's a part of the systemd.service manpage that says:
But that doesn't mean what I thought it means (that's what I get for blindly trusting stackoverflow, hah!). And indeed, the systemd.exec manpage actually says:
My original statement that this was "apparently documented behavior" was inadvertently a blatant lie. So I'm apparently the podman quadlet behaves as expected after all. It's systemd that does funny things. I'm closing this as it's not a "bug" of podman (although this kind of behavior would be cool). Feel free to reopen if you think it's worth pursuing, but it feels outside the scope of podman. |
Issue Description
Generally, the systemd unit files have a fairly powerful ability of supporting (more) general configuration by means of env-files or variables. For instance:
Will result in an output like:
This also works recursively:
this logs:
The first part of this behavior, i.e. 1-st level replacement, extends to host-related parameters of the podman systemd.unit files, e.g. the
Image=...
key:this will result in:
But the recursive deplacement fails:
Result:
Steps to reproduce the issue
Steps to reproduce the issue
/etc/containers/systemd/test-recursive-fail.container
with the following contents:/etc/containers/systemd/test-recursive-work.container
like this:Reload systemd to ingest the files
systemctl daemon-reload
Verify that the
...fail.container
file fails, while the...work.container
behaves as expected:and that the systemd reflects the reason for the failure as:
Describe the results you received
Describe the results you received
Describe the results you expected
(For the results, check the
journalctl
output as demonstrated above.)podman info output
Podman version is 5.1.1 on Fedora CoreOS.
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
No
Additional environment details
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: