sudo execution fails in do_pull_image() of .bb file

104 Views Asked by At

As I am using iMX series board, for that I am using Yocto 4.0 as source. I wanted to port container-image from https://github.com/savoirfairelinux/meta-embedded-containers to my build setup containing 4.0. While building bitbake embedded-container-image I am facing below issue,

WARNING: mount-noauto-1.0-r0 do_package_qa: QA Issue: mount-noauto: recipe doesn't inherit features_check [unhandled-features-check]
ERROR: container-image-1.0-r0 do_pull_image: Error launching docker daemon
ERROR: container-image-1.0-r0 do_pull_image: ExecutionError('/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/temp/run.do_pull_image.18009', 1, None, None)
ERROR: Logfile of failure stored in: /yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/temp/log.do_pull_image.18009
ERROR: Task (/yocto-bsp/sources/meta-embedded-containers/recipes-support/container-image/container-image.bb:do_pull_image) failed with exit code '1'
ERROR: kernel-module-nxp89xx-1.0-r0 do_compile: oe_runmake failed
ERROR: kernel-module-nxp89xx-1.0-r0 do_compile: ExecutionError('/yocto-bsp/build/tmp/work/imx6ull-poky-linux-gnueabi/kernel-module-nxp89xx/1.0-r0/temp/run.do_compile.18002', 1, None, None)
ERROR: Logfile of failure stored in: /yocto-bsp/build/tmp/work/imx6ull-poky-linux-gnueabi/kernel-module-nxp89xx/1.0-r0/temp/log.do_compile.18002

In log file, /yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/temp/log.do_pull_image.18009

DEBUG: Executing shell function do_pull_image
/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/temp/run.do_pull_image.18009: 147: /yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/temp/run.do_pull_image.18009: pidof: not found
sudo: /yocto-bsp/build/tmp/hosttools/sudo must be owned by uid 0 and have the setuid bit set
ERROR: Error launching docker daemon
WARNING: exit code 1 from a shell command.

This sudo error due to sudo command in do_pull_image(), i.e.,

# line: 29, file: /yocto-bsp/sources/meta-embedded-containers/recipes-support/container-image/container-image.bb
do_pull_image() {

[ -f "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/images.manifest" ] || bbfatal "images.manifest does not exist"

[ -n "$(pidof dockerd)" ] && sudo kill "$(pidof dockerd)" && sleep 5

[ -d "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/docker-store" ] && sudo rm -rf "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/docker-store"/*

# Start the dockerd daemon with the driver vfs in order to store the
# container layers into vfs layers. The default storage is overlay
# but it will not work on the target system as /var/lib/docker is
# mounted as an overlay and overlay storage driver is not compatible
# with overlayfs.
sudo /usr/bin/dockerd --storage-driver vfs --data-root "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/docker-store" &

# Wait a little before pulling to let the daemon be ready.
sleep 5

if ! sudo docker info; then
bbfatal "Error launching docker daemon"
fi

local name version tag
while read -r name version tag _; do
if ! sudo docker pull "${name}:${version}"; then
bbfatal "Error pulling ${name}"
fi
done < "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/images.manifest"

sudo chown -R "aysha" "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/docker-store"

# Clean temporary folders in the docker store.
rm -rf "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/docker-store/runtimes"
rm -rf "/yocto-bsp/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/container-image/1.0-r0/docker-store/tmp"

# Kill dockerd daemon after use.
sudo kill "$(pidof dockerd)"
}

For these I had tried

  1. Changing the ownership and permission of /yocto-bsp/build/tmp/hosttools/sudo. And this is symbolic link to /usr/bin/sudo.
  2. Tried using fakeroot
  3. Manually changed /yocto-bsp/build/tmp/hosttools/sudo to /usr/bin/sudo in bb file.
  4. Tried clean and rebuild of receipe. By doing all these still the issue exists.

Please let me know what changes to be performed to execute this sudo as a part of yocto build. Waiting for your reply.

0

There are 0 best solutions below