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

rootfs - Error executing command in chroot #1161

Closed
software-testing-professional opened this issue Apr 25, 2022 · 12 comments · Fixed by #1169
Closed

rootfs - Error executing command in chroot #1161

software-testing-professional opened this issue Apr 25, 2022 · 12 comments · Fixed by #1169

Comments

@software-testing-professional
Copy link

software-testing-professional commented Apr 25, 2022

I'm running Tern in an Ubuntu 20.04 container, along with some other CycloneDX / BOM tools.

When I try to run a scan on an existing Docker image, these ERROR messages show up:

tern report -i <concealed>/template-group--template-project:0.0.0 -f cyclonedxjson -o /project/template-project/container.bom.json
2022-04-25 16:04:44,498 - DEBUG - __main__ - Starting...
2022-04-25 16:04:44,498 - DEBUG - prep - Setting up...
2022-04-25 16:04:44,498 - DEBUG - rootfs - Running command: chmod +x /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh
2022-04-25 16:04:44,500 - DEBUG - run - Starting analysis...
2022-04-25 16:04:44,500 - DEBUG - skopeo - Attempting to pull image "<concealed>/template-group--template-project:0.0.0"
2022-04-25 16:04:44,500 - DEBUG - rootfs - Running command: skopeo copy docker://<concealed>/template-group--template-project:0.0.0 dir:/root/.tern/temp
2022-04-25 16:04:54,058 - DEBUG - skopeo - Inspecting remote image "<concealed>/template-group--template-project:0.0.0"
2022-04-25 16:04:54,058 - DEBUG - rootfs - Running command: skopeo inspect docker://<concealed>/template-group--template-project:0.0.0
2022-04-25 16:04:54,719 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/df9b9388f04ad6279a7410b85cedfdcb2208c0a003da7ab5613af71079148139
2022-04-25 16:04:54,769 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/df9b9388f04ad6279a7410b85cedfdcb2208c0a003da7ab5613af71079148139 -C /root/.tern/temp/1/contents
2022-04-25 16:04:54,813 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/1/contents
2022-04-25 16:04:54,923 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/1438c74684d1c6fe381c7aee977cb6341a28fc27cde7b624d79d5ee5772c6f0c
2022-04-25 16:04:55,377 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/1438c74684d1c6fe381c7aee977cb6341a28fc27cde7b624d79d5ee5772c6f0c -C /root/.tern/temp/2/contents
2022-04-25 16:04:55,843 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/2/contents
2022-04-25 16:04:56,283 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/236382c2c5d4b83164f24012c9e774a2b1d7f22ebd5bf5879116c26d4e07ef82
2022-04-25 16:04:56,287 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/236382c2c5d4b83164f24012c9e774a2b1d7f22ebd5bf5879116c26d4e07ef82 -C /root/.tern/temp/3/contents
2022-04-25 16:04:56,290 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/3/contents
2022-04-25 16:04:56,295 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/e94f9e39bb199635591eee498c54e0ab83b84b6359420eece375f7a064bf9100
2022-04-25 16:04:56,305 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/e94f9e39bb199635591eee498c54e0ab83b84b6359420eece375f7a064bf9100 -C /root/.tern/temp/4/contents
2022-04-25 16:04:56,321 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/4/contents
2022-04-25 16:04:56,436 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/9fba39ed69e5cd696f4df6ca931d6ba30d5492c69b37a23793bcfcd24175e16d
2022-04-25 16:04:56,439 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/9fba39ed69e5cd696f4df6ca931d6ba30d5492c69b37a23793bcfcd24175e16d -C /root/.tern/temp/5/contents
2022-04-25 16:04:56,441 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/5/contents
2022-04-25 16:04:56,449 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/1b2acd485385300dbcef72f7eda2a62032046edde366991c2837f1228e25b094
2022-04-25 16:04:56,452 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/1b2acd485385300dbcef72f7eda2a62032046edde366991c2837f1228e25b094 -C /root/.tern/temp/6/contents
2022-04-25 16:04:56,455 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/6/contents
2022-04-25 16:04:56,459 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/3ab08a492d97e947c271b260484a715ffb957b083a515bef492a70a150496bb6
2022-04-25 16:04:56,619 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/3ab08a492d97e947c271b260484a715ffb957b083a515bef492a70a150496bb6 -C /root/.tern/temp/7/contents
2022-04-25 16:04:56,786 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/7/contents
2022-04-25 16:04:56,907 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/34410239bf0b4f94600d0d7a9173588342f946cb34478aa69fc93940ad30f109
2022-04-25 16:04:56,910 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/34410239bf0b4f94600d0d7a9173588342f946cb34478aa69fc93940ad30f109 -C /root/.tern/temp/8/contents
2022-04-25 16:04:56,912 - DEBUG - rootfs - Running command: /tools/ternenv/lib/python3.8/site-packages/tern/tools/fs_hash.sh /root/.tern/temp/8/contents
2022-04-25 16:04:56,915 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:56,917 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/df9b9388f04ad6279a7410b85cedfdcb2208c0a003da7ab5613af71079148139
2022-04-25 16:04:56,953 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/df9b9388f04ad6279a7410b85cedfdcb2208c0a003da7ab5613af71079148139 -C /root/.tern/temp/mergedir
2022-04-25 16:04:56,997 - DEBUG - rootfs - Running command: mknod /root/.tern/temp/mergedir/dev/urandom c 1 9
2022-04-25 16:04:56,999 - DEBUG - rootfs - Running command: cp /etc/resolv.conf /root/.tern/temp/mergedir/etc/resolv.conf
2022-04-25 16:04:57,001 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,001 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,002 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,002 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,002 - WARNING - collect - Error executing snippets: Command 'pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,002 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c apk info 2>/dev/null
2022-04-25 16:04:57,004 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,004 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,004 - WARNING - collect - Error executing snippets: Command 'apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,004 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,005 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,005 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,005 - WARNING - collect - Error executing snippets: Command 'pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,005 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,006 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,006 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,006 - WARNING - collect - Error executing snippets: Command 'pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,007 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,008 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,008 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,008 - WARNING - collect - Error executing snippets: Command 'pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,008 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,008 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,008 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:57,013 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/2/contents/opt /root/.tern/temp/mergedir
2022-04-25 16:04:57,058 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,058 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,060 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,060 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,060 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,060 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null
2022-04-25 16:04:57,061 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,062 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,062 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,062 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,063 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,063 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,063 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,063 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,064 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,064 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,065 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,065 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,066 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,066 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,066 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,066 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,066 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,066 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/2/contents/opt /root/.tern/temp/mergedir
2022-04-25 16:04:57,128 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:57,128 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/3/contents/etc /root/.tern/temp/mergedir
2022-04-25 16:04:57,132 - WARNING - command_lib - No listing method for 'echo'. Additional analysis may be required.

2022-04-25 16:04:57,132 - WARNING - command_lib - No listing method for 'echo'. Additional analysis may be required.

2022-04-25 16:04:57,133 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,133 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,134 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,134 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,134 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,134 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null
2022-04-25 16:04:57,136 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,136 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,136 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,136 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,137 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,137 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,137 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,137 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,138 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,138 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,138 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,138 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,140 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,140 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,140 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,140 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,140 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,140 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/3/contents/etc /root/.tern/temp/mergedir
2022-04-25 16:04:57,142 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:57,146 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/4/contents/usr /root/.tern/temp/4/contents/etc /root/.tern/temp/4/contents/lib /root/.tern/temp/mergedir
2022-04-25 16:04:57,155 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,155 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,157 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,157 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,157 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,157 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null
2022-04-25 16:04:57,160 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,160 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,160 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,160 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,162 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,162 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,162 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,162 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,163 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,163 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,163 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,163 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,165 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,165 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,165 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,165 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,165 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,165 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/4/contents/usr /root/.tern/temp/4/contents/etc /root/.tern/temp/4/contents/lib /root/.tern/temp/mergedir
2022-04-25 16:04:57,177 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:57,177 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/5/contents/etc /root/.tern/temp/5/contents/app /root/.tern/temp/mergedir
2022-04-25 16:04:57,180 - WARNING - command_lib - No listing method for 'adduser'. Additional analysis may be required.

2022-04-25 16:04:57,180 - WARNING - command_lib - No listing method for 'chmod'. Additional analysis may be required.

2022-04-25 16:04:57,180 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,180 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,181 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,181 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,181 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,182 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null
2022-04-25 16:04:57,183 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,183 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,183 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,183 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,184 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,184 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,184 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,184 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,186 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,186 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,186 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,186 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,187 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,187 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,187 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,187 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,187 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,187 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/5/contents/etc /root/.tern/temp/5/contents/app /root/.tern/temp/mergedir
2022-04-25 16:04:57,189 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:57,190 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/6/contents/etc /root/.tern/temp/mergedir
2022-04-25 16:04:57,194 - WARNING - command_lib - No listing method for 'sed'. Additional analysis may be required.

2022-04-25 16:04:57,194 - WARNING - command_lib - No listing method for 'sed'. Additional analysis may be required.

2022-04-25 16:04:57,194 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,194 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,195 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,196 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,196 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,196 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null
2022-04-25 16:04:57,197 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,197 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,197 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,197 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,198 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,198 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,198 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,199 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,200 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,200 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,200 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,200 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,201 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,201 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,201 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,201 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,201 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,201 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/6/contents/etc /root/.tern/temp/mergedir
2022-04-25 16:04:57,203 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:57,203 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/7/contents/app /root/.tern/temp/mergedir
2022-04-25 16:04:57,218 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,219 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,220 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,221 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,221 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,221 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null
2022-04-25 16:04:57,222 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,222 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,222 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,222 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,224 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,225 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,225 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,225 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,226 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,226 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,226 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,226 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,228 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,228 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,228 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,228 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,228 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,228 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/7/contents/app /root/.tern/temp/mergedir
2022-04-25 16:04:57,247 - DEBUG - common - Reading files in filesystem...
2022-04-25 16:04:57,248 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/8/contents/app /root/.tern/temp/mergedir
2022-04-25 16:04:57,250 - WARNING - command_lib - No listing method for 'ln'. Additional analysis may be required.

2022-04-25 16:04:57,251 - DEBUG - core - Collecting metadata for image layer...
2022-04-25 16:04:57,251 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done
2022-04-25 16:04:57,252 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,252 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,252 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do files=`apk -L info $p 2>/dev/null`; for file in $files; do if [ -f $file ]; then echo $file; fi; done; echo LICF; done' returned non-zero exit status 1.
2022-04-25 16:04:57,252 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null
2022-04-25 16:04:57,253 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,254 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,254 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && apk info 2>/dev/null' returned non-zero exit status 1.
2022-04-25 16:04:57,254 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done
2022-04-25 16:04:57,256 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,256 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,256 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk -a info $p 2>/dev/null | tail -2 | head -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,256 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done
2022-04-25 16:04:57,258 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,258 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,258 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do lic=`apk info $p 2>/dev/null | head -1 | awk '{print $1}'`; echo $lic | sed -e "s/^$p-//"; done' returned non-zero exit status 1.
2022-04-25 16:04:57,258 - DEBUG - rootfs - Running command: chroot /root/.tern/temp/mergedir  -c export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done
2022-04-25 16:04:57,259 - ERROR - rootfs - Command failed. chroot: failed to run command ‘’: No such file or directory

2022-04-25 16:04:57,259 - WARNING - rootfs - Error executing command in chroot
2022-04-25 16:04:57,259 - WARNING - collect - Error executing snippets: Command 'export LOG4J_FORMAT_MSG_NO_LOOKUPS="true" && export APP_DIR="/app" && export APP_USER="app" && export JAVA_HOME="/opt/java-minimal" && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java-minimal/bin" && pkgs=`apk info 2>/dev/null` && for p in $pkgs; do apk info $p 2>/dev/null | head -5 | tail -1; done' returned non-zero exit status 1.
2022-04-25 16:04:57,260 - ERROR - core - Script invocation error. Unable to collect some metadata
2022-04-25 16:04:57,260 - WARNING - core - Some metadata may be missing
2022-04-25 16:04:57,260 - DEBUG - rootfs - Running command: cp -r /root/.tern/temp/8/contents/app /root/.tern/temp/mergedir
2022-04-25 16:04:57,270 - DEBUG - generator - Generating CycloneDX JSON document...
2022-04-25 16:04:57,270 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/mergedir
2022-04-25 16:04:57,294 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/workdir
2022-04-25 16:04:57,297 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/1/contents
2022-04-25 16:04:57,303 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/2/contents
2022-04-25 16:04:57,318 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/3/contents
2022-04-25 16:04:57,321 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/4/contents
2022-04-25 16:04:57,327 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/5/contents
2022-04-25 16:04:57,329 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/6/contents
2022-04-25 16:04:57,330 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/7/contents
2022-04-25 16:04:57,335 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/8/contents
2022-04-25 16:04:57,337 - DEBUG - prep - Tearing down...
2022-04-25 16:04:57,347 - DEBUG - __main__ - Finished
Docker image: <concealed>/template-group--template-project:0.0.0:
	Layer 1:
		info: Layer created by commands: /bin/sh -c #(nop) ADD file:5d673d25da3a14ce1f6cf66e4c7fd4f4b85a3759a9d93efb3fd9ff852b5b56e4 in / 
		info: Found 'Alpine Linux v3.15' in /etc/os-release.
		info: Retrieved package metadata using apk default method. 

		error: chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory

	File licenses found in Layer:  None
	Packages found in Layer: None

The installed Python is 3.8.10

Do you have any idea how I can fix this?

Best regards,
Michael

@software-testing-professional software-testing-professional changed the title rootfs - Comm ootfs - Error executing command in chroot Apr 25, 2022
@software-testing-professional software-testing-professional changed the title ootfs - Error executing command in chroot rootfs - Error executing command in chroot Apr 25, 2022
@software-testing-professional
Copy link
Author

I figured out that the problem is caused by apk, which does not work correctly.

The motivation to use Tern as locally installed tool was some authentication issue with out private Docker registry.

The easiest solution for me was to switch to the Docker-based Tern, and provide a Docker config.json (/~.docker/config.json) with the credentials stored.

So my problem is solved. :-)

@Jeeppler
Copy link

Jeeppler commented May 9, 2022

Please reopen this issue.

I have the same issue. I need to have my own Dockerfile with Tern in it.

I tried it with Ubuntu 21.04 and 22.04. It seems to be always the same issue.

The output is:

# tern report -i golang:1.18-alpine
…
This report was generated by the Tern Project
Version: 2.10.0

Docker image: golang:1.18-alpine:
	Layer 1:
		info: Layer created by commands: /bin/sh -c #(nop) ADD file:5d673d25da3a14ce1f6cf66e4c7fd4f4b85a3759a9d93efb3fd9ff852b5b56e4 in / 
		info: Found 'Alpine Linux v3.15' in /etc/os-release.
		info: Retrieved package metadata using apk default method. 

		error: chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory

	File licenses found in Layer:  None
	Packages found in Layer: None
=======================================================================================

	Layer 2:
		info: Layer created by commands: /bin/sh -c apk add --no-cache ca-certificates
		info: Retrieved package metadata using apk default method. 

		error: chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory

	File licenses found in Layer:  None
	Packages found in Layer: None
