Skip to content

podman run --rootfs link/to//read/only/dir does not work #5895

@siscia

Description

@siscia

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

/kind feature

Description

It seems not possible to run a container using the --rootfs option when the exploded filesystem is in a read-only directory.

I found a couple of issues trying to run a container directly from an exploded (unpacked) filesystem directory.

I believe it is interesting for us to have them sorted, but I would like your feedback first.

The first issues is:

$ ll /cvmfs/unpacked.cern.ch/registry.hub.docker.com/library/centos\:centos7
lrwxrwxrwx 1 cvmfs cvmfs 79 Feb 17 11:02 /cvmfs/unpacked.cern.ch/registry.hub.docker.com/library/centos:centos7 -> ../../.flat/5e/5e35e350aded98340bc8fcb0ba392d809c807bc3eb5c618d4a0674d98d88bccd/
$ podman run --rootfs /cvmfs/unpacked.cern.ch/registry.hub.docker.com/library/centos\:centos7 /bin/bash
Error: /cvmfs/unpacked.cern.ch/registry.hub.docker.com/library/centos:centos7 is not an absolute path or is a symlink: OCI runtime error

Try to run an unpacked container from a symlink generate an error. The check is implemented in runc I am not sure the reasoning why this check was implemented. But it does not seems something too difficult to go around.

The error is generate here: https://github.com/opencontainers/runc/blob/4769cdf607b0d1cbd73e5407d9655da7511fe193/libcontainer/configs/validate/validator.go#L75

It would be interesting to understand why this happens and why the check was put in place, however it seems something that we can get around it in podman but passing the real path to runc instead of what we read from the input.

The second error seems more complex:

$ podman run --rootfs /cvmfs/unpacked.cern.ch/.flat/5e/5e35e350aded98340bc8fcb0ba392d809c807bc3eb5c618d4a0674d98d88bccd /bin/bash
Error: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/run/user/1001/containers/vfs-containers/a6e0915f16bcaa3d674e0897e12382f3ee0cf274afbd7afebaa77db2eb7cc046/userdata/hostname\\\" to rootfs \\\"/cvmfs/unpacked.cern.ch/.flat/5e/5e35e350aded98340bc8fcb0ba392d809c807bc3eb5c618d4a0674d98d88bccd\\\" at \\\"/cvmfs/unpacked.cern.ch/.flat/5e/5e35e350aded98340bc8fcb0ba392d809c807bc3eb5c618d4a0674d98d88bccd/etc/hostname\\\" caused \\\"open /cvmfs/unpacked.cern.ch/.flat/5e/5e35e350aded98340bc8fcb0ba392d809c807bc3eb5c618d4a0674d98d88bccd/etc/hostname: read-only file system\\\"\"": OCI runtime error

This issue seems a little more complex and I didn't manage yet to figure out the complete backtrace, but it seems that comes from runc as well. It seems like that the container cannot run if the roofs is in a read-only filesystem.

Is there a reason for this? Can we detect if we are try to run from a read-only filesystem and if we are, mount the filesystem like overlay so to make it writable?

Maybe this is an issue to open agains runc and not podman but after all I am interested that this use case works in podman.

Output of podman version:

Version:            1.9.0
RemoteAPI Version:  1
Go Version:         go1.10.1
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  gitCommit: ""
  goVersion: go1.10.1
  podmanVersion: 1.9.0
host:
  arch: amd64
  buildahVersion: 1.14.8
  cgroupVersion: v1
  conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.15, commit: '
  cpus: 4
  distribution:
    distribution: ubuntu
    version: "18.04"
  eventLogger: journald
  hostname: student-ThinkPad
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1001
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
  kernel: 5.3.0-46-generic
  memFree: 525975552
  memTotal: 8084377600
  ociRuntime:
    name: runc
    package: 'containerd.io: /usr/bin/runc'
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc10
      commit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
      spec: 1.0.1-dev
  os: linux
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 0.4.3
      commit: unknown
  swapFree: 1750331392
  swapTotal: 2147479552
  uptime: 7h 50m 32.14s (Approximately 0.29 days)
registries:
  search:
  - docker.io
  - quay.io
store:
  configFile: /home/smosciat/.config/containers/storage.conf
  containerStore:
    number: 42
    paused: 0
    running: 0
    stopped: 42
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/smosciat/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 1
  runRoot: /run/user/1001/containers
  volumePath: /home/smosciat/.local/share/containers/storage/volumes

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

podman/unknown,now 1.9.0~2 amd64 [installed]

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.stale-issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions