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

Can't open GUI app from terminal #63

Closed
NoozAbooz opened this issue May 20, 2021 · 46 comments
Closed

Can't open GUI app from terminal #63

NoozAbooz opened this issue May 20, 2021 · 46 comments

Comments

@NoozAbooz
Copy link

I'm using wsl2. I'm running a docker app. I got this while running it in terminal directly without using any of the shortcut stuff or the linux apps menu:

[ERR]: GLFW Error: X11: Failed to open display unix172.17.16.1:0.0

(I've tested other apps like zenity which display perfectly.)

@Andrew-J-Larson
Copy link

Andrew-J-Larson commented May 20, 2021

Seems likely that the export might be screwed up for the direct terminal.

When that error shows up, in the same terminal, have you tried to execute export DISPLAY=172.17.16.1:0.0 (or whatever IP it shows after the unix part), and then tried to run the application again?

You could also try DISPLAY=172.17.16.1:0.0 [app/command you are trying to run here] in case export is not working.

@Andrew-J-Larson
Copy link

Also, maybe check the application itself for any switches that change the display

@NoozAbooz
Copy link
Author

Also, maybe check the application itself for any switches that change the display

The display stuff didn't seem to work. The app doesn't seem to change the display stuff but here's it's code just in case

#!/bin/sh

set -e

# All Feature Flags
export AVAILABLE_FEATURES="$(tr '\n' ' ' < /usr/share/minecraft-pi/client/features)"

# Print Feature Flags Option
if [ "$1" = "--print-features" ]; then
    echo "${AVAILABLE_FEATURES}"
    exit 0
fi

# Esnure User Is In docker Group
#if ! id -nGz | grep -qzxF 'docker'; then
#    pkexec /usr/sbin/usermod -aG docker "$(id -un)"
#fi

# Export Important Variables
export ZENITY_CLASS='Minecraft - Pi edition'
export DOCKER_COMPOSE_YML="/usr/share/minecraft-pi/client/docker-compose.yml"

# Ensure Features Are Selected
if [ -z "${MCPI_FEATURES+x}" ]; then
    MCPI_FEATURES="$(eval "zenity --class \"${ZENITY_CLASS}\" --list --checklist --width 400 --height 400 --column 'Enabled' --column 'Feature' ${AVAILABLE_FEATURES}")"
fi
if [ -z "${MCPI_RENDER_DISTANCE+x}" ]; then
    MCPI_RENDER_DISTANCE="$(zenity --class "${ZENITY_CLASS}" --list --radiolist --width 400 --height 400 --text 'Minecraft Render Distance:' --column 'Selected' --column 'Name' FALSE 'Far' FALSE 'Normal' TRUE 'Short' FALSE 'Tiny')"
fi
if [ -z "${MCPI_USERNAME+x}" ]; then
    MCPI_USERNAME="$(zenity --class "${ZENITY_CLASS}" --entry --text 'Minecraft Username:' --entry-text 'StevePi')"
fi
export MCPI_FEATURES
export MCPI_RENDER_DISTANCE
export MCPI_USERNAME

# Prepare Environment
export USER_HOME="${HOME}"
export USER_UID="$(id -u)"
export USER_GID="$(id -g)"
get_gid() {
    echo "$(getent group "$1" | cut -d : -f 3)"
}
export USER_OTHER_GIDS="$(get_gid video) $(get_gid render)"

# Run
set +e
sg docker /usr/lib/minecraft-pi/pre-launch.sh
RET=$?
set -e

# Handle Crash
if [ ${RET} -ne 0 ]; then
    zenity --class "${ZENITY_CLASS}" --error --no-wrap --text 'Minecraft: Pi Edition has crashed!\n\nExit Code: '${RET}'\n\n<a href="file:///tmp/minecraft-pi">Open Log Folder</a>\n<a href="https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/src/branch/master/docs/TROUBLESHOOTING.md">Open Troubleshooting Guide</a>'
    exit ${RET}
fi

@Andrew-J-Larson
Copy link

Andrew-J-Larson commented May 20, 2021

Minecraft PI edition? Why are you trying to run that in WSL? Doing some coding projects with it?

In any case, assuming you are virtualizing an ARM system within WSL, you're likely missing openGL drivers for the virtualization, that or something else is going wrong.

@Andrew-J-Larson
Copy link

@mobilegmyt

Maybe line 3 (set -e) is causing display to screw up.

Here's what I suggest, try replacing:

set -e

with

display=$DISPLAY
set -e
export DISPLAY=$display

in your script.

@NoozAbooz
Copy link
Author

NoozAbooz commented May 20, 2021

Minecraft PI edition? Why are you trying to run that in WSL? Doing some coding projects with it?

In any case, assuming you are virtualizing an ARM system within WSL, you're likely missing openGL drivers for the virtualization, that or something else is going wrong.

I'm trying to run mcpi-reborn: https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn. It's a mcpi mod that I want to get running on my win10 machine. I'm running a x86 virgl edition of it which quote, "Uses VirGL For Hardware Acceleration" so it probably doesn't use gl.

@NoozAbooz
Copy link
Author

@mobilegmyt

Maybe line 3 (set -e) is causing display to screw up.

Here's what I suggest, try replacing:

set -e

with

display=$DISPLAY
set -e
export DISPLAY=$display

in your script.

Still the same issue sadly :/

@Andrew-J-Larson
Copy link

how about maybe including this somwhere near the top? export LIBGL_ALWAYS_INDIRECT=0

@Andrew-J-Larson
Copy link

Only other thing I can think of, if that doesn't work, is maybe try changing the display mode in GWSL (to single window mode or full screen mode) and then see if your script works then.

@NoozAbooz
Copy link
Author

Only other thing I can think of, if that doesn't work, is maybe try changing the display mode in GWSL (to single window mode or full screen mode) and then see if your script works then.

Is it normal for windowed mode to be showing this black screen? I do have a de installed.
image

@Pololot64
Copy link
Member

Pololot64 commented May 20, 2021

That is normal when no clients are connected. So did you update your .profile yet? Sorry. I missed what has been going on. (note I have never tested GWSL with docker)

@NoozAbooz
Copy link
Author

That is normal when no clients are connected. So did you update your .profile yet? Sorry. I missed what has been going on. (note I have never tested GWSL with docker)

.profile? Whut?

@Pololot64
Copy link
Member

I am not sure how wsl works with docker but if you get in the docker's home directory if there is one what happens if you run cat .profile

@NoozAbooz
Copy link
Author

I am not sure how wsl works with docker but if you get in the docker's home directory if there is one what happens if you run cat .profile

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
export LIBGL_ALWAYS_INDIRECT=1 #GWSL
export GTK_THEME=Windows-10-Dark-3.2-dark
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0 #GWSL
export PULSE_SERVER=tcp:$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') #GWSL

@Pololot64
Copy link
Member

try replacing $(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') with the ip that th error message shows. Leave the :0.0 though

@NoozAbooz
Copy link
Author

try replacing $(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') with the ip that th error message shows. Leave the :0.0 though

Unable to init server: Could not connect: Connection refused

(zenity:1508): Gtk-WARNING **: 18:53:26.630: cannot open display: 172.17.16.1

@Pololot64
Copy link
Member

Did you allow GWSL through the windows firewall? Since you are running the beta you can fix it in the dashboard in the about screen

@NoozAbooz
Copy link
Author

Did you allow GWSL through the windows firewall? Since you are running the beta you can fix it in the dashboard in the about screen

It was allowed when I opened it.
image

@Pololot64
Copy link
Member

Well now the ip has probably changed... What happens if you run echo $(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0

@NoozAbooz
Copy link
Author

Well now the ip has probably changed... What happens if you run echo $(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0

It's still 172.17.16.1

@Pololot64
Copy link
Member

Does GWSL's test xclock work? Dashboard --> About --> XClock?

@NoozAbooz
Copy link
Author

Does GWSL's test xclock work? Dashboard --> About --> XClock?

image

@Pololot64
Copy link
Member

Pololot64 commented May 21, 2021

I found this. microsoft/WSL#2855 (comment)

Create an xserver profile with the flags -nowgl -compositewm -multiwindow

(Name it Minecraft or something)

@NoozAbooz
Copy link
Author

I found this. microsoft/WSL#2855 (comment)

Create an xserver profile with the flags -nowgl -compositewm -multiwindow

(Name it Minecraft or something)

So I click this and enter the args and stuff right?
image

@Pololot64
Copy link
Member

Yes

@NoozAbooz
Copy link
Author

Yes

Okay, I'm switched to the profile, I remove all my previous changes to .profile and /usr/bin/minecraft-pi so it would launch properly. Still the same error though.

@Pololot64
Copy link
Member

And if you keep that profile and put this in .profile export LIBGL_ALWAYS_INDIRECT=0 does it work?

@Pololot64
Copy link
Member

And maybe restart wsl with wsl --shutdown

@NoozAbooz
Copy link
Author

And if you keep that profile and put this in .profile export LIBGL_ALWAYS_INDIRECT=0 does it work?

Nope stll the same.

@Pololot64
Copy link
Member

I have no idea then :( sorry. I can't do anything to fix it in the backend either

@NoozAbooz
Copy link
Author

And maybe restart wsl with wsl --shutdown

And also apprantly --shutdown wasn't a proper argument so I used the restart function in gwsl

@Pololot64
Copy link
Member

Thats ok. Some apps just don't work in WSL. I hope soon compatability will be better but for now its up to Microsoft.

@Pololot64
Copy link
Member

Wait wsl --shutdown didn't work? That is how GWSL restarts... Do you have the new wsl? If you get the builtin wsl help what are the available commands... Maybe it did not restart after all O_o

@NoozAbooz
Copy link
Author

Wait wsl --shutdown didn't work? That is how GWSL restarts... Do you have the new wsl? If you get the builtin wsl help what are the available commands... Maybe it did not restart after all O_o

image
I'm using wsl2

@Pololot64
Copy link
Member

I mean in cmd not bash :D

@NoozAbooz
Copy link
Author

I mean in cmd not bash :D

Ohhh lol... well appratly wsl.exe --shutdown works if you type it in bash though. I'll try a non-beta version of gwsl.

@NoozAbooz
Copy link
Author

It might of actually worked? I got standard_init_linux.go:219: exec user process caused: exec format error intead of the x11 error

@Pololot64
Copy link
Member

I mean in cmd not bash :D

Ohhh lol... well appratly wsl.exe --shutdown works if you type it in bash though. I'll try a non-beta version of gwsl.

Non beta and beta GWSL have no difference for the error btw. GWSL 1.3.8 is just better in other ways

It might of actually worked? I got standard_init_linux.go:219: exec user process caused: exec format error intead of the x11 error

hmmm

@NoozAbooz
Copy link
Author

Oh... ripp

@NoozAbooz
Copy link
Author

Just a quick question, gwsl does support openGL apps right? I've recently gotten a dockerless build of the game using qemu which I think might work better.

@Pololot64
Copy link
Member

It should. It works very well for me

@NoozAbooz
Copy link
Author

Also sorta unrelated but is GWSL compatible with Wsl 1? Something broke hyper v on my PC which means I can only run WSL 1.

@Pololot64
Copy link
Member

Yes, as long as you have the latest wsl updates for windows 1903 and up, you can use wsl 1. So if you had 2 and just made a new machine with one it will work.

@NoozAbooz
Copy link
Author

Yes, as long as you have the latest wsl updates for windows 1903 and up, you can use wsl 1. So if you had 2 and just made a new machine with one it will work.

Alright, so I tested the game on WSL 1 and it crashed with [ERR]: (Media Layer Proxy Server) Unable To Open Maximum Pipe Size File, I believe it's a issue with WSL 1's inaccessible GPU which the game needs to run.

Instead, I tested it on a different device that could run WSL 2, and lo and behold the game runs! One issue is that sometimes, the game window will randomly close, but the game itself is still running in terminal and doesn't crash,

@Pololot64
Copy link
Member

Much better still though lol

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

No branches or pull requests

3 participants