Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-126421

file copy from other image can not be exec when build with multi-stage in s390x and ppc64le

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-10.1
    • buildah
    • None
    • None
    • Moderate
    • rhel-container-tools
    • 3
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • ppc64le, s390x
    • None

      What were you trying to do that didn't work?

      Copy binary during the build process and use it later. The build will report “ No such file or directory" and failed in s390x and ppc64le. The same test passed in x86_64 and aarch64.

      What is the impact of this issue to you?

      Build failed.

      Please provide the package NVR for which the bug is seen:

      buildah-1.41.4-2.el10_1.s390x

      How reproducible is this bug?:

      100%

      Steps to reproduce

      1. Run system test “bud-multistage-copy-final-slash”

      Expected results

      File can be access and build can finish as expected

      Actual results

       # $ /usr/bin/buildah bud --signature-policy /root/buildah/tests/policy.json -t foo /root/buildah/tests/bud/dest-final-slash
      # [1/2] STEP 1/1: FROM busybox AS base
      # --> 3b6cf9506584
      # [2/2] STEP 1/4: FROM scratch
      # [2/2] STEP 2/4: COPY --from=base /bin/ls /test/
      # [2/2] STEP 3/4: COPY --from=base /bin/sh /bin/
      # [2/2] STEP 4/4: RUN /test/ls -lR /test/ls
      # exec container process (missing dynamic library?) `/bin/sh`: No such file or directory
      # Error: building at STEP "RUN /test/ls -lR /test/ls": while running runtime: exit status 1
      

      Additional information

      Do more test with it. We can see the COPY step works as expected just we can not use the files in the image as expected. Here is the steps:

      1. build without RUN so we can get an image
        FROM quay.io/libpod/busybox AS base
        FROM scratch
        COPY --from=base /bin/ls /test/
        COPY --from=base /bin/sh /bin/
        
      2. Start a container and mount the fs in the host
      [root@s390x-kvm-006 ~]# buildah bud -t foo .
      [1/2] STEP 1/1: FROM quay.io/libpod/busybox AS base
      Trying to pull quay.io/libpod/busybox:latest...
      Getting image source signatures
      Copying blob 393d6a917252 done   | 
      Copying config 3b6cf95065 done   | 
      Writing manifest to image destination
      --> 3b6cf9506584
      [2/2] STEP 1/3: FROM scratch
      [2/2] STEP 2/3: COPY --from=base /bin/ls /test/
      [2/2] STEP 3/3: COPY --from=base /bin/sh /bin/
      [2/2] COMMIT foo
      Getting image source signatures
      Copying blob 75dc11aa63aa done   | 
      Copying config 90fe1b290e done   | 
      Writing manifest to image destination
      --> 90fe1b290e9f
      Successfully tagged localhost/foo:latest
      90fe1b290e9fa8974c2e1caae1426a6608abc1bb4ce40ad3cf6b157d715be366
      [root@s390x-kvm-006 ~]# buildah images
      REPOSITORY               TAG      IMAGE ID       CREATED          SIZE
      localhost/foo            latest   90fe1b290e9f   59 seconds ago   2.44 MB
      quay.io/libpod/busybox   latest   3b6cf9506584   5 years ago      4.65 MB
      [root@s390x-kvm-006 ~]# buildah from foo
      foo-working-container
      
      1. Check that the files exist in the fs
      # buildah mount foo-working-container
      /var/lib/containers/storage/overlay/4aaa4c2a4c22b745e944375e539c9b71558168a6623d5408bcfc44f9f545186b/merged
      [root@s390x-kvm-006 out]# ls /var/lib/containers/storage/overlay/4aaa4c2a4c22b745e944375e539c9b71558168a6623d5408bcfc44f9f545186b/merged
      bin  dev  proc  sys  test
      [root@s390x-kvm-006 out]# ls /var/lib/containers/storage/overlay/4aaa4c2a4c22b745e944375e539c9b71558168a6623d5408bcfc44f9f545186b/merged/bin/
      sh
      [root@s390x-kvm-006 out]# ls /var/lib/containers/storage/overlay/4aaa4c2a4c22b745e944375e539c9b71558168a6623d5408bcfc44f9f545186b/merged/test/
      ls
      
      1. But try to run command with the container, it report /test/ls not found
      [root@s390x-kvm-006 ~]# buildah run foo-working-container /test/ls /test
      2025-11-05T07:53:38.705852Z: exec container process (missing dynamic library?) `/test/ls`: No such file or directory
      Error: while running runtime: exit status 1

              arajan@redhat.com Aditya Rajan
              ypu@redhat.com Yiqiao Pu
              Container Runtime Eng Bot Container Runtime Eng Bot
              Container Runtime Bugs Bot Container Runtime Bugs Bot
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: