From 46cb46d6a14ac3ab505962b86761c6a28bee1759 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 10 Dec 2020 17:16:44 -0500 Subject: [PATCH] Show Dialog On Crash + Add Troubleshooting Information To README --- README.md | 10 +++++++ debian/client/common/usr/bin/minecraft-pi | 13 +++++---- .../common/usr/lib/minecraft-pi/pre-launch.sh | 29 +++++++++++++++++++ .../client/virgl/usr/lib/minecraft-pi/run.sh | 14 +++++---- 4 files changed, 54 insertions(+), 12 deletions(-) create mode 100755 debian/client/common/usr/lib/minecraft-pi/pre-launch.sh diff --git a/README.md b/README.md index bae4621e3..ee8fa181c 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,16 @@ sudo apt update sudo apt install -t buster-backports libseccomp2 ``` +## Troubleshooting Crashes +Game logs are located in ``/tmp/minecraft-pi``. + +### ``Error response from daemon: error gathering device information while adding custom device "/dev/dri": no such file or directory`` +Make sure you are using the correct GPU drivers for your system. If you are using a Raspberry Pi, make sure you have set your GPU driver to ``Full KMS`` or ``Fake KMS`` in ``raspi-config``. + +### ``Segmentation Fault`` +1. Attempt To Reproduce Issue And Record Instructions +2. Report On Issue Tracker Including The Instructions To Reproduce + ## Dedicated Server The dedicated server is a version of Minecraft: Pi Edition modified to run in a headless environment. It loads settings from a ``server.properties`` file. diff --git a/debian/client/common/usr/bin/minecraft-pi b/debian/client/common/usr/bin/minecraft-pi index ce41705b7..bc5c3324f 100755 --- a/debian/client/common/usr/bin/minecraft-pi +++ b/debian/client/common/usr/bin/minecraft-pi @@ -26,12 +26,16 @@ if [ "$1" = "--print-features" ]; then exit 0 fi +# Export Important Variables +export ZENITY_CLASS='Minecraft - Pi edition' +export DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml" + # Ensure Features Are Selected if [ -z "${MCPI_FEATURES+x}" ]; then - MCPI_FEATURES="$(sh -c "zenity --class 'Minecraft - Pi edition' --list --checklist --column 'Enabled' --column 'Feature' ${AVAILABLE_FEATURES}")" + MCPI_FEATURES="$(sh -c "zenity --class \"${ZENITY_CLASS}\" --list --checklist --column 'Enabled' --column 'Feature' ${AVAILABLE_FEATURES}")" fi if [ -z "${MCPI_USERNAME+x}" ]; then - MCPI_USERNAME="$(zenity --class 'Minecraft - Pi edition' --entry --text 'Minecraft Username:' --entry-text 'StevePi')" + MCPI_USERNAME="$(zenity --class "${ZENITY_CLASS}" --entry --text 'Minecraft Username:' --entry-text 'StevePi')" fi export MCPI_FEATURES export MCPI_USERNAME @@ -44,8 +48,5 @@ fi # Allow X11 Connections From Root xhost local:root -# Update Docker Container -export DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml" - # Run -exec sg docker /usr/lib/minecraft-pi/run.sh \ No newline at end of file +sg docker /usr/lib/minecraft-pi/pre-launch.sh \ No newline at end of file diff --git a/debian/client/common/usr/lib/minecraft-pi/pre-launch.sh b/debian/client/common/usr/lib/minecraft-pi/pre-launch.sh new file mode 100755 index 000000000..88459b641 --- /dev/null +++ b/debian/client/common/usr/lib/minecraft-pi/pre-launch.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +set -e + +# Create Log Folder +rm -rf /tmp/minecraft-pi +mkdir -p /tmp/minecraft-pi + +# Start Logging +LOG="$(mktemp -u)" +mkfifo "${LOG}" +tee /tmp/minecraft-pi/main.log < "${LOG}" & +TEE_PID=$! + +# Run +set +e +/usr/lib/minecraft-pi/run.sh > "${LOG}" 2>&1 +RET=$? +set -e + +# Kill Logging +kill ${TEE_PID} +rm "${LOG}" + +# Handle Crash +if [ $RET -ne 0 ]; then + zenity --class "${ZENITY_CLASS}" --error --no-wrap --text 'Minecraft: Pi Edition has crashed!\nLogs are located in /tmp/minecraft-pi.' + exit $RET +fi \ No newline at end of file diff --git a/debian/client/virgl/usr/lib/minecraft-pi/run.sh b/debian/client/virgl/usr/lib/minecraft-pi/run.sh index 5e8390121..09099f7d8 100755 --- a/debian/client/virgl/usr/lib/minecraft-pi/run.sh +++ b/debian/client/virgl/usr/lib/minecraft-pi/run.sh @@ -3,14 +3,16 @@ set -e # Start VirGL -virgl_test_server > /tmp/virgl.log 2>&1 & -VIRGL_PID="$!" +virgl_test_server > /tmp/minecraft-pi/virgl.log 2>&1 & +VIRGL_PID=$! # Launch Minecraft -${DOCKER_COMPOSE} run --rm minecraft-pi || : -RET="$?" +set +e +${DOCKER_COMPOSE} run --rm minecraft-pi +RET=$? +set -e # Kill VirGL -kill "${VIRGL_PID}" +kill ${VIRGL_PID} -exit "${RET}" \ No newline at end of file +exit ${RET} \ No newline at end of file