Skip to content

podman quadlet rm -r is leading to issue when existing file is in a sub directory #28118

@axel7083

Description

@axel7083

Issue Description

Describe your issue

Steps to reproduce the issue

Steps to reproduce the issue

  1. Create a dummy hello.container in the cwd
  2. Copy the file in ~/.config/containers/systemd/dummy/hello.container
  3. Run podman quadlet install hello.container
  4. assert error
Error: quadlet "./dummy/hello.container" failed to install: a Quadlet with name hello.container already exists, refusing to overwrite
Error: errors occurred installing some Quadlets
  1. Rerun the command with the --replace flag podman quadlet install -r hello.container
  2. Assert exit code zero
  3. Run podman quadlet list
  4. Assert error
ERRO[0000] Unexpected unit returned by systemd - was not searching for hello.service 

Describe the results you received

The quadlet was suppose to "replace" but in reality it has not touched the previous file

Describe the results you expected

I would expect that the quadlet in a subdirectory is deleted when using the --replace flag

podman info output

host:
  arch: amd64
  buildahVersion: 1.43.0-dev
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.13-2.fc43.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.13, commit: '
  cpuUtilization:
    idlePercent: 95.43
    systemPercent: 0.65
    userPercent: 3.92
  cpus: 16
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: workstation
    version: "43"
  emulatedArchitectures:
  - linux/arm
  - linux/arm64
  - linux/arm64be
  - linux/loong64
  - linux/mips
  - linux/mips64
  - linux/ppc
  - linux/ppc64
  - linux/ppc64le
  - linux/riscv32
  - linux/riscv64
  - linux/s390x
  eventLogger: journald
  freeLocks: 2026
  hostname: 2a02-8440-3503-65e2-0226-1666-b9ce-5950.rev.sfr.net
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
  kernel: 6.18.7-200.fc43.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 47472615424
  memTotal: 67105533952
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    defaultNetwork: podman
    dns:
      package: aardvark-dns-1.17.0-1.fc43.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.17.0
    package: netavark-1.17.1-1.fc43.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.17.1
  ociRuntime:
    name: crun
    package: crun-1.25.1-1.fc43.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.25.1
      commit: 156ae065d4a322d149c7307034f98d9637aa92a2
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20260120.g386b5f5-1.fc43.x86_64
    version: |
      pasta 0^20260120.g386b5f5-1.fc43.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 8589930496
  swapTotal: 8589930496
  uptime: 0h 54m 51.00s
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
store:
  containerStore:
    number: 8
    paused: 0
    running: 0
    stopped: 8
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/axel7083/.local/share/containers/storage
  graphRootAllocated: 1022505254912
  graphRootUsed: 553176559616
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 178
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/axel7083/.local/share/containers/storage/volumes
version:
  APIVersion: 6.0.0-dev
  Built: 1771452423
  BuiltTime: Wed Feb 18 23:07:03 2026
  GitCommit: ec0f63c6e59785142d9996bbaa91a4865613f0a6-dirty
  GoVersion: go1.24.6
  Os: linux
  OsArch: linux/amd64
  Version: 6.0.0-dev

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

No

Additional environment details

Using main branch

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.quadlet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions