bedrocklinux / bedrocklinux-userland

This tracks development for the things such as scripts and (defaults for) config files for Bedrock Linux
https://bedrocklinux.org
GNU General Public License v2.0
616 stars 69 forks source link

[Error: OCI runtime error: crun: pivot_root: Invalid argument] : Can podman be used normally on a machine with bedrock Linux 0.7.28beta? #272

Closed txmu closed 2 years ago

txmu commented 2 years ago
txmu@hostname:~/termux-docker$ sudo ./run.sh --podman ARCH=arm
Creating new container...
Error: OCI runtime error: crun: pivot_root: Invalid argument
Error: can only create exec sessions on running containers: container state improper

(See termux/termux-docker )

I think the point is Error: OCI runtime error: crun: pivot_root: Invalid argument

podman version:4.0.3 (Installed by arch-arm)

P.S.:

txmu@hostname:~/termux-docker$ sudo ./build-all.sh --podman
[1/2] STEP 1/16: FROM scratch AS bootstrap
[1/2] STEP 2/16: ARG BOOTSTRAP_VERSION=2022.07.03-r1%2Bapt-android-7
--> Using cache 8f40beda7f172655fe8fd03cca056872c168ebf7155e1ff4e069f94556e71b82
--> 8f40beda7f1
[1/2] STEP 3/16: ARG BOOTSTRAP_ARCH=i686
--> Using cache 98fde2321fdfb0d0623900885f20a767e44a8f0e0d4170247d8df07075fa2706
--> 98fde2321fd
[1/2] STEP 4/16: ARG SYSTEM_TYPE=x86
--> Using cache dde9561a98fc0d6510e2b9b1f5dbc3695d3ad9a5ee6602d1eb373fd65c944c30
--> dde9561a98f
[1/2] STEP 5/16: SHELL ["/system/bin/sh", "-c"]
--> Using cache ff3b063fbd701eeb8c8ee38030bb834f394ac19d9507af2b630418cc5485a3ca
--> ff3b063fbd7
[1/2] STEP 6/16: ENV PATH /system/bin
--> Using cache 9e858d7dfb4b80e8b57423b9acc96b8cbbeb3177549984ded6b13c1fa4fad2bb
--> 9e858d7dfb4
[1/2] STEP 7/16: COPY /system/$SYSTEM_TYPE /system
--> 4164f624b8b
[1/2] STEP 8/16: COPY /static-dns-hosts.txt /system/etc/static-dns-hosts.txt
--> 7c8ad01075b
[1/2] STEP 9/16: ADD https://github.com/termux/termux-packages/releases/download/bootstrap-$BOOTSTRAP_VERSION/bootstrap-$BOOTSTRAP_ARCH.zip /bootstrap.zip
--> e0de1cbd7ac
[1/2] STEP 10/16: RUN busybox mkdir -p /data/data/com.termux/files &&     cd /data/data/com.termux/files &&     busybox mkdir ../cache ./usr ./home &&     busybox unzip -d usr /bootstrap.zip &&     busybox rm /bootstrap.zip &&     cd ./usr &&     busybox cat SYMLINKS.txt | while read -r line; do       dest=$(echo "$line" | busybox awk -F '←' '{ print $1 }');       link=$(echo "$line" | busybox awk -F '←' '{ print $2 }');       busybox ln -s "$dest" "$link";     done &&     busybox rm SYMLINKS.txt &&     busybox ln -s /data/data/com.termux/files/usr /usr &&     busybox ln -s /data/data/com.termux/files/usr/bin /bin &&     busybox ln -s /data/data/com.termux/files/usr/tmp /tmp
error running container: error from /usr/bin/crun creating container for [/system/bin/sh -c busybox mkdir -p /data/data/com.termux/files &&     cd /data/data/com.termux/files &&     busybox mkdir ../cache ./usr ./home &&     busybox unzip -d usr /bootstrap.zip &&     busybox rm /bootstrap.zip &&     cd ./usr &&     busybox cat SYMLINKS.txt | while read -r line; do       dest=$(echo "$line" | busybox awk -F '←' '{ print $1 }');       link=$(echo "$line" | busybox awk -F '←' '{ print $2 }');       busybox ln -s "$dest" "$link";     done &&     busybox rm SYMLINKS.txt &&     busybox ln -s /data/data/com.termux/files/usr /usr &&     busybox ln -s /data/data/com.termux/files/usr/bin /bin &&     busybox ln -s /data/data/com.termux/files/usr/tmp /tmp]: pivot_root: Invalid argument
: exit status 1
ERRO[0018] did not get container create message from subprocess: read |0: i/o timeout
Error: error building at STEP "RUN busybox mkdir -p /data/data/com.termux/files &&     cd /data/data/com.termux/files &&     busybox mkdir ../cache ./usr ./home &&     busybox unzip -d usr /bootstrap.zip &&     busybox rm /bootstrap.zip &&     cd ./usr &&     busybox cat SYMLINKS.txt | while read -r line; do       dest=$(echo "$line" | busybox awk -F '←' '{ print $1 }');       link=$(echo "$line" | busybox awk -F '←' '{ print $2 }');       busybox ln -s "$dest" "$link";     done &&     busybox rm SYMLINKS.txt &&     busybox ln -s /data/data/com.termux/files/usr /usr &&     busybox ln -s /data/data/com.termux/files/usr/bin /bin &&     busybox ln -s /data/data/com.termux/files/usr/tmp /tmp": error while running runtime: exit status 1
paradigm commented 2 years ago

I'm not deeply familiar with podman, but a quick and dirty attempt to test it out and see if the basics work seem to validate that it works as expected. Based on introductory documentation I installed podman then ran

sudo podman run -it docker.io/library/busybox

and watched it download an image before finding myself in a shell in a minimal busybox-based environment. Basics seem to work as expected.

Moreover, while I personally haven't used them much, I would expect docker and podman related technologies are popular enough that were there issues I'd have seen other people inquire about it well before you did.

Your termux-docker link didn't work, but I think I found it on my own. I didn't fully understand what I was doing, but I was able to follow the podman variation of instructions in a test Bedrock environment, see similar output to what you've shown, but watch it progress past the STEP 10/16 your attempt choked on. No pivot_root error message.

While I didn't definitively rule it out, Bedrock isn't trivially/obviously the problem here.

That having been said, there's one thing we could try: restriction. Give this a go:

sudo strat -r $(brl which podman) ./run.sh --podman ARCH=arm

The need to restrict things when something isn't working as expected is covered in brl tutorial basics, the basic usage documentation, the debugging documentation, and the strat command reference documentation. If you haven't worked your way through at least brl tutorial basics or the basic usage documentation, I strongly recommend doing so. While Bedrock makes a lot just-work, the abstraction does fall apart in some circumstances and it's important to know how to recognize and manage those.