Skip to content

[Quadlet] DefaultInstance is ignored when installing generated unit #17662

@mfschumann

Description

@mfschumann

Issue Description

I've defined a template unit [email protected] that I want to run multiple instances of. The unit has a [Install] section because I want a default instance based on the template to be enabled automatically. In order to specify a default instance, you can set DefaultInstance= in ordinary systemd units. This instance is effective when enabling the template unit without explicitly specifying an instance.

Template units generated and automatically enabled by quadlet seem to ignore DefaultInstance=: The links created in e.g. /run/systemd/generator/default.target.wants are named like the plain template units ([email protected]), i.e. without setting the instance to the given default instance. Instead, I would wish that quadlet behaves consistently to systemctl enable in that it honors DefaultInstance= for template units, i.e. create a symlink named [email protected] if DefaultInstance=martin in the template unit.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Create a template unit [email protected] including this section:
[Install]
WantedBy=default.target
DefaultInstance=example
  1. systemctl daemon-reload

Describe the results you received

/run/systemd/generator/default.target.wants/[email protected] is created.

Describe the results you expected

/run/systemd/generator/default.target.wants/[email protected] is created, being a symlink to ../[email protected].

podman info output

host:
  arch: amd64
  buildahVersion: 1.29.0
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.6-3.fc37.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.6, commit: '
  cpuUtilization:
    idlePercent: 97.65
    systemPercent: 0.65
    userPercent: 1.7
  cpus: 4
  distribution:
    distribution: fedora
    variant: iot
    version: "37"
  eventLogger: journald
  hostname: srv4.mfs.name
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.1.13-200.fc37.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 701988864
  memTotal: 4105961472
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.8-1.fc37.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.8
      commit: 0356bf4aff9a133d655dc13b1d9ac9424706cac4
      rundir: /run/user/0/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  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
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-8.fc37.x86_64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 4104908800
  swapTotal: 4105170944
  uptime: 1h 14m 7.00s (Approximately 0.04 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.mfs.name
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 21
    paused: 0
    running: 19
    stopped: 2
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 82945986560
  graphRootUsed: 61522329600
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 32
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.4.1
  Built: 1676629579
  BuiltTime: Fri Feb 17 11:26:19 2023
  GitCommit: ""
  GoVersion: go1.19.5
  Os: linux
  OsArch: linux/amd64

Podman in a container

No

Privileged Or Rootless

Privileged

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.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.quadletstale-issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions