Skip to content

Last environment key-value pair defined in a .pod quadlet is always overwritten #26521

Open
@eulores

Description

@eulores

Issue Description

While converting a systemd pod via quadlet syntax to a systemd unit, I notice that not all defined environment entries get converted. Seems as if the last defined entry is overwritten.

Steps to reproduce the issue

This is the smallest possible set-up that reliably shows the reported bug.

  1. Create a test.pod in a directory under ~/.config/containers/systemd/ with this content:
[Service]
Environment=key1=value1
Environment=key2=value2
  1. Run systemctl --user daemon-reload
  2. View the generated file: cat /run/user/1000/systemd/generator/test-pod.service

Describe the results you received

Describe the results you received

# Automatically generated by /usr/lib/systemd/user-generators/podman-user-generator
#
[Service]
Environment=key1=value1
Environment=PODMAN_SYSTEMD_UNIT=%n
SyslogIdentifier=%N
ExecStart=/usr/bin/podman pod start --pod-id-file=%t/%N.pod-id
ExecStop=/usr/bin/podman pod stop --pod-id-file=%t/%N.pod-id --ignore --time=10
ExecStopPost=/usr/bin/podman pod rm --pod-id-file=%t/%N.pod-id --ignore --force
ExecStartPre=/usr/bin/podman pod create --infra-conmon-pidfile=%t/%N.pid --pod-id-file=%t/%N.pod-id --exit-policy=stop --replace --infra-name systemd-test-infra --name systemd-test
Type=forking
Restart=on-failure
PIDFile=%t/%N.pid

[Unit]
Wants=podman-user-wait-network-online.service
After=podman-user-wait-network-online.service
SourcePath=.../test.pod
RequiresMountsFor=%t/containers

The second environment entry has been swallowed: Environment=key2=value2

Describe the results you expected

Describe the results you expected

...
[Service]
Environment=key1=value1
Environment=key2=value2
Environment=PODMAN_SYSTEMD_UNIT=%n
SyslogIdentifier=%N
...

The second environment entry is taken into account: Environment=key2=value2

podman info output

If you are unable to run podman info for any reason, please provide the podman version, operating system and its version and the architecture you are running.

Client:       Podman Engine
Version:      5.5.1
API Version:  5.5.1
Go Version:   go1.24.4
Built:        Thu Jan  1 01:00:00 1970
OS/Arch:      linux/amd64

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

No

Additional environment details

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.quadlettriagedIssue has been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions