Pengwin icon indicating copy to clipboard operation
Pengwin copied to clipboard

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

Open zwwi opened this issue 5 years ago • 23 comments

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.

zwwi avatar Jan 13 '20 12:01 zwwi

Hello @zwwi,

Please put me in context.

  • When do you see the message? At startup? After executing a command?
  • What user are you using, the default one or root

etc

Regards

crramirez avatar Jan 13 '20 12:01 crramirez

@crramirez , thank you for your prompt reply:

  • Pengwin can be started without any problem. Then, starting, e.g., firefox from the terminal I got that message.

  • I used the default user.

  • After setting the display in .bashrc by export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 then firefox can be started from bash. But this was not needed in the previous version.

zwwi avatar Jan 13 '20 13:01 zwwi

Could you please execute bash -x /etc/profile.d/00-pengwin.sh and send me the result. You can send it to [email protected] as well

crramirez avatar Jan 13 '20 14:01 crramirez

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.

zwwi avatar Jan 13 '20 15:01 zwwi

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

crramirez avatar Jan 13 '20 15:01 crramirez

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

zwwi avatar Jan 13 '20 16:01 zwwi

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

crramirez avatar Jan 13 '20 16:01 crramirez

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 avatar Jan 13 '20 21:01 crramirez

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

crramirez avatar Jan 15 '20 22:01 crramirez

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

crramirez avatar Jan 20 '20 19:01 crramirez

thanks

zwwi avatar Jan 21 '20 12:01 zwwi

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

maple3142 avatar Aug 27 '20 15:08 maple3142

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

crramirez avatar Aug 27 '20 15:08 crramirez

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.

maple3142 avatar Aug 27 '20 17:08 maple3142

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

woutGdpr avatar Oct 25 '20 14:10 woutGdpr

Hello,

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

Regards, Carlos

crramirez avatar Oct 26 '20 00:10 crramirez

Thanks a lot Carlos! worked for me

woutGdpr avatar Oct 26 '20 09:10 woutGdpr

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:~$

maple3142 avatar Nov 06 '20 09:11 maple3142

Try with

bash --login

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

crramirez avatar Nov 06 '20 12:11 crramirez

@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

crramirez avatar Nov 06 '20 13:11 crramirez

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 avatar Nov 06 '20 13:11 maple3142

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

maple3142 avatar Nov 06 '20 13:11 maple3142

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

crramirez avatar Nov 06 '20 13:11 crramirez