Open Ubuntu Bash's GUI applications on Windows 10

46,841

Solution 1

I got it working by installing x11-apps to get the X subsystem, then running a X listener like XMING or XManager on the Windows10 side. Set the display in bash with the following:

export DISPLAY=:0

(You also can add export DISPLAY=:0 to the last line of your user's .bashrc file)

Then run xclock to verify.

Solution 2

Here is an attempt to work around the lack of a functioning X server on Windows. I have no way to try this as I don't have Windows 10.

Install Xvfb:

sudo apt-get install xvfb

Run Xvfb on display :0 (let it running):

Xvfb :0 -screen 0 1920x1080x24 +extension GLX -nolisten tcp -dpi 96

Start gedit:

export DISPLAY=:0
gedit

If you don't get any error messages in the steps above, you're good. Then you can install a VNC server:

sudo apt-get install x11vnc

Create a password:

x11vnc -storepasswd yourpassword

Connect it to display :0 and listen on localhost on port 5900:

x11vnc -safer -localhost -usepw -shared -forever -repeat -no6 -display :0 -rfbport 5900

Then you need to install a native Windows VNC client. TigerVNC or TightVNC are popular. You should then connect it to 127.0.0.1:5900.

Share:
46,841

Related videos on Youtube

abhimanyuaryan
Author by

abhimanyuaryan

Updated on September 18, 2022

Comments

  • abhimanyuaryan
    abhimanyuaryan over 1 year

    I have installed Windows 10 Insider build just to use Ubuntu Bash. I noticed its entire Ubuntu on Windows so I tried to install a GUI app i.e. Gedit. It was installed properly but when I try to open it. I see an error

    root@ACERASPIRE:~# gedit
    error: XDG_RUNTIME_DIR not set in the environment.
    
    (gedit:3994): Gtk-WARNING **: cannot open display:
    root@ACERASPIRE:~#
    

    Is it possible to fix this issue or get Ubuntu's GUI applications running on Windows 10. I think someone has a work around for this here

    • sjsam
      sjsam almost 8 years
      It appears that you're on the wrong forumn. Consider requestion to migrate this question to Askubuntu
    • o9000
      o9000 almost 8 years
      Only command line applications are available. Graphical applications will fail since there is no X server available. A possible idea is to work around it running Xvfb and a vnc server and client on 127.0.0.1, but I don't know if that will work.
    • abhimanyuaryan
      abhimanyuaryan almost 8 years
      @o9000 Can you propose your idea in answer. I have no idea how to do that vnc and Xvfb you are talking about :(_
    • o9000
      o9000 almost 8 years
      Done. If it works please let me know, I am considering trying such a setup myself in the future.
    • GaTechThomas
      GaTechThomas over 7 years
      I'm pretty new to this, but for some apps it seems that using "export DISPLAY=localhost:0.0" works where "export DISPLAY=:0" fails.
  • James Ko
    James Ko about 6 years
    Thanks for the post! This seems to work well, but I can't click on/interact with the window elements.