79554678

Date: 2025-04-04 07:20:24
Score: 1
Natty:
Report link
My WSL2 distro (Debian) contains /usr/bin/Xtigervnc, an Xserver compatible with vnc.  I don't remember if it came in Debian by default or if I installed it later.

To view my vnc session, I used the RealVNC vnc viewer, a Windows application that was free when I got it an I hope is still free if you go to get it.  You should be able to find it easily in a Google search.  I suspect any vnc viewer will work.

There are 2 unusual things you need to do to get this to work: (1) Make your /tmp/.X11-unix read-write, and (2) run epiphany from dbus-run-session.

Here's how to solve (1):
Open a WSL2 bash shell, and in there, do these commands:
  cd /tmp
  sudo umount /tmp/.X11-unix
  sudo mkdir -p .X11-unix
  chmod 1777 .X11-unix #Required permissions!
Don't try to change $TMPDIR to use a different readable folder -- epiphany ignores this.
WARNING: There is a reason WSL2 mounts this folder read-only! Things in /tmp can theoretically get deleted at any time, and I guess Microsoft didn't want to deal with that problem if you're using Microsoft's built-in Xserver in WSL2 (which is called WSLg in Windows 11, but apparently is available but not advertised in the latest Windows 10 WSL2).

Here's how to solve (2):
You need to run epiphany with this command:
  dbus-run-session -- epiphany

For Linux beginners:
After doing step (1) above, and before doing step (2), you need to start a vnc server.  Here are detailed procedures:
- Open a WSL terminal
- Enter the following command: which vncserver
  If this command returns nothing or an error message, then you don't have vncserver, so you need to install it.  Here's how to do that in a Debian distribution:
    sudo apt update
    sudo apt install tigervnc-standalone-server
- Enter the following command: which epiphany
  If this command returns nothing or an error message, then you don't have the epiphany browser, so you need to install it.  Here's how to do that in a Debian distribution:
    sudo apt update
    sudo apt install epiphany-browser
- Enter this command: vncpasswd
  Choose a password
  Most people choose n for no to the question, "Would you like to enter a view-only password (y/n)?"
- Enter this command: vncserver :1
- Run your vnc viewer in Windows.  On my machine, I can do that by clicking the start button, typing vnc, and then clicking the vnc.exe icon
- You'll need to tell the vnc viewer software what display to connect to, and how you do that depends on which vnc viewer you have.  On my computer, the viewer provides a search bar, in which I type localhost:1 and hit the Entey keyboard key.  A password dialog pops up, in which I enter the password I created with vncpasswd.
- You should see a Linux desktop now.  I'm not sure what it will look like by default -- mine is so customized I can't remember.
- To launch epiphany, you'll need a terminal window on your Linux desktop in your vnc viewer.  How you get one depends on your configuration.  I can't really help you with that.
- In the terminal inside the vnc viewer, enter this command:
    echo "$DISPLAY"
  If that prints nothing, then enter this command: export DISPLAY=:1
- Now enter this command
    dbus-run-session -- epiphany &
  This will show error messages and warnings.  If epiphany doesn't start successfully, use these messages to diagnose.  Once you have it working, however, you may not want to see all this verbose info each time, so I recommend using this command from then on:
    dbus-run-session -- epiphany > /dev/null 2>&1 < /dev/null &


Reasons:
  • Blacklisted phrase (1): how to solve
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Glenn Pfeffer