Skip to content
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

systemd service generated by quadlet are not running when it requires a service which need a long time to start #24994

Closed
nitezs opened this issue Jan 11, 2025 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@nitezs
Copy link

nitezs commented Jan 11, 2025

Issue Description

I'm not sure if it's my usage wrong or a bug.

Steps to reproduce the issue

  1. I generate quadlet from compose file by podlet

    # compose.yaml
    name: immich
    services:
      server:
        image: ghcr.io/immich-app/immich-server:release
        volumes:
          - ./library:/usr/src/app/upload
          - /etc/localtime:/etc/localtime:ro
        ports:
          - 2283:2283
        depends_on:
          - redis
          - database
        restart: unless-stopped
        labels:
          - "io.containers.autoupdate=registry"
      machine-learning:
        image: ghcr.io/immich-app/immich-machine-learning:release
        # deploy:
        #   resources:
        #     reservations:
        #       devices:
        #         - driver: nvidia
        #           count: all
        #           capabilities:
        #             - compute
        #             - utility
        volumes:
          - ./model-cache:/cache
        restart: unless-stopped
        labels:
          - "io.containers.autoupdate=registry"
      redis:
        container_name: immich-redis
        image: docker.io/library/redis:6.2-alpine
        restart: unless-stopped
        labels:
          - "io.containers.autoupdate=registry"
      database:
        image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0
        environment:
          POSTGRES_PASSWORD: postgres
          POSTGRES_USER: postgres
          POSTGRES_DB: immich
          POSTGRES_INITDB_ARGS: --data-checksums
        volumes:
          - ./postgres:/var/lib/postgresql/data
        healthcheck:
          test: >-
            pg_isready --dbname="immich" --username="postgres" || exit 1;
            Chksum="$$(psql --dbname="immich" --username="postgres" --tuples-only --no-align
            --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')";
            echo "checksum failure count is $$Chksum";
            [ "$$Chksum" = '0' ] || exit 1
          interval: 5m
          start_interval: 30s
          start_period: 5m
          timeout: 900s
        command: >-
          postgres
          -c shared_preload_libraries=vectors.so
          -c 'search_path="$$user", public, vectors'
          -c logging_collector=on
          -c max_wal_size=2GB
          -c shared_buffers=512MB
          -c wal_compression=on
        restart: unless-stopped
        labels:
          - "io.containers.autoupdate=registry"
    networks: {}
    

    podlet -u -a --override -i compose --pod
    5 files generated:

    # immich-database.container
    [Container]
    AutoUpdate=registry
    Environment=POSTGRES_PASSWORD=postgres POSTGRES_USER=postgres    POSTGRES_DB=immich POSTGRES_INITDB_ARGS=--data-checksums
    Exec=postgres -c 'shared_preload_libraries=vectors.so' -c    'search_path="$$user", public, vectors' -c    'logging_collector=on' -c 'max_wal_size=2GB' -c    'shared_buffers=512MB' -c 'wal_compression=on'
    HealthCmd=pg_isready --dbname="immich"    --username="postgres" || exit 1; Chksum="$$(psql    --dbname="immich" --username="postgres" --tuples-only    --no-align --command='SELECT COALESCE(SUM(checksum_failures),    0) FROM pg_stat_database')"; echo "checksum failure count is    $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
    HealthInterval=5m
    HealthStartPeriod=5m
    HealthStartupInterval=30s
    HealthTimeout=15m
    Image=docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0
    Pod=immich.pod
    Volume=/mnt/hdd/pod/immich/postgres:/var/lib/postgresql/data
    
    [Service]
    Restart=always
    
    [Install]
    WantedBy=default.target
    
    # immich-machine-learning.container
    [Container]
    AutoUpdate=registry
    Image=ghcr.io/immich-app/immich-machine-learning:release
    Pod=immich.pod
    Volume=/mnt/hdd/pod/immich/model-cache:/cache
    
    [Service]
    Restart=always
    
    [Install]
    WantedBy=default.target
    
    # immich-redis.container
    [Container]
    AutoUpdate=registry
    ContainerName=immich-redis
    Image=docker.io/library/redis:6.2-alpine
    Pod=immich.pod
    
    [Service]
    Restart=always
    
    [Install]
    WantedBy=default.target
    
    # immich-server.container
    [Unit]
    Requires=redis.service database.service
    After=redis.service database.service
    
    [Container]
    AutoUpdate=registry
    Image=ghcr.io/immich-app/immich-server:release
    Pod=immich.pod
    Volume=/mnt/hdd/pod/immich/library:/usr/src/app/upload
    Volume=/etc/localtime:/etc/localtime:ro
    
    [Service]
    Restart=always
    
    [Install]
    WantedBy=default.target
    
    # immich.pod
    [Pod]
    PublishPort=2283:2283
    
    [Install]
    WantedBy=default.target
    
  2. due to the database container needs a long time to start, I add TimeoutStartSec=900 to immich-database.container [Service] part

  3. run systemctl --user daemon-reload

  4. run systemctl --user start immich-pod.service

Describe the results you received

after a few minutes, all services are running except immich-server.service

systemctl --user status immich-server.service
○ immich-server.service
     Loaded: loaded (/home/nite/.config/containers/systemd/immich-server.container; generated)
     Active: inactive (dead)
podman container ls
af6d850b0af5  localhost/podman-pause:5.3.1-1732225906                                   22 minutes ago  Up 22 minutes            0.0.0.0:2283->2283/tcp            systemd-immich-infra
c5e704685b95  docker.io/library/redis:6.2-alpine                  redis-server          22 minutes ago  Up 22 minutes            0.0.0.0:2283->2283/tcp, 6379/tcp  immich-redis
322ae1037981  ghcr.io/immich-app/immich-machine-learning:release  ./start.sh            22 minutes ago  Up 22 minutes            0.0.0.0:2283->2283/tcp            systemd-immich-machine-learning
30b4851de4a8  docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0        postgres -c share...  22 minutes ago  Up 22 minutes (healthy)  0.0.0.0:2283->2283/tcp, 5432/tcp  systemd-immich-database

Describe the results you expected

all containers run correctly

podman info output

host:
  arch: amd64
  buildahVersion: 1.38.0
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-1:2.1.12-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: e8896631295ccb0bfdda4284f1751be19b483264'
  cpuUtilization:
    idlePercent: 93.85
    systemPercent: 1.52
    userPercent: 4.63
  cpus: 16
  databaseBackend: sqlite
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  freeLocks: 2035
  hostname: pc
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.12.8-zen1-1-zen
  linkmode: dynamic
  logDriver: journald
  memFree: 10190417920
  memTotal: 33566814208
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.13.1-1
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 1.13.1
    package: netavark-1.13.1-1
    path: /usr/lib/podman/netavark
    version: netavark 1.13.1
  ociRuntime:
    name: crun
    package: crun-1.19.1-2
    path: /usr/bin/crun
    version: |-
      crun version 1.19.1
      commit: 3e32a70c93f5aa5fea69b50256cca7fd4aa23c80
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-2024_12_11.09478d5-1
    version: |
      pasta 2024_12_11.09478d5
      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: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 3440492544
  swapTotal: 4294963200
  uptime: 36h 29m 5.00s (Approximately 1.50 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/nite/.config/containers/storage.conf
  containerStore:
    number: 8
    paused: 0
    running: 8
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/nite/.local/share/containers/storage
  graphRootAllocated: 490048585728
  graphRootUsed: 221425315840
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 7
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/nite/.local/share/containers/storage/volumes
version:
  APIVersion: 5.3.1
  Built: 1732225906
  BuiltTime: Fri Nov 22 05:51:46 2024
  GitCommit: 4cbdfde5d862dcdbe450c0f1d76ad75360f67a3c
  GoVersion: go1.23.3
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.1

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Operating System: Arch Linux
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.12.8-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × Intel® Core™ i9-9900K CPU @ 3.60GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 2080 SUPER/PCIe/SSE2
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: Z390 AORUS MASTER

Additional information

No response

@nitezs nitezs added the kind/bug Categorizes issue or PR as related to a bug. label Jan 11, 2025
@nitezs nitezs closed this as completed Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant