Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
I've managed to get a container up and running with a device passed in. Now I'm trying to generate a systemd unit so thiat it will start the container when I power cycle to box. running podman generate systemd ... gives me the error pasted below.
Steps to reproduce the issue:
Start a container named motioneye
sudo podman generate systemd motioneye -f --restart-policy restart-always
boom
Describe the results you received:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x56382de2c04d]
goroutine 1 [running]:
panic(0x56382e3f4a60, 0x56382f3f3750)
/usr/lib/golang/src/runtime/panic.go:1064 +0x471 fp=0xc000595b98 sp=0xc000595ae0 pc=0x56382cc52301
runtime.panicmem(...)
/usr/lib/golang/src/runtime/panic.go:212
runtime.sigpanic()
/usr/lib/golang/src/runtime/signal_unix.go:695 +0x3de fp=0xc000595bc8 sp=0xc000595b98 pc=0x56382cc6964e
github.com/containers/libpod/cmd/podman/generate.systemd(0x56382f411c60, 0xc0001b7e40, 0x1, 0x4, 0x0, 0x0)
/builddir/build/BUILD/podman-2.0.4/_build/src/github.com/containers/libpod/cmd/podman/generate/systemd.go:58 +0x15d fp=0xc000595c88 sp=0xc000595bc8 pc=0x56382de2c04d
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).execute(0x56382f411c60, 0xc0001ae030, 0x4, 0x4, 0x56382f411c60, 0xc0001ae030)
/builddir/build/BUILD/podman-2.0.4/_build/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:838 +0x455 fp=0xc000595d60 sp=0xc000595c88 pc=0x56382d647455
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x56382f420360, 0xc0001a8020, 0x56382e3f1a60, 0x56382f4c9388)
/builddir/build/BUILD/podman-2.0.4/_build/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:943 +0x319 fp=0xc000595e38 sp=0xc000595d60 pc=0x56382d647f59
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).Execute(...)
/builddir/build/BUILD/podman-2.0.4/_build/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:883
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).ExecuteContext(...)
/builddir/build/BUILD/podman-2.0.4/_build/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:876
main.Execute()
/builddir/build/BUILD/podman-2.0.4/_build/src/github.com/containers/libpod/cmd/podman/root.go:91 +0xee fp=0xc000595eb8 sp=0xc000595e38 pc=0x56382df02a8e
main.main()
/builddir/build/BUILD/podman-2.0.4/_build/src/github.com/containers/libpod/cmd/podman/main.go:68 +0x18e fp=0xc000595f88 sp=0xc000595eb8 pc=0x56382df024ae
runtime.main()
/usr/lib/golang/src/runtime/proc.go:203 +0x202 fp=0xc000595fe0 sp=0xc000595f88 pc=0x56382cc54d82
runtime.goexit()
/usr/lib/golang/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000595fe8 sp=0xc000595fe0 pc=0x56382cc83e61
Describe the results you expected:
I expected
Additional information you deem important (e.g. issue happens only occasionally):
Output of podman version:
Version: 2.0.4
API Version: 1
Go Version: go1.14.6
Built: Wed Dec 31 19:00:00 1969
OS/Arch: linux/amd64
Output of podman info --debug:
host:
arch: amd64
buildahVersion: 1.15.0
cgroupVersion: v2
conmon:
package: conmon-2.0.19-1.fc32.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.0.19, commit: 5dce9767526ed27f177a8fa3f281889ad509fea7'
cpus: 4
distribution:
distribution: fedora
version: "32"
eventLogger: file
hostname: fitlet2
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: 5.7.10-201.fc32.x86_64
linkmode: dynamic
memFree: 608137216
memTotal: 8155160576
ociRuntime:
name: crun
package: crun-0.14.1-1.fc32.x86_64
path: /usr/bin/crun
version: |-
crun version 0.14.1
commit: 598ea5e192ca12d4f6378217d3ab1415efeddefa
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
os: linux
remoteSocket:
path: /run/user/1000/podman/podman.sock
rootless: true
slirp4netns:
executable: /usr/bin/slirp4netns
package: slirp4netns-1.1.4-1.fc32.x86_64
version: |-
slirp4netns version 1.1.4
commit: b66ffa8e262507e37fca689822d23430f3357fe8
libslirp: 4.3.1
SLIRP_CONFIG_VERSION_MAX: 2
swapFree: 3204444160
swapTotal: 3204444160
uptime: 111h 32m 40.47s (Approximately 4.62 days)
registries:
search:
- registry.fedoraproject.org
- registry.access.redhat.com
- registry.centos.org
- docker.io
store:
configFile: /home/jligon/.config/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: overlay
graphOptions:
overlay.mount_program:
Executable: /usr/bin/fuse-overlayfs
Package: fuse-overlayfs-1.1.2-1.fc32.x86_64
Version: |-
fusermount3 version: 3.9.1
fuse-overlayfs: version 1.1.0
FUSE library version 3.9.1
using FUSE kernel interface version 7.31
graphRoot: /home/jligon/.local/share/containers/storage
graphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "false"
Supports d_type: "true"
Using metacopy: "false"
imageStore:
number: 1
runRoot: /run/user/1000/containers
volumePath: /home/jligon/.local/share/containers/storage/volumes
version:
APIVersion: 1
Built: 0
BuiltTime: Wed Dec 31 19:00:00 1969
GitCommit: ""
GoVersion: go1.14.6
OsArch: linux/amd64
Version: 2.0.4
Package info (e.g. output of rpm -q podman or apt list podman):
podman-2.0.4-1.fc32.x86_64
Additional environment details (AWS, VirtualBox, physical, etc.):
Linux fitlet2 5.7.10-201.fc32.x86_64 #1 SMP Thu Jul 23 00:58:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Thanks for opening the issue, @jtligon! I'll wrap up a fix.
@jtligon, to unblock your work: use "always" instead of "restart-always".
looks great!
tyvm sir!
/home/jligon/container-2193796636fdba68b7c869be05ae35bb3bb47f92ac2b1b2193424aa9f705dd23.service
panic still needs cleaning up, i assume.
Awesome!
Here's a PR to fix the issue: https://github.com/containers/podman/pull/7272
Most helpful comment
@jtligon, to unblock your work: use "always" instead of "restart-always".