mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

x11docker ERROR: dockerrc(): Did not receive PID of PID1 in container. #274

Closed pahansen95 closed 4 years ago

pahansen95 commented 4 years ago

Environment

Error

x11docker ERROR: dockerrc(): Did not receive PID of PID1 in container.

I've attached the full verbose log file. If you don't want to download a file then here is the pastebin link.

When running the below command I see a grey screen pop up on my monitor but then I encounter the above error & I drop back to the console.

I've gone through the troubleshooting section but I wasn't able to determine what to dig into further.

I'm looking for some help with further troubleshooting if you have the time. Please let me know if I can provide more info.

x11docker command

I'm running this from an SSH session & have my Pi hooked up to a monitor.

sudo x11docker \
  --verbose \
  --xorg \
  --fullscreen \
  --vt 1 \
  --display 1 \
  --shell /bin/bash \
  --showpid1 \
  --wm=none \
  --user=RETAIN \
  -- jess/chromium --no-sandbox --kiosk https://google.com

Generated Docker Command

docker run --tty --rm --detach \
  --name x11docker_X1_jess-chromium-no-sandbox-kiosk-https-goo_57480321287 \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --volume '/usr/bin/docker-init':'/usr/local/bin/init':ro \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/home/ubuntu/.cache/x11docker/jess-chromium-no-sandbox-kiosk-https-goo57480321287/share':'/x11docker':rw \
  --volume '/tmp/.X11-unix/X1':'/X1':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xauthority.client' \
  --env 'DISPLAY=:1' \
  -- jess/chromium /usr/local/bin/init -- /bin/sh - /x11docker/containerrc
mviereck commented 4 years ago

Thank you for the detailed report!

Does the issue occur with other images, too? You could check e.g. x11docker --desktop x11docker/fvwm, a very small image.

I have one first idea: Is docker installed with snap or snappy? That causes some restrictions. x11docker should detect a snap installation, but maybe the check failed.

pahansen95 commented 4 years ago

I just ran sudo x11docker --xorg --desktop x11docker/fvwm & encountered the same issue. Every other image I've used has had this issue as well.

Docker is installed via apt using the Docker's Apt repositories as per their installation instructions.

eine commented 4 years ago

Image jess/chromium seems to be for amd64 only (no multiarch): https://hub.docker.com/r/jess/chromium/tags. Hence, I would not expect it to work on a RPi3B, unless some dynamic translation or VM is used. For instance dbhi.github.io/qus.

I would try running docker run --rm -it --entrypoint sh jess/chromium first, and you will probably get an error. By the same token, x11docker/fvwm should not work either.

If you want to try an image for ARM, dbhi/docker provides several multiarch images. For example, aptman/dbhi:bionic-octave-arm64 contains Octave, which is an application with a GUI.

pahansen95 commented 4 years ago

Yup that was exactly it. Running the ARM Image starting octave works.

Thanks very much for the help.

EDIT: For anyone else my final test command was x11docker --xorg --vt 1 -i aptman/dbhi:bionic-octave octave

mviereck commented 4 years ago

Great! Also much thanks, @eine! I should add this to the troubleshooting section.

eine commented 4 years ago

Glad it worked! Now, if you execute docker run --rm --privileged aptman/qus -s -- -p x86_64, then jess/chromium and x11docker/fvwm might (or might not) work. That will depend on the features supported by QEMU. Anyway, that is something specific to executing foreign docker images. Should have nothing to do with x11docker.

I should add this to the troubleshooting section.

I believe I have used x11docker on several ARM/ARM64 SBCs, without any issue (other than ensuring that the image works). Hence, I believe it should be just an explanation for people to be aware that docker images are not platform agnostic. Some can be, but definitely not most of the ones with GUI apps. This is an interesting reference to add: https://github.com/docker-library/official-images#architectures-other-than-amd64

mviereck commented 4 years ago

x11docker now prints host and image architecture in the PID1 error message. Example:

x11docker ERROR: dockerrc(): Did not receive PID of PID1 in container. 
  Maybe the container immediately stopped for unknown reasons. 
  Just in case, check if host and image architecture are compatible: 
  Host architecture: amd64 (x86_64), image architecture: amd64.