Microsoft will release GUI app support for WSL in the next Windows 11; more information are here:
- https://www.techradar.com/news/windows-11-could-seamlessly-run-graphical-linux-apps
- https://devblogs.microsoft.com/commandline/the-initial-preview-of-gui-app-support-is-now-available-for-the-windows-subsystem-for-linux-2/
In other words, there is no need to go through the pain of this manual anymore.
No, you will get cannot execute binary file: Exec format error
when you try to run rstudio
command.
- I only tested this with X410. Other x systems might work as well. gHowever; compared to other X systems, it works very well with Hi-DPI systems, and it offers different displaying modes.
- As of now I only managed to get the GUI of RStudio running in Pengwin. A Linux distro tailor-made for WSL. I tried it for Ubuntu 18.04 — But I get stuck on the Error
WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed
Detailed Error
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-steven'
WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace,
profile QSurfaceFormat::NoProfile)
Received signal 6
#0 0x7f448e42fa4f <unknown>
#1 0x7f448e42fe4b <unknown>
#2 0x7f448e4304ce <unknown>
#3 0x7f4489698890 <unknown>
#4 0x7f4487a0de97 gsignal
#5 0x7f4487a0f801 abort
#6 0x7f448992adcc QMessageLogger::fatal()
#7 0x7f44870e9afc QQuickWidgetPrivate::handleContextCreationFailure()
#8 0x7f44870e9cfa QQuickWidgetPrivate::createContext()
#9 0x7f44870ebe86 QQuickWidget::resizeEvent()
#10 0x7f4493b1998d QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget::resizeEvent()
#11 0x7f448aa8eea2 QWidget::event()
#12 0x7f44870ecacb QQuickWidget::event()
#13 0x7f4493b19c88 QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget::event()
#14 0x7f448aa50b3c QApplicationPrivate::notify_helper()
#15 0x7f448aa57d30 QApplication::notify()
#16 0x7f4489b17e28 QCoreApplication::notifyInternal2()
#17 0x7f448aa8763d QWidgetPrivate::sendPendingMoveAndResizeEvents()
#18 0x7f448aa8b1b3 QWidgetPrivate::show_helper()
#19 0x7f448aa8e375 QWidget::setVisible()
#20 0x7f448c962fb6 QtWebEngineCore::WebContentsAdapter::initialize()
#21 0x7f448c96521e QtWebEngineCore::WebContentsAdapter::load()
#22 0x7f448c965b50 QtWebEngineCore::WebContentsAdapter::load()
#23 0x56166919f0ac rstudio::desktop::SessionLauncher::launchFirstSession()
#24 0x5616691a055b rstudio::desktop::SessionLauncher::onLaunchFirstSession()
#25 0x7f4489b44801 QObject::event()
#26 0x7f448aa50b3c QApplicationPrivate::notify_helper()
#27 0x7f448aa57d30 QApplication::notify()
#28 0x7f4489b17e28 QCoreApplication::notifyInternal2()
#29 0x7f4489b1a857 QCoreApplicationPrivate::sendPostedEvents()
#30 0x7f4489b6fbb3 postEventSourceDispatch()
#31 0x7f4480e92417 g_main_context_dispatch
#32 0x7f4480e92650 <unknown>
#33 0x7f4480e926dc g_main_context_iteration
#34 0x7f4489b6f1ef QEventDispatcherGlib::processEvents()
#35 0x7f4489b1678a QEventLoop::exec()
#36 0x7f4489b1f190 QCoreApplication::exec()
#37 0x56166915ea0f main
#38 0x7f44879f0b97 __libc_start_main
#39 0x561669161d8a _start
r8: 0000000000000000 r9: 00007ffffe1b0d80 r10: 0000000000000008 r11: 0000000000000246
r12: 00007ffffe1b10b0 r13: 000056166b2a1720 r14: 000056166b2a1720 r15: 00007ffffe1b1620
di: 0000000000000002 si: 00007ffffe1b0d80 bp: 000056166b2a1720 bx: 00007f4489c3ae80
dx: 0000000000000000 ax: 0000000000000000 cx: 00007f4487a0de97 sp: 00007ffffe1b0d80
ip: 00007f4487a0de97 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
Ubuntu Progress/Notes
Help wanted! Note, whatever Pengwin’s GUILIB is installing and setting up, this is doing the trick.
Ubuntu needs the following GUI packages
sudo apt install libnss3
sudo apt install libasound2
sudo apt install libegl1-mesa
GUILIB from Pengwin
sudo apt-get install -y -q xclip gnome-themes-standard gtk2-engines-murrine dbus dbus-x11 mesa-utils libqt5core5a binutils
Fix DBUS error:
- sudo -i
- sudo dbus-uuidgen > /var/lib/dbus/machine-id
- exit
- Setup WSL 2 (follow these steps)
- Open CMD:
- If you have already a distro installed you can see an list and version using
wsl -l -v
- If you have already a WSL 1 distro installed, you can convert it to WSL 2:
wsl --set-version <DistroName> 2
. This will take some time. - (You might get prompted to install WSL 2 Linux kernel update. Follow the link and install the msi. Redo step 2)
- Make WSL 2 your default:
wsl --set-default-version 2
- If you have already a distro installed you can see an list and version using
- Install Pengwin from Store and launch Terminal
- Restart Terminal, you get prompted to do so
- After you installed Pengwin, launch it to setup your username/password
- Launch
pengwin-setup
. Select GUI, then GUILIB from the the Menu. And wait for installation to finish - Reopen terminal, and reopen again if prompted (this will apply guilib changes)
Your Distro is now using WSL 2. FYI: You can access the file system by typing \\wsl$
in your windows explorer’s address bar
- Open your WSL2-enabled Distro
sudo apt update
(optional)sudo apt -y upgrade
(optional)
sudo apt -y install r-base
- Verify by typing
R
in your terminal. - R will run an interactive session. Quite with
q()
wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.2.5033-amd64.deb
sudo apt -f install
(required to install .deb files)sudo dpkg -i rstudio-1.2.5033-amd64.deb
- If you get an error, try running step 2 again, and then step 3. I don’t know why, but that worked for me, after step 3 initially raised an error.
Install other GUI dependencies (Pengwin)
1. sudo apt install libnss3
2. sudo apt install libegl1-mesa
Restart terminal (twice, if prompted)
This was fixed WhitewaterFoundry/Pengwin#596
- Install X410 from the store, then launch it.
- Right click X410 in system tray an click:
- Allow Public Access
- Windowed Apps (optional)
- DPI Scaling → High Quality (optional)
Open Pengin terminal and enter rstudio
https://posit.co/download/rstudio-desktop/