Hi,

How do you test?

- Which version of WSL you are using?
- What is the output of `echo $DISPLAY` if you open a terminal from the link 
created by wslu?
- What is the content of `/etc/resolv.conf`?

I found where the issue is. On "wslu v3.2.1-1; wslusc v40", in
`/usr/share/wslu/wslusc-helper.sh` if I comment the following code, the
shortcuts start working:

#  if ( eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | 
cut -d : -f 1 ) >/dev/null; then
#    set +H
#    wsl2_d_tmp="$(eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: 
[0-9a-z]" | cut -d : -f 1)"
#    wsl2_d_tmp="$(eval "$ipconfig_exec" | sed $(( wsl2_d_tmp - 4 ))','$(( 
wsl2_d_tmp + 0 ))'!d' | grep IPv4 | cut -d : -f 2 | sed -e "s|\s||g" -e 
"s|\r||g")"
#    set -H
#    export DISPLAY=${wsl2_d_tmp}:0.0
#  else
    wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')"
    export DISPLAY=${wsl2_d_tmp}:0
#  fi

This means the script is not setting DISPLAY variable properly and no
matter which X11 server you are using, it won't connect since on WSL2 it
is not in the local network. Here is what the script does without
commenting:

$ echo $DISPLAY
172.24.224.1:0      # this is what the IP should be
$ unset DISPLAY
/usr/share/wslu$ . ./wslusc-helper.sh 
$ echo $DISPLAY
192.168.0.16:0.0    # this is what the scripts sets, this would work on WSL1 
where host and WSL are on the same network, but on WSL2 it won't work

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to wslu in Ubuntu.
https://bugs.launchpad.net/bugs/1914601

Title:
  GUI apps do not start from the link created

Status in wslu package in Ubuntu:
  Incomplete

Bug description:
  Description:    Ubuntu 20.04.2 LTS
  Release:        20.04

  wslu:
    Installed: 2.3.6-0ubuntu2~20.04.0
    Candidate: 2.3.6-0ubuntu2~20.04.0
    Version table:
   *** 2.3.6-0ubuntu2~20.04.0 500
          500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
          100 /var/lib/dpkg/status
       2.3.6-0ubuntu1 500
          500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

  C:\Users\username\Desktop>wsl -l -v
    NAME                   STATE           VERSION
  * Ubuntu-20.04           Running         2

  $ wslusc --version
  wslu v2.3.6; wslusc v37

  $ wslusc terminator
  [info] Create shortcut terminator.lnk successful

  C:\Users\username\Desktop>terminator.lnk
  Unable to init server: Could not connect: Connection refused
  Unable to init server: Could not connect: Connection refused
  You need to run terminator in an X environment. Make sure $DISPLAY is 
properly set

  $ wslusc --gui terminator
  [info] Create shortcut terminator.lnk successful

  C:\Users\username\Desktop>terminator.lnk
  <nothing happens>

  Looks like DISPLAY propery is not set correctly by the underlying
  script:

  $ pwd
  /usr/share/wslu
  $ export DISPLAY=SHOULD_BE_SET
  $ . wsl-integration.sh
  $ echo $DISPLAY
  SHOULD_BE_SET

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/wslu/+bug/1914601/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to