=======================================================================================

	Layer 3:
		info: Layer created by commands: /bin/sh -c [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
		warning: 
Unrecognized Commands:[ ! -e /etc/nsswitch.conf ]
echo hosts: files dns > /etc/nsswitch.conf

		info: Retrieved package metadata using apk default method. 

		error: chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory

	File licenses found in Layer:  None
	Packages found in Layer: None
=======================================================================================

	Layer 4:
		info: Layer created by commands: /bin/sh -c set -eux; 	apk add --no-cache --virtual .fetch-deps gnupg; 	arch="$(apk --print-arch)"; 	url=; 	case "$arch" in 		'x86_64') 			export GOARCH='amd64' GOOS='linux'; 			;; 		'armhf') 	export GOARCH='arm' GOARM='6' GOOS='linux'; 			;; 		'armv7') 			export GOARCH='arm' GOARM='7' GOOS='linux'; 			;; 		'aarch64') 			export GOARCH='arm64' GOOS='linux'; 			;; 		'x86') 			export GO386='softfloat' GOARCH='386' GOOS='linux'; 			;; 		'ppc64le') 			export GOARCH='ppc64le' GOOS='linux'; 			;; 		's390x') 			export GOARCH='s390x' GOOS='linux'; 			;; 		*) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; 	esac; 	build=; 	if [ -z "$url" ]; then 		build=1; 		url='https://dl.google.com/go/go1.18.1.src.tar.gz'; 		sha256='efd43e0f1402e083b73a03d444b7b6576bb4c539ac46208b63a916b69aca4088'; 	fi; 		wget -O go.tgz.asc "$url.asc"; 	wget -O go.tgz "$url"; 	echo "$sha256 *go.tgz" | sha256sum -c -; 		GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; 	gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC  EC91 7721 F63B D38B 4796'; 	gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '2F52 8D36 D67B 69ED F998  D857 78BD 6547 3CB3 BD13'; 	gpg --batch --verify go.tgz.asc go.tgz; 	gpgconf --kill all; 	rm -rf "$GNUPGHOME" go.tgz.asc; 		tar -C /usr/local -xzf go.tgz; 	rm go.tgz; 		if [ -n "$build" ]; then 		apk add --no-cache --virtual .build-deps 			bash 			gcc 			go 			musl-dev 		; 				( 			cd /usr/local/go/src; 			export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; 		./make.bash; 		); 				apk del --no-network .build-deps; 				rm -rf 			/usr/local/go/pkg/*/cmd 			/usr/local/go/pkg/bootstrap 			/usr/local/go/pkg/obj 			/usr/local/go/pkg/tool/*/api 		/usr/local/go/pkg/tool/*/go_bootstrap 			/usr/local/go/src/cmd/dist/dist 		; 	fi; 		apk del --no-network .fetch-deps; 		go version
		warning: 
Unrecognized Commands:set -eux
--print-arch
wget -O go.tgz.asc $url.asc
wget -O go.tgz $url
echo $sha256 *go.tgz | sha256sum -c -
-d
export GNUPGHOME
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 2F52 8D36 D67B 69ED F998 D857 78BD 6547 3CB3 BD13
gpg --batch --verify go.tgz.asc go.tgz
gpgconf --kill all
rm -rf $GNUPGHOME go.tgz.asc
tar -C /usr/local -xzf go.tgz
rm go.tgz
go version

Non-deterministic branching statement: 
case $arch in x86_64) export GOARCH=amd64 GOOS=linux
armhf) export GOARCH=arm GOARM=6 GOOS=linux
armv7) export GOARCH=arm GOARM=7 GOOS=linux
aarch64) export GOARCH=arm64 GOOS=linux
x86) export GO386=softfloat GOARCH=386 GOOS=linux
ppc64le) export GOARCH=ppc64le GOOS=linux
s390x) export GOARCH=s390x GOOS=linux
*) echo >&2 error: unsupported architecture '$arch' (likely packaging update needed
exit 1
esac

if [ -z $url ]
then build=1
url=https://dl.google.com/go/go1.18.1.src.tar.gz
sha256=efd43e0f1402e083b73a03d444b7b6576bb4c539ac46208b63a916b69aca4088
fi

if [ -n $build ]
then apk add --no-cache --virtual .build-deps bash gcc go musl-dev
cd /usr/local/go/src
export GOROOT_BOOTSTRAP=$(go env GOROOT) GOHOSTOS=$GOOS GOHOSTARCH=$GOARCH
./make.bash
apk del --no-network .build-deps
rm -rf /usr/local/go/pkg/*/cmd /usr/local/go/pkg/bootstrap /usr/local/go/pkg/obj /usr/local/go/pkg/tool/*/api /usr/local/go/pkg/tool/*/go_bootstrap /usr/local/go/src/cmd/dist/dist
fi


		info: Retrieved package metadata using apk default method. 

		error: chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory

	File licenses found in Layer:  None
	Packages found in Layer: None
=======================================================================================

	Layer 5:
		info: Layer created by commands: /bin/sh -c mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
		warning: 
Unrecognized Commands:mkdir -p $GOPATH/src $GOPATH/bin
chmod -R 777 $GOPATH

		info: Retrieved package metadata using apk default method. 

		error: chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory
chroot: failed to run command ‘’: No such file or directory

	File licenses found in Layer:  None
	Packages found in Layer: None
=======================================================================================

###########################################
# Summary of licenses found in Container: #
###########################################
None

2022-05-09 14:57:31,848 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/mergedir
2022-05-09 14:57:32,082 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/workdir
2022-05-09 14:57:32,084 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/1/contents
2022-05-09 14:57:32,092 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/2/contents
2022-05-09 14:57:32,100 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/3/contents
2022-05-09 14:57:32,102 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/4/contents
2022-05-09 14:57:32,292 - DEBUG - rootfs - Running command: rm -rf /root/.tern/temp/5/contents
2022-05-09 14:57:32,294 - DEBUG - prep - Tearing down...
2022-05-09 14:57:32,304 - DEBUG - __main__ - Finished

@rnjudge rnjudge reopened this May 13, 2022
@rnjudge
Copy link
Contributor

rnjudge commented May 13, 2022

@Jeeppler can you provide a little more information about how you're running Tern when you see this error? How are you installing Tern and what version are you running? When you say "I need to have my own Dockerfile with Tern in it" -- what Dockerfile are you using? Also, did you try the workaround mentioned here?

@Jeeppler
Copy link

@rnjudge thanks for opening the issue again. I installed Tern via pip in a Ubuntu 22.04 container. Ubuntu 22.04 comes with Python 3.10 and Skopeo.

I need one more component in the Dockerfile, therefore I need to create my own Dockerfile. The workaround you mentioned does not work for me as I am not having issues with a private Docker registry. @software-testing-professional mentioned that apk is the problem, that might be closer to the problem.

The part weird part is this:

chroot: failed to run command ‘’: No such file or directory

for whatever reason the command is empty. This only happens with Alpine images. Debian images can be scanned without any problems.

@rnjudge
Copy link
Contributor

rnjudge commented May 13, 2022

I will take a look at this today. When you say:

I need one more component in the Dockerfile, therefore I need to create my own Dockerfile.

can you share the Dockerfile you use to build Tern? and what is the "one more component" you are needing?

@Jeeppler
Copy link

@rnjudge thanks for showing some interest in this issue. We want to integrate Tern into SecHub. As part of the integration we need to have our SecHub Product Delegation Service (PDS) component in the final Docker image. The PDS component ensures, that we run tools in a cluster, either on a VM or even in a Kubernetes cluster.

The current state of the Dockerfile is available here: https://github.com/mercedes-benz/sechub/blob/c36d1268ff4e3afeafe71af4693d8425ad8f1e3a/sechub-pds-solutions/tern/docker/Tern-Ubuntu.dockerfile. At the moment I simply build the Dockerfile and went into the container manually to test Tern. Simply running: tern report -i golang:1.18-alpine.

@rnjudge
Copy link
Contributor

rnjudge commented May 18, 2022

@Jeeppler FYI, I am able to reproduce this issue and I'm looking at it. It does seem to be an apk specific issue unique to Ubuntu. When I use a debian based container I don't see this issue.

@rnjudge
Copy link
Contributor

rnjudge commented May 19, 2022

The find_shell() function looks for the shell in the container being analyzed to run the commands needed to collect package metadata information. If it doesn't find one, it defaults to a blank string, which is what we are seeing in this particular issue.

When the failing chroot command is run, it should utilize the shell to run the apk commands as you can see in tern/utils/rootfs.py below. Because the shell is defaulting to a blank string in the find_shell() function, the command fails to run resulting in the "chroot: failed to run command" error.

result = root_command(chroot, target_dir, shell, '-c', command_string)

Below is a snippet where you can see that Tern is trying to find the shell that is symlinked pointing to the root of the container.

def find_shell(fspath):
    """Given the path to the filesystem where a shell may exist, find the
    first available shell"""
    for sh in command_lib.command_lib['common']['shells']:
        realpath = os.path.realpath(os.path.join(fspath, sh[1:]))
        # If realpath is a symlink and points to the root of the container,
        # check for existence of the linked binary in current working dir
        if realpath[0] == '/' and os.path.exists(os.path.join(fspath, realpath[1:])):
             return sh



The behavior we're seeing happens because the realpath of the shell utility (i.e. /bin/sh) in a Ubuntu container chroot resolves to /usr/bin/busybox when, in fact, the utility exists under /bin/busybox.

>>> os.path.realpath(os.path.join(fspath, sh[1:]))
'/usr/bin/busybox'


root@5d8995710541:~/.tern/temp# tar -x -f /root/.tern/temp/df9b9388f04ad6279a7410b85cedfdcb2208c0a003da7ab5613af71079148139 -C /root/.tern/temp/mergedir
root@5d8995710541:~/.tern/temp# chroot /root/.tern/temp/mergedir
/ # ls -l /bin/sh
lrwxrwxrwx    1 root     root            12 Apr  4 16:06 /bin/sh -> /bin/busybox
 # ls -l /bin/busybox
-rwxr-xr-x    1 root     root        824984 Apr  4 10:19 /bin/busybox
/ # ls -l /usr/bin/busybox
ls: /usr/bin/busybox: No such file or directory

In a Debian container, the same command resolves to /bin/busybox where a shell can be found.

>>> os.path.realpath(os.path.join(fspath, sh[1:]))
'/bin/busybox'

I can insert a workaround for this to fix the chroot issue we are seeing.

rnjudge added a commit to rnjudge/tern that referenced this issue May 19, 2022
When Tern ran in a Ubuntu container for images with an `apk` package
manager, there was an issue finding the shell which led to a failed
package metadata command using chroot.

This commit adds a workaround to make sure Tern can find a shell when
running in a Ubuntu container, specifically when the shell is symlinked
to busybox for the container being analyzed. A more detailed description
of the problem can be found in the bug report[1].

It's unclear exactly why the realpath fails to resolve to the correct
utility location when Tern runs in a Ubuntu container while analyzing
apk-based container images. For now, this commit is meant as a
workaround for this exceptional case that is blocking several users.

[1]tern-tools#1161

Resolves tern-tools#1161

Signed-off-by: Rose Judge <[email protected]>
@Jeeppler
Copy link

@rnjudge thanks for analyzing the problem and finding the root cause.

@rnjudge
Copy link
Contributor

rnjudge commented May 25, 2022

@Jeeppler are you able to test the fix at all? I tested it myself bu would love a second set of eyes on it! I'm planning a patch release to include this fix as well.

@Jeeppler
Copy link

@rnjudge yes, I can confirm, that I am now able to scan both golang:1.18-alpine and alpine:latest in a Ubuntu 22.04 container. Your fix works.

rnjudge added a commit that referenced this issue May 25, 2022
When Tern ran in a Ubuntu container for images with an `apk` package
manager, there was an issue finding the shell which led to a failed
package metadata command using chroot.

This commit adds a workaround to make sure Tern can find a shell when
running in a Ubuntu container, specifically when the shell is symlinked
to busybox for the container being analyzed. A more detailed description
of the problem can be found in the bug report[1].

It's unclear exactly why the realpath fails to resolve to the correct
utility location when Tern runs in a Ubuntu container while analyzing
apk-based container images. For now, this commit is meant as a
workaround for this exceptional case that is blocking several users.

[1]#1161

Resolves #1161

Signed-off-by: Rose Judge <[email protected]>
@Jeeppler
Copy link

@rnjudge thanks for fixing the issue.

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

Successfully merging a pull request may close this issue.

3 participants