Uploaded image for project: 'Container Tools'
  1. Container Tools
  2. RUN-3040

[containers/podman] D-in-D with VSCode remote development is broken on 5.3.2

XMLWordPrintable

    • 3
    • False
    • Hide

      None

      Show
      None
    • False
    • rhel-container-tools

      [2818009280] Upstream Reporter: Petr Ankudinov
      Upstream issue status: Closed
      Upstream description:

      Issue Description

      We are using D-in-D with Podman Desktop rootful machine. It worked great with podman 5.3.1. However it's breaking on 5.3.2. sudo modprobe ip_tables on podman machine fixes the problem. I'd expect it's somehow related to the kernel change, however can't find any clues in 5.3.2 release notes.

      The problem is easy to reproduce. 1st, start any devcontainer. Normally VSCode will be used for that, but it's easier to spot errors on CLI.

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      podman run --rm -it --privileged 
        -v dind-var-lib-docker:/var/lib/docker 
        -w $(pwd) 
        -v $(pwd):$(pwd) 
        ghcr.io/aristanetworks/avd/universal:python3.11-avd-v4.10.2 zsh
      

      Next, init docker inside the container using Microsoft script:

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      /usr/local/share/docker-init.sh
      

      This will fail with error and docker info will be complaining that docker is not running. As a workaround:

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      podman machine ssh
      sudo modprobe ip_tables
      

      This will fix the problem, although some iptables errors will be still reported in logs.

      Here is the full script for convenience:

      #!/bin/sh
      #-------------------------------------------------------------------------------------------------------------
      # Copyright (c) Microsoft Corporation. All rights reserved.
      # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
      #-------------------------------------------------------------------------------------------------------------
      
      set -e
      
      AZURE_DNS_AUTO_DETECTION=true
      DOCKER_DEFAULT_ADDRESS_POOL=
      dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAULT_ADDRESS_POOL=${DOCKER_DEFAULT_ADDRESS_POOL} $(cat << 'INNEREOF'
          # explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
          find /run /var/run -iname 'docker*.pid' -delete || :
          find /run /var/run -iname 'container*.pid' -delete || :
      
          # -- Start: dind wrapper script --
          # Maintained: https://github.com/moby/moby/blob/master/hack/dind
      
          export container=docker
      
          if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
              mount -t securityfs none /sys/kernel/security || {
                  echo >&2 'Could not mount /sys/kernel/security.'
                  echo >&2 'AppArmor detection and --privileged mode might break.'
              }
          fi
      
          # Mount /tmp (conditionally)
          if ! mountpoint -q /tmp; then
              mount -t tmpfs none /tmp
          fi
      
          set_cgroup_nesting()
          {
              # cgroup v2: enable nesting
              if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
                  # move the processes from the root group to the /init group,
                  # otherwise writing subtree_control fails with EBUSY.
                  # An error during moving non-existent process (i.e., "cat") is ignored.
                  mkdir -p /sys/fs/cgroup/init
                  xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || :
                  # enable controllers
                  sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers 
                      > /sys/fs/cgroup/cgroup.subtree_control
              fi
          }
      
          # Set cgroup nesting, retrying if necessary
          retry_cgroup_nesting=0
      
          until [ "${retry_cgroup_nesting}" -eq "5" ];
          do
              set +e
                  set_cgroup_nesting
      
                  if [ $? -ne 0 ]; then
                      echo "(*) cgroup v2: Failed to enable nesting, retrying..."
                  else
                      break
                  fi
      
                  retry_cgroup_nesting=`expr $retry_cgroup_nesting + 1`
              set -e
          done
      
          # -- End: dind wrapper script --
      
          # Handle DNS
          set +e
              cat /etc/resolv.conf | grep -i 'internal.cloudapp.net' > /dev/null 2>&1
              if [ $? -eq 0 ] && [ "${AZURE_DNS_AUTO_DETECTION}" = "true" ]
              then
                  echo "Setting dockerd Azure DNS."
                  CUSTOMDNS="--dns 168.63.129.16"
              else
                  echo "Not setting dockerd DNS manually."
                  CUSTOMDNS=""
              fi
          set -e
      
          if [ -z "$DOCKER_DEFAULT_ADDRESS_POOL" ]
          then
              DEFAULT_ADDRESS_POOL=""
          else
              DEFAULT_ADDRESS_POOL="--default-address-pool $DOCKER_DEFAULT_ADDRESS_POOL"
          fi
      
          # Start docker/moby engine
          ( dockerd $CUSTOMDNS $DEFAULT_ADDRESS_POOL > /tmp/dockerd.log 2>&1 ) &
      INNEREOF
      )"
      
      sudo_if() {
          COMMAND="$*"
      
          if [ "$(id -u)" -ne 0 ]; then
              sudo $COMMAND
          else
              $COMMAND
          fi
      }
      
      retry_docker_start_count=0
      docker_ok="false"
      
      until [ "${docker_ok}" = "true"  ] || [ "${retry_docker_start_count}" -eq "1" ];
      do
          # Start using sudo if not invoked as root
          if [ "$(id -u)" -ne 0 ]; then
              sudo /bin/sh -c "${dockerd_start}"
          else
              eval "${dockerd_start}"
          fi
      
          retry_count=0
          until [ "${docker_ok}" = "true"  ] || [ "${retry_count}" -eq "5" ];
          do
              sleep 1s
              set +e
                  docker info > /dev/null 2>&1 && docker_ok="true"
              set -e
      
              retry_count=`expr $retry_count + 1`
          done
      
          if [ "${docker_ok}" != "true" ] && [ "${retry_docker_start_count}" != "4" ]; then
              echo "(*) Failed to start docker, retrying..."
              set +e
                  sudo_if pkill dockerd
                  sudo_if pkill containerd
              set -e
          fi
      
          retry_docker_start_count=`expr $retry_docker_start_count + 1`
      done
      
      # Execute whatever commands were passed in (if any). This allows us
      # to set this script to ENTRYPOINT while still executing the default CMD.
      exec "$@"
      

      Steps to reproduce the issue

      Steps to reproduce the issue

      1. Start d-in-d container.
      2. Init docker using shell script provided with VSCode devcontainer
      3. The script will fail and docker info will fail as well.

      Describe the results you received

      D-in-D is failing on 5.3.2

      Describe the results you expected

      Expect D-in-D to work

      podman info output

      host:   arch: arm64
        buildahVersion: 1.38.1
        cgroupControllers:   - cpuset
        - cpu
        - io
        - memory
        - pids
        - rdma
        - misc
        cgroupManager: systemd
        cgroupVersion: v2
        conmon:     package: conmon-2.1.12-3.fc41.aarch64
          path: /usr/bin/conmon
          version: 'conmon version 2.1.12, commit: '
        cpuUtilization:     idlePercent: 99.67
          systemPercent: 0.17
          userPercent: 0.15
        cpus: 10
        databaseBackend: sqlite
        distribution:     distribution: fedora
          variant: coreos
          version: "41"
        eventLogger: journald
        freeLocks: 2046
        hostname: localhost.localdomain
        idMappings:     gidmap: null
          uidmap: null
        kernel: 6.12.7-200.fc41.aarch64
        linkmode: dynamic
        logDriver: journald
        memFree: 23557054464
        memTotal: 25361227776
        networkBackend: netavark
        networkBackendInfo:     backend: netavark
          dns:       package: aardvark-dns-1.13.1-1.fc41.aarch64
            path: /usr/libexec/podman/aardvark-dns
            version: aardvark-dns 1.13.1
          package: netavark-1.13.1-1.fc41.aarch64
          path: /usr/libexec/podman/netavark
          version: netavark 1.13.1
        ociRuntime:     name: crun
          package: crun-1.19.1-1.fc41.aarch64
          path: /usr/bin/crun
          version: |-
            crun version 1.19.1
            commit: 3e32a70c93f5aa5fea69b50256cca7fd4aa23c80
            rundir: /run/crun
            spec: 1.0.0
            +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
        os: linux
        pasta:     executable: /usr/bin/pasta
          package: passt-0^20241211.g09478d5-1.fc41.aarch64
          version: |
            pasta 0^20241211.g09478d5-1.fc41.aarch64-pasta
            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: unix:///run/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: false
          seccompEnabled: true
          seccompProfilePath: /usr/share/containers/seccomp.json
          selinuxEnabled: true
        serviceIsRemote: true
        slirp4netns:     executable: /usr/bin/slirp4netns
          package: slirp4netns-1.3.1-1.fc41.aarch64
          version: |-
            slirp4netns version 1.3.1
            commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
            libslirp: 4.8.0
            SLIRP_CONFIG_VERSION_MAX: 5
            libseccomp: 2.5.5
        swapFree: 0
        swapTotal: 0
        uptime: 0h 22m 30.00s
        variant: v8
      plugins:   authorization: null
        log:   - k8s-file
        - none
        - passthrough
        - journald
        network:   - bridge
        - macvlan
        - ipvlan
        volume:   - local
      registries:   search:   - docker.io
      store:   configFile: /usr/share/containers/storage.conf
        containerStore:     number: 1
          paused: 0
          running: 1
          stopped: 0
        graphDriverName: overlay
        graphOptions:     overlay.imagestore: /usr/lib/containers/storage
          overlay.mountopt: nodev,metacopy=on
        graphRoot: /var/lib/containers/storage
        graphRootAllocated: 198757789696
        graphRootUsed: 6988705792
        graphStatus:     Backing Filesystem: xfs
          Native Overlay Diff: "false"
          Supports d_type: "true"
          Supports shifting: "true"
          Supports volatile: "true"
          Using metacopy: "true"
        imageCopyTmpDir: /var/tmp
        imageStore:     number: 1
        runRoot: /run/containers/storage
        transientStore: false
        volumePath: /var/lib/containers/storage/volumes
      version:   APIVersion: 5.3.2
        Built: 1737504000
        BuiltTime: Wed Jan 22 01:00:00 2025
        GitCommit: ""
        GoVersion: go1.23.4
        Os: linux
        OsArch: linux/arm64
        Version: 5.3.2
      

      Podman in a container

      No

      Privileged Or Rootless

      Privileged

      Upstream Latest Release

      Yes

      Additional environment details

      Additional environment details

      Additional information

      Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting


      Upstream URL: https://github.com/containers/podman/issues/25153

              pholzing@redhat.com Paul Holzinger
              upstream-sync Upstream Sync
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: