podman generate systemd (systemd-user) service enabled but can't autostart

Created on 14 Mar 2020  路  4Comments  路  Source: containers/podman

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Steps to reproduce the issue:

1.podman generate systemd --name v2ray > v2ray.service

2.put v2ray.service to ~/.config/systemd/user/

3.systemctl --user enable (and start) v2ray.service

Describe the results you received:
v2ray.service can not autostart

Describe the results you expected:
v2ray.service can autostart

Additional information you deem important (e.g. issue happens only occasionally):
systemd-user haven't multi-user.target (see /usr/lib/systemd/user/), so v2ray.service cannot autostart. V2ray.service can autostart when change WantedBy to "default.target".

Output of podman version:

Version:            1.8.0
RemoteAPI Version:  1
Go Version:         go1.14rc1
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.14rc1
  podman version: 1.8.0
host:
  BuildahVersion: 1.13.1
  CgroupVersion: v2
  Conmon:
    package: conmon-2.0.11-0.6.dev.git86aa80b.fc32.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.11-dev, commit: b6ad06ed817c8b9d68bb7b92f32b7fb6d08bbb8f'
  Distribution:
    distribution: fedora
    version: "32"
  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
  MemFree: 5120434176
  MemTotal: 7917457408
  OCIRuntime:
    name: crun
    package: crun-0.12.2.1-1.fc32.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.12.2.1
      commit: cd7cea7114db5f6aa35fbb69fa307c19c2728a31
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  SwapFree: 8195665920
  SwapTotal: 8195665920
  arch: amd64
  cpus: 4
  eventlogger: journald
  hostname: xps
  kernel: 5.6.0-0.rc3.git0.1.fc32.x86_64
  os: linux
  rootless: true
  slirp4netns:
    Executable: /usr/bin/slirp4netns
    Package: slirp4netns-0.4.3-6.0.dev.gita8414d1.fc32.x86_64
    Version: |-
      slirp4netns version 0.4.3+dev
      commit: a8414d1d1629f6f7a93b60b55e183a93d10d9a1c
  uptime: 12m 0.24s
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  ConfigFile: /var/home/junjie/.config/containers/storage.conf
  ContainerStore:
    number: 1
  GraphDriverName: overlay
  GraphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-0.7.6-2.0.dev.gitce61c7e.fc32.x86_64
      Version: |-
        fusermount3 version: 3.9.0
        fuse-overlayfs: version 0.7.6
        FUSE library version 3.9.0
        using FUSE kernel interface version 7.31
  GraphRoot: /home/junjie/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 2
  RunRoot: /run/user/1000
  VolumePath: /home/junjie/.local/share/containers/storage/volumes

Package info (e.g. output of rpm -q podman or apt list podman):

[junjie@xps ~]$ rpm -qi podman
Name        : podman
Epoch       : 2
Version     : 1.8.0
Release     : 5.fc32
Architecture: x86_64
Install Date: Tue 10 Mar 2020 04:04:31 PM CST
Group       : Unspecified
Size        : 55990034
License     : ASL 2.0
Signature   : RSA/SHA256, Mon 24 Feb 2020 02:38:43 AM CST, Key ID 6c13026d12c944d0
Source RPM  : podman-1.8.0-5.fc32.src.rpm
Build Date  : Mon 24 Feb 2020 02:32:12 AM CST
Build Host  : buildhw-12.phx2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://podman.io/
Bug URL     : https://bugz.fedoraproject.org/podman
Summary     : Manage Pods, Containers and Container Images
Description :
podman (Pod Manager) is a fully featured container engine that is a simple
daemonless tool.  podman provides a Docker-CLI comparable command line that
eases the transition from other container engines and allows the management of
pods, containers and images.  Simply put: alias docker=podman.
Most podman commands can be run as a regular user, without requiring
additional privileges.

podman uses Buildah(1) internally to create container images.
Both tools share image (not container) storage, hence each can use or
manipulate images (but not containers) created by the other.

Manage Pods, Containers and Container Images
libpod Simple management tool for pods, containers and images

Additional environment details (AWS, VirtualBox, physical, etc.):

OS: Fedora Silverblue 32.20200310.n.0 (maybe alpha)

kinbug

Most helpful comment

Thanks for opening the issue! That's fixed in Podman v1.8.1. I just updated on Fedora 31.

All 4 comments

edited v2ray.service

# container-v2ray.service
# autogenerated by Podman 1.8.0
# Fri Mar 13 14:47:34 CST 2020

[Unit]
Description=Podman container-v2ray.service
Documentation=man:podman-generate-systemd(1)

[Service]
Restart=on-failure
ExecStart=/usr/bin/podman start v2ray
ExecStop=/usr/bin/podman stop -t 10 v2ray
PIDFile=/run/user/1000/overlay-containers/948dc4542cc60274e6cb825670d21ad4985c0af9ef4dc8623389470dfbd74ee2/userdata/conmon.pid
KillMode=none
Type=forking

[Install]
WantedBy=default.target # <------------------------------- HEAR!

Funny that you came across that now. I've talked about this here just 2 days ago: https://github.com/containers/libpod/issues/5494#issuecomment-598919821

:P

Thanks for opening the issue! That's fixed in Podman v1.8.1. I just updated on Fedora 31.

Was this page helpful?
0 / 5 - 0 ratings