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

panic on podman run --rootfs #2654

Closed
vbatts opened this issue Mar 14, 2019 · 13 comments
Closed

panic on podman run --rootfs #2654

vbatts opened this issue Mar 14, 2019 · 13 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@vbatts
Copy link
Collaborator

vbatts commented Mar 14, 2019

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

/kind bug

Description

migrating old services from nspawn machines to podman containers.
Trying to use the --rootfs flag.

Steps to reproduce the issue:

  1. podman run -it --rm --rootfs /var/lib/machines/mymachine

Describe the results you received:

[root@knob] /var/lib/machines/bananaboat.usersys# podman run -it --rm --privileged --rootfs $(pwd) 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x113876a]

goroutine 1 [running]:
github.com/containers/libpod/libpod.(*Container).setupStorage(0xc000543bc0, 0x1854fa0, 0xc0000be048, 0x0, 0x0)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/libpod/container_internal.go:340 +0x6fa
github.com/containers/libpod/libpod.(*Runtime).newContainer(0xc000224540, 0x1854fa0, 0xc0000be048, 0xc00058a500, 0xc00058aa80, 0x10, 0x10, 0x0, 0x0, 0x0)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/libpod/runtime_ctr.go:161 +0x70f
github.com/containers/libpod/libpod.(*Runtime).NewContainer(0xc000224540, 0x1854fa0, 0xc0000be048, 0xc00058a500, 0xc00058aa80, 0x10, 0x10, 0x0, 0x0, 0x0)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/libpod/runtime_ctr.go:46 +0xe4
main.createContainerFromCreateConfig(0xc000224540, 0xc0000f6580, 0x1854fa0, 0xc0000be048, 0x0, 0x0, 0x0, 0xc0000f6580)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/cmd/podman/create.go:896 +0x14b
main.createContainer(0x27ca820, 0xc000224540, 0x0, 0x0, 0x0, 0x0)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/cmd/podman/create.go:172 +0x222
main.runCmd(0x27ca820, 0x0, 0x0)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/cmd/podman/run.go:68 +0x123
main.glob..func48(0x262b040, 0xc00047f9a0, 0x1, 0x5, 0x0, 0x0)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/cmd/podman/run.go:32 +0x7f
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).execute(0x262b040, 0xc0000c6020, 0x5, 0x5, 0x262b040, 0xc0000c6020)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:762 +0x473
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x262bc20, 0x6, 0x27f0b80, 0xc0001a6f00)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:852 +0x2fd
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).Execute(0x262bc20, 0xc000146370, 0xc0000ac058)
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:800 +0x2b
main.main()
        /builddir/build/BUILD/libpod-0ad9b6bf2aea4ba37e8c9738feabec61343ba175/_build/src/github.com/containers/libpod/cmd/podman/main.go:225 +0x3c

Describe the results you expected:

Really unsure

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Version:            1.1.2
RemoteAPI Version:  1
Go Version:         go1.11.5
Git Commit:         a95a49d3038462d033f84ac314ec8a3064a99cff
Built:              Tue Mar  5 13:10:31 2019
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: a95a49d3038462d033f84ac314ec8a3064a99cff
  go version: go1.11.5
  podman version: 1.1.2
host:
  BuildahVersion: 1.7.1
  Conmon:
    package: podman-1.1.2-1.git0ad9b6b.fc29.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: a95a49d3038462d033f84ac314ec8a3064a99cff'
  Distribution:
    distribution: fedora
    version: "29"
  MemFree: 3888041984
  MemTotal: 16645263360
  OCIRuntime:
    package: runc-1.0.0-68.dev.git6635b4f.fc29.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc6+dev
      commit: ef9132178ccc3d2775d4fb51f1e431f30cac1398-dirty
      spec: 1.0.1-dev
  SwapFree: 8388079616
  SwapTotal: 8392798208
  arch: amd64
  cpus: 12
  hostname: knob.usersys.redhat.com
  kernel: 4.20.14-200.fc29.x86_64
  os: linux
  rootless: false
  uptime: 25h 59m 31.69s (Approximately 1.04 days)
insecure registries:
  registries:
  - localhost:5000
  - docker.usersys.redhat.com
registries:
  registries:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 7
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mountopt=nodev
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 24
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

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

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 14, 2019
@mheon
Copy link
Member

mheon commented Mar 14, 2019

Oh dear. I honestly forgot we even implemented that flag.
@rhatdan @giuseppe Do we want to look into just deprecating --rootfs or is it worth supporting?

@giuseppe
Copy link
Member

I find it useful.

I was playing with containerd and they have exactly the same feature --rootfs for unmanaged images

giuseppe added a commit to giuseppe/libpod that referenced this issue Mar 14, 2019
check that containerInfo.Config is not nil before trying to access
it.

Closes: containers#2654

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Member

PR here: #2656

giuseppe added a commit to giuseppe/libpod that referenced this issue Mar 15, 2019
check that containerInfo.Config is not nil before trying to access
it.

Closes: containers#2654

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/libpod that referenced this issue Mar 15, 2019
check that containerInfo.Config is not nil before trying to access
it.

Closes: containers#2654

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@vbatts
Copy link
Collaborator Author

vbatts commented Apr 2, 2019

Cool. #2656 fixes the nil pointer.
Perhaps --rootfs= could use more docs. I think it is a very useful, probably not widely known feature.

@rhatdan
Copy link
Member

rhatdan commented Apr 2, 2019

Yes I think it could be a cool blog on this. @giuseppe Would you like to write one?

@giuseppe
Copy link
Member

giuseppe commented Apr 2, 2019

yes it is already on my TODO list, now just need to prioritize it :-)

muayyad-alsadi pushed a commit to muayyad-alsadi/libpod that referenced this issue Apr 21, 2019
check that containerInfo.Config is not nil before trying to access
it.

Closes: containers#2654

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@siscia
Copy link

siscia commented Feb 7, 2020

Cheers guys!

Is this flag still supported?

smosciat@simo:~/go/src/github.com/containers/libpod$ ./bin/podman version
ERRO[0000] User-selected graph driver "vfs" overwritten by graph driver "overlay" from database - delete libpod local files to resolve 
Version:            1.7.1-dev
RemoteAPI Version:  1
Go Version:         go1.13.7
Git Commit:         9be64300d46341ab345f8c760b7a79cced7db3f9-dirty
Built:              Thu Jan 30 16:55:28 2020
OS/Arch:            linux/amd64
smosciat@simo:~/go/src/github.com/containers/libpod$ ./bin/podman --rootfs=/home/smosciat/tmp/redis6_rootfs/
Error: unknown flag: --rootfs

We are having some internal discussion and knowing the plan for this specific features would help us.

@vrothberg
Copy link
Member

@siscia, it's podman run --rootfs.

@siscia
Copy link

siscia commented Feb 7, 2020

Awww many thanks!

Actually how do I use it?

$ ./bin/podman run --rootfs /home/smosciat/tmp/redis6_rootfs
Error: args must not be empty: OCI runtime error

Where /home/smosciat/tmp/redis6_rootfs is a directory that contains an exploded filesystem generated using Singularity.

$ ll /home/smosciat/tmp/redis6_rootfs
total 92
drwxr-xr-x 23 smosciat smosciat 4096 Feb  7 10:10 ./
drwxr-xr-x 10 smosciat smosciat 4096 Feb  7 10:10 ../
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 bin/
drwxr-xr-x  2 smosciat smosciat 4096 Nov 10 13:17 boot/
drwxr-xr-x  2 smosciat smosciat 4096 Feb  1 20:18 data/
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 dev/
lrwxrwxrwx  1 smosciat smosciat   36 Feb  7 10:10 environment -> .singularity.d/env/90-environment.sh*
drwxr-xr-x 28 smosciat smosciat 4096 Feb  7 10:10 etc/
lrwxrwxrwx  1 smosciat smosciat   27 Feb  7 10:10 .exec -> .singularity.d/actions/exec*
drwxr-xr-x  2 smosciat smosciat 4096 Nov 10 13:17 home/
drwxr-xr-x  8 smosciat smosciat 4096 Feb  1 20:18 lib/
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 lib64/
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 media/
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 mnt/
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 opt/
drwxr-xr-x  2 smosciat smosciat 4096 Nov 10 13:17 proc/
drwx------  2 smosciat smosciat 4096 Feb  1 20:15 root/
drwxr-xr-x  3 smosciat smosciat 4096 Jan 30 01:00 run/
lrwxrwxrwx  1 smosciat smosciat   26 Feb  7 10:10 .run -> .singularity.d/actions/run*
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 sbin/
lrwxrwxrwx  1 smosciat smosciat   28 Feb  7 10:10 .shell -> .singularity.d/actions/shell*
lrwxrwxrwx  1 smosciat smosciat   24 Feb  7 10:10 singularity -> .singularity.d/runscript*
drwxr-xr-x  5 smosciat smosciat 4096 Feb  7 10:10 .singularity.d/
drwxr-xr-x  2 smosciat smosciat 4096 Jan 30 01:00 srv/
drwxr-xr-x  2 smosciat smosciat 4096 Nov 10 13:17 sys/
lrwxrwxrwx  1 smosciat smosciat   27 Feb  7 10:10 .test -> .singularity.d/actions/test*
drwxrwxrwt  2 smosciat smosciat 4096 Feb  1 20:18 tmp/
drwxr-xr-x 10 smosciat smosciat 4096 Jan 30 01:00 usr/
drwxr-xr-x 11 smosciat smosciat 4096 Jan 30 01:00 var/

@vrothberg
Copy link
Member

Error: args must not be empty: OCI runtime error

I assume that runc/crun are complaining because they do not know what do execute, so we need to specify a command:
$ ./bin/podman run --rootfs /home/smosciat/tmp/redis6_rootfs /usr/bin/ls for instance

@siscia
Copy link

siscia commented Feb 7, 2020

Wonderful! We could kinda improve the error message!

Anyway this is very interesting for us!

@vrothberg
Copy link
Member

Wonderful! We could kinda improve the error message!

Glad that it's working for you!

@badrelmers
Copy link

please do not remove --rootfs, It is because of it I changed from docker and nspawn² to podman.

here is a quick guide if needed for new comers:
create an OS

debootstrap --arch=amd64 --include=dbus,apt-transport-https,wget,curl,locales,tzdata,man-db,manpages,dialog,procps,sudo,nano,ifupdown,iproute2,apt-utils,less --components=main,contrib,non-free buster /busterr http://deb.debian.org/debian

change/create the root password:

podman run --rm -it  --rootfs /busterr bash -c "echo 'root:bbbbbbnn' | chpasswd"

run a full OS with systemd (like a vm):

podman run --rm -it --systemd=always --rootfs /busterr /sbin/init

² nspawn was slow compared to podman , podman is as quick as docker (using privileged containers). I could not make nspawn do some funcions in python as quick as podman/docker

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

8 participants