WhitewaterFoundry / Pengwin

A Linux distro optimized for WSL based on Debian.
Other
1.48k stars 105 forks source link

"Error: no DISPLAY environment variable specified" after updating to version 1.4.1 with fish as default shell #571

Open zwwi opened 4 years ago

zwwi commented 4 years ago

Describe the bug See above, cannot open any GUI. I tried both X410 and VcXsrv.

I updated pengwin to 1.4.1. There was no problem before updating.

crramirez commented 4 years ago

Hello @zwwi,

Please put me in context.

etc

Regards

zwwi commented 4 years ago

@crramirez , thank you for your prompt reply:

crramirez commented 4 years ago

Could you please execute bash -x /etc/profile.d/00-pengwin.sh and send me the result. You can send it to contact@whitewaterfoundry.com as well

zwwi commented 4 years ago

here is the result of execute bash -x /etc/profile.d/00-pengwin.sh :

+ [[ -n /run/WSL/10941_interop ]]
+ export WSL2=1
+ WSL2=1
++ wslpath 'C:\Windows\System32\ipconfig.exe'
+ ipconfig_exec=/mnt/c/Windows/System32/ipconfig.exe
+ which ipconfig.exe
++ which ipconfig.exe
+ ipconfig_exec=/mnt/c/windows/system32/ipconfig.exe
++ eval /mnt/c/windows/system32/ipconfig.exe
+++ /mnt/c/windows/system32/ipconfig.exe
++ grep -n -m 1 'Default Gateway.*: [0-9a-z]'
++ cut -d : -f 1
+ wsl2_d_tmp=26
+ [[ -n 26 ]]
++ eval /mnt/c/windows/system32/ipconfig.exe
+++ /mnt/c/windows/system32/ipconfig.exe
++ grep IPv4
++ cut -d : -f 2
+++ expr 26 - 4
++ sed -e 's|\s||g' -e 's|\r||g'
+++ expr 26 + 0
++ sed '22,26!d'
+ wsl2_d_tmp=my_ipv4_address
+ export DISPLAY=my_ipv4_address:0.0
+ DISPLAY=my_ipv4_address:0.0
+ unset wsl2_d_tmp
+ unset ipconfig_exec
+ which glxinfo
+ unset LIBGL_ALWAYS_INDIRECT
+ export NO_AT_BRIDGE=1
+ NO_AT_BRIDGE=1
+ alias 'clear=clear -x'
+ alias 'll=ls -al'
+ which cmd.exe
+ '[' '!' -f /home/zwwi/.firstrun ']'
+ wslpath 'C:\'
++ cmd-exe /c 'echo %HOMEDRIVE%%HOMEPATH%'
++ tr -d '\r'
+ wHomeWinPath='C:\Users\zwwi'
++ wslpath -u 'C:\Users\zwwi'
+ export WIN_HOME=/mnt/c/Users/zwwi
+ WIN_HOME=/mnt/c/Users/zwwi
+ win_home_lnk=/home/zwwi/winhome
+ '[' '!' -e /home/zwwi/winhome ']'
+ unset win_home_lnk

where I have replaced the actual ip address by my_ipv4_address.

crramirez commented 4 years ago

Looks good, so my next question. Is you default shell bash? Something is avoiding this script to set DISPLAY correctly

zwwi commented 4 years ago

The default shell is fish, set by using pengwin-setup before the update.

crramirez commented 4 years ago

Ok, let us make some tests with fish and zsh. Thank you for reporting

crramirez commented 4 years ago

Looks like WSL is not reading /etc/environment anymore. The script /etc/profile.d/00-pengwin.sh must be translated into fish and be included in pengwin-base.

This will take time. If someone can help it will be wonderful

crramirez commented 4 years ago

The change is coming: https://github.com/WhitewaterFoundry/pengwin-base/pull/66

crramirez commented 4 years ago

We are having problems with the pengwin-base.deb. Meanwhile please execute this script:

sudo wget -O /etc/fish/conf.d/00-pengwin.fish https://raw.githubusercontent.com/WhitewaterFoundry/pengwin-base/development/fish_conf.d/00-pengwin.fish

zwwi commented 4 years ago

thanks

maple3142 commented 4 years ago

I am having the same problem on zsh, but sourcing /etc/profile.d/00-pengwin.sh works.

crramirez commented 4 years ago

Hmm, it should happen automatically. We will check. Thanks for reporting.

maple3142 commented 4 years ago

I think it is /etc/profile.d not working at all for non bash shell. For example, 02-x410.sh, fcitx.sh won't be run as expected.

woutGdpr commented 4 years ago

Hi, i have a wsl on my windows computer. im trying to run a script that would get cookies from a website. Wsl is headless so i dit run Xvfb :99 -ac -screen scrn 1028x1024x24 &> /dev/null before running my python server. In my geckodriver.log i get this message: 1603637350760 geckodriver INFO Listening on 127.0.0.1:58875 1603637350763 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileaRFiMo" Error: no DISPLAY environment variable specified

Any idea how to fix this?

Thanks in advance

crramirez commented 4 years ago

Hello,

Did you try to define the DISPLAY variable after running Xvfb with the same display number like : export DISPLAY=:99 ?

Regards, Carlos

woutGdpr commented 4 years ago

Thanks a lot Carlos! worked for me

maple3142 commented 4 years ago

I found that even in bash, /etc/profile.d doesn't work at all. What should I do to make /etc/profile.d work?

> echo $SHELL
/usr/bin/zsh

~                                                                                                           at 17:33:33
> echo $DISPLAY

~                                                                                                           at 17:33:36
> bash
maple3142@MAPLE:~$ echo $DISPLAY

maple3142@MAPLE:~$
crramirez commented 4 years ago

Try with

bash --login

I will make a full test with zsh to identify what is happening with 00-pengwin.sh

crramirez commented 4 years ago

@maple3142

I made a test with zsh as the default shell and it is working. Could you check if you have this:

$ cat /etc/zsh/zprofile
unsetopt no_match
source /etc/profile
setopt no_match

I tested 02-x410.sh and it is working as well. You can try to reinstall it with pengwin-setup in case that you have an older version

maple3142 commented 4 years ago

Ok, it seems to be working when launching as login shell, but it is quite slow when executing all the scripts:

~                                                                                                           at 21:17:33
> cat /etc/zsh/zprofile
# /etc/zsh/zprofile: system-wide .zprofile file for zsh(1).
#
# This file is sourced only for login shells (i.e. shells
# invoked with "-" as the first character of argv[0], and
# shells invoked with the -l flag.)
#
# Global Order: zshenv, zprofile, zshrc, zlogin

unsetopt no_match
source /etc/profile
setopt no_match

~                                                                                                           at 21:17:45
> time zsh -i -c exit
zsh -i -c exit  0.03s user 0.03s system 94% cpu 0.062 total

~                                                                                                           at 21:17:49
> time zsh --login -i -c exit
zsh --login -i -c exit  0.10s user 0.07s system 3% cpu 4.289 total

~                                                                                                   took 4s at 21:17:57
> ls /etc/profile.d/
00-pengwin.sh  02-x410.sh  bash_completion.sh  dbus.sh  fcitx.sh  im-config_wayland.sh  vte-2.91.sh  vte.csh
maple3142 commented 4 years ago

It seems fcitx script is quite slow:

~                                                                                                                                                                                                    at 21:23:08
> time zsh /etc/profile.d/fcitx.sh
zsh /etc/profile.d/fcitx.sh  0.01s user 0.00s system 0% cpu 4.009 total
crramirez commented 4 years ago

Yes it is slow because it runs ipconfig.exe and also starts dbus and if you are not already started x410 it launch it