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

Failed create release image in Ubuntu 22.04 #24

Open
zhaohany opened this issue Jul 26, 2023 · 5 comments · May be fixed by #27
Open

Failed create release image in Ubuntu 22.04 #24

zhaohany opened this issue Jul 26, 2023 · 5 comments · May be fixed by #27

Comments

@zhaohany
Copy link

Brief description
Below issue from command line while running make release command:

[ 9/11] RUN cp -a --parents /etc/mtab /usr/bin/qemu-system-x86_64 /usr/bin/rsync /usr/lib64/ld-linux-x86-64.so.2 /usr/lib/ipxe/qemu /usr/lib/modules /usr/lib/x86_64-linux-gnu/ceph /usr/lib/x86_64-linux-gnu/qemu /usr/sbin/e2fsck /usr/sbin/fsck.ext2 /usr/sbin/fsck.ext4 /usr/sbin/mke2fs /usr/sbin/mkfs.ext2 /usr/sbin/mkfs.ext4 /usr/share/qemu /usr/share/seabios /var/lib/runq/qemu/:
0.440 cp: cannot stat '/etc/mtab': No such file or directory


When I check, the file exit in file system
ls -l /etc/mtab
lrwxrwxrwx 1 root root 19 May 17 20:36 /etc/mtab -> ../proc/self/mounts

Steps to reproduce the issue
After clone the repo, run: make release

Expected behaviour
runq release image created

Actual behaviour
ERROR: failed to solve: process "/bin/sh -c cp -a --parents /etc/mtab /usr/bin/qemu-system-x86_64 /usr/bin/rsync /usr/lib64/ld-linux-x86-64.so.2 /usr/lib/ipxe/qemu /usr/lib/modules /usr/lib/x86_64-linux-gnu/ceph /usr/lib/x86_64-linux-gnu/qemu /usr/sbin/e2fsck /usr/sbin/fsck.ext2 /usr/sbin/fsck.ext4 /usr/sbin/mke2fs /usr/sbin/mkfs.ext2 /usr/sbin/mkfs.ext4 /usr/share/qemu /usr/share/seabios $QEMU_ROOT/" did not complete successfully: exit code: 1
make[1]: *** [Makefile:6: image] Error 1
make[1]: Leaving directory '/home/yzh/runq/qemu'
make: *** [Makefile:27: image] Error 2

Content of section runtimes of /etc/docker/daemon.json

Content of /var/lib/runq/qemu/proxy --version

Content of docker --version
Client: Docker Engine - Community
Version: 24.0.5

Additional information
Operating System: Ubuntu 22.04.2 LTS
OSType: linux
Architecture: x86_64

@pmorjan
Copy link
Member

pmorjan commented Jul 26, 2023

It looks like you are using the Docker community edition.
I can't recreate the issue with the official Docker packages from Ubuntu:

# docker --version
Docker version 20.10.21, build 20.10.21-0ubuntu1~22.04.3

But the community edition fails in this simple example while the Ubuntu version works as expected:

# cat Dockerfile
FROM ubuntu:20.04
RUN cp -a --parents /etc/mtab /tmp/

# docker build -t foo .
...
> [2/2] RUN cp -a /etc/mtab /tmp/:
 15 0.155 cp: cannot stat '/etc/mtab': No such file or directory

Can you please install the official Ubuntu packages and try again ?

apt-get remove  docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
apt-get install docker.io  

@zhaohany
Copy link
Author

Thank you @pmorjan for the quick response, the issue resolved after reinstall docker following your instruction.

@sammcj
Copy link

sammcj commented Jan 30, 2024

Came to log this same bug on Fedora 39.

Is there a reason that the standard docker-ce won't work?

docker-compose-1.29.2-10.fc39.noarch
nvidia-docker2-2.14.0-1.noarch
docker-buildx-plugin-0.12.1-1.fc39.x86_64
docker-ce-cli-25.0.1-1.fc39.x86_64
docker-ce-rootless-extras-25.0.1-1.fc39.x86_64
docker-ce-25.0.1-1.fc39.x86_64

@sammcj
Copy link

sammcj commented Jan 30, 2024

Found a fix that works!

  1. Update initrd/mkinitrd.sh and add the missing -a to the cp commands.
──────────────────────────────────────────┐
initrd/mkinitrd.sh:14: done < kernel.conf │
──────────────────────────────────────────┘
│ 14 │cp kernel.conf $TMP_DIR/                                              │ 14 │cp kernel.conf $TMP_DIR/
│ 15 │popd >/dev/null                                                       │ 15 │popd >/dev/null
│ 16 │                                                                      │ 16 │
│ 17 │cp $DIR/../cmd/init/init $TMP_DIR/                                    │ 17 │cp -a $DIR/../cmd/init/init $TMP_DIR/
│ 18 │cp $DIR/../cmd/vsockd/vsockd $TMP_DIR/sbin/                           │ 18 │cp -a $DIR/../cmd/vsockd/vsockd $TMP_DIR/sbin/
│ 19 │cp $DIR/../cmd/nsenter/nsenter $TMP_DIR/sbin/                         │ 19 │cp -a $DIR/../cmd/nsenter/nsenter $TMP_DIR/sbin/
│ 20 │cp /usr/bin/docker-init $TMP_DIR/sbin/                                │ 20 │cp -a /usr/bin/docker-init $TMP_DIR/sbin/
│ 21 │                                                                      │ 21 │
│ 22 │pushd $TMP_DIR >/dev/null                                             │ 22 │pushd $TMP_DIR >/dev/null
│ 23 │find . | cpio -o -H newc | gzip > $DIR/initrd                         │ 23 │find . | cpio -o -H newc | gzip > $DIR/initrd
  1. Edit the runq Dockerfile, add a symlink from /proc/mounts to /etc/mtab and replace /etc/mtab from the cp, with the newer style /proc/mounts.
────────────────────────────────────────────────────────────┐
qemu/x86_64/Dockerfile:11: ENV PATH /usr/local/go/bin:$PATH │
────────────────────────────────────────────────────────────┘
│ 11 │                                                                      │ 11 │
│ 12 │WORKDIR /runq                                                         │ 12 │WORKDIR /runq
│ 13 │                                                                      │ 13 │
│    │                                                                      │ 14 │
│    │                                                                      │ 15 │RUN ln -sf /proc/mounts:/etc/mtab

────────────────────────────────────────────────────────────────┐
qemu/x86_64/Dockerfile:70: RUN cp -d --preserve=all --parents \ │
────────────────────────────────────────────────────────────────┘
│ 67 │  /usr/lib/x86_64-linux-gnu/* \                                       │ 70 │  /usr/lib/x86_64-linux-gnu/* \
│ 68 │  $QEMU_ROOT/ 2>&1 | grep -v 'omitting directory';:                   │ 71 │  $QEMU_ROOT/ 2>&1 | grep -v 'omitting directory';:
│ 69 │                                                                      │ 72 │
│    │                                                                      │ 73 │RUN cp -a --parents \
│    │                                                                      │ 74 │    /proc/mounts \
│    │                                                                      │ 75 │    $QEMU_ROOT
│    │                                                                      │ 76 │
│ 70 │ RUN cp -a --parents \                                                │ 77 │ RUN cp -a --parents \
│ 71 │     /etc/mtab \                                                      │ 78 │#     /etc/mtab \
│ 72 │     /usr/bin/qemu-system-x86_64 \                                    │ 79 │     /usr/bin/qemu-system-x86_64 \
│ 73 │     /usr/bin/rsync \                                                 │ 80 │     /usr/bin/rsync \
│ 74 │     /usr/lib64/ld-linux-x86-64.so.2 \                                │ 81 │     /usr/lib64/ld-linux-x86-64.so.2 \

@pmorjan
Copy link
Member

pmorjan commented May 20, 2024

please have a look at the new branch ubuntu2204.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants