Skip to content

Bug: podlet generate preserves ~ in paths, causing invalid Quadlet-generated systemd services #166

@youssef-hsn

Description

@youssef-hsn

When using podlet generate on a podman run command that contains paths starting with ~, the generated Quadlet (.container) file preserves ~ verbatim. When this Quadlet is later processed by the Podman Quadlet generator, the resulting systemd service contains an invalid relative path, causing the service to fail at runtime.

Replacing ~ with %h resolves the issue.


Environment

  • podlet: (version used)
  • podman: rootless
  • systemd: user services
  • Target: Quadlet (.container) generation

Problem Description

I encountered this issue while using podlet generate to convert a working podman run command into a Quadlet file.

Example input command:

podman run \
  -v ~/infra/pi-hole/etc-pihole:/etc/pihole:Z \
  docker.io/pihole/pihole:latest

Generated Quadlet (.container) output:

[Container]
Volume=~/infra/pi-hole/etc-pihole:/etc/pihole:Z

expanded, because systemd does not perform shell-style expansion.

As a result, the generated service passes an invalid relative path to Podman, and the container fails to start.


Expected Behavior

  • podlet generate should avoid emitting ~ in generated Quadlet files
  • Generated Quadlets should produce valid systemd services without manual editing

Actual Behavior

  • ~ is preserved literally in the generated Quadlet
  • systemd does not expand ~
  • Podman receives an invalid path
  • Generated service fails to start

Solution / Workaround

Manually replacing ~ with %h resolves the issue:

[Container]
Volume=%h/infra/pi-hole/etc-pihole:/etc/pihole:Z

Suggestion

One of the following would prevent this issue:)

  1. Translate ~ → %h during podlet generate
  2. Emit a warning when ~ is detected in paths
  3. Document clearly that ~ is not valid in Quadlet paths

Given that podlet targets systemd/Quadlet output, emitting systemd-compatible paths (%h) seems like the most robust solution.


Contribution Note

If this approach sounds reasonable to the maintainers, I’d be happy to take on this issue and submit a PR.

I can:

  • Update podlet generate to translate ~ into %h for Quadlet-compatible paths, or
  • Add validation/warnings when unsupported path expansions are detected, depending on preferred behavior.

Please let me know if you’d like me to proceed and if there are any design or implementation guidelines I should follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions