<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rashil Gandhi</title>
    <description>The latest articles on DEV Community by Rashil Gandhi (@rashil2000).</description>
    <link>https://dev.to/rashil2000</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F417157%2Fa9631c7f-bfa8-4c09-a6b1-950951809b29.png</url>
      <title>DEV Community: Rashil Gandhi</title>
      <link>https://dev.to/rashil2000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rashil2000"/>
    <language>en</language>
    <item>
      <title>Setting up Arch Linux with KDE Plasma in Windows Subsystem for Linux 2</title>
      <dc:creator>Rashil Gandhi</dc:creator>
      <pubDate>Fri, 11 Dec 2020 09:09:28 +0000</pubDate>
      <link>https://dev.to/rashil2000/setting-up-arch-linux-with-kde-plasma-in-windows-subsystem-for-linux-2-5fgj</link>
      <guid>https://dev.to/rashil2000/setting-up-arch-linux-with-kde-plasma-in-windows-subsystem-for-linux-2-5fgj</guid>
      <description>&lt;p&gt;Yup, you read that right. Sounds crazy, I know. But entirely possible, and surprisingly usable. Pretty easy too. &lt;/p&gt;

&lt;h3&gt;
  
  
  Enabling Windows Subsystem for Linux
&lt;/h3&gt;

&lt;p&gt;Follow this official guide - &lt;a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10" rel="noopener noreferrer"&gt;Windows Subsystem for Linux Installation Guide for Windows 10&lt;/a&gt; - to enable WSL on Windows. Make sure you follow till step 5 of the manual method to have WSL2 as default. Everything is explained in great detail in the guide. &lt;/p&gt;

&lt;p&gt;Now, there are two ways to install Arch - the first one is extremely easy and preferable, and the second is for those who like to have more fine-grain control over stuff.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Arch Linux - Method I
&lt;/h3&gt;

&lt;p&gt;Arch Linux used to be an official app on the Windows Store some time ago, but the Arch community isn't onboard with the concept of WSL, or they aren't exactly comfortable with how easy WSL makes Linux installations for Windows users. Not to worry though, since both Arch Linux and the WSL kernel are open source, you can just easily install it manually too. Follow the steps given in this short guide &lt;a href="https://wsldl-pg.github.io/ArchW-docs/How-to-Setup/" rel="noopener noreferrer"&gt;How to Setup | ArchWSL Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Arch Linux - Method II
&lt;/h3&gt;

&lt;p&gt;We will use a tool called &lt;a href="https://github.com/DDoSolitary/LxRunOffline" rel="noopener noreferrer"&gt;LxRunOffline&lt;/a&gt; to install and manage WSLs on our system. Open up Administrator CMD and run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;%USERPROFILE%&lt;/span&gt;\Downloads
&lt;span class="nb"&gt;curl&lt;/span&gt; &lt;span class="na"&gt;-LO &lt;/span&gt;&lt;span class="kd"&gt;https&lt;/span&gt;://github.com/DDoSolitary/LxRunOffline/releases/download/v3.5.0/LxRunOffline&lt;span class="na"&gt;-v&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;.5.0&lt;span class="na"&gt;-msvc&lt;/span&gt;.zip
&lt;span class="kd"&gt;powershell&lt;/span&gt; &lt;span class="na"&gt;-c &lt;/span&gt;&lt;span class="kd"&gt;Expand&lt;/span&gt;&lt;span class="na"&gt;-Archive &lt;/span&gt;&lt;span class="kd"&gt;LxRunOffline&lt;/span&gt;&lt;span class="na"&gt;-v&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;.5.0&lt;span class="na"&gt;-msvc&lt;/span&gt;.zip
&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="kd"&gt;LxRunOffline&lt;/span&gt;&lt;span class="na"&gt;-v&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;.5.0&lt;span class="na"&gt;-msvc
&lt;/span&gt;&lt;span class="nb"&gt;copy&lt;/span&gt; &lt;span class="kd"&gt;LxRunOffline&lt;/span&gt;&lt;span class="err"&gt;.exe&lt;/span&gt; &lt;span class="kd"&gt;C&lt;/span&gt;:\Windows
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last line copies the &lt;code&gt;LxRunOffline.exe&lt;/code&gt; file to a location which is included in &lt;strong&gt;PATH&lt;/strong&gt; environment variable, so that we can call this from anywhere. Here, for example, it copies this to 'C:\Windows' (this is why elevated access is required).&lt;/p&gt;

&lt;p&gt;Now, we have to download Arch rootfs. In CMD, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;%USERPROFILE%&lt;/span&gt;\Downloads
&lt;span class="nb"&gt;curl&lt;/span&gt; &lt;span class="na"&gt;-LO &lt;/span&gt;&lt;span class="kd"&gt;https&lt;/span&gt;://mirrors.edge.kernel.org/archlinux/iso/2020.12.01/archlinux&lt;span class="na"&gt;-bootstrap&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="m"&gt;2020&lt;/span&gt;.12.01&lt;span class="na"&gt;-x&lt;/span&gt;&lt;span class="m"&gt;86&lt;/span&gt;_64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the download is complete, we can instruct LxRunOffline to start the extraction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="kd"&gt;D&lt;/span&gt;:\WSL\Arch
&lt;span class="kd"&gt;LxRunOffline&lt;/span&gt; &lt;span class="kd"&gt;i&lt;/span&gt; &lt;span class="na"&gt;-n &lt;/span&gt;&lt;span class="kd"&gt;Arch&lt;/span&gt; &lt;span class="na"&gt;-d &lt;/span&gt;&lt;span class="kd"&gt;D&lt;/span&gt;:\WSL\Arch\ &lt;span class="na"&gt;-f &lt;/span&gt;&lt;span class="nv"&gt;%USERPROFILE%&lt;/span&gt;\Downloads\archlinux&lt;span class="na"&gt;-bootstrap&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="m"&gt;2020&lt;/span&gt;.12.01&lt;span class="na"&gt;-x&lt;/span&gt;&lt;span class="m"&gt;86&lt;/span&gt;_64.tar.gz &lt;span class="na"&gt;-r &lt;/span&gt;&lt;span class="kd"&gt;root&lt;/span&gt;.x86_64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of 'D:\WSL\Arch\', you can specify any location path. Also, make sure the path doesn't have any spaces (Linux doesn't like spaces). This can take a bit of time.&lt;/p&gt;

&lt;p&gt;After that, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;wsl&lt;/span&gt; &lt;span class="na"&gt;--set-version &lt;/span&gt;&lt;span class="kd"&gt;Arch&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;span class="kd"&gt;wsl&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="na"&gt;-d &lt;/span&gt;&lt;span class="kd"&gt;Arch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, Arch is installed as an instance of WSL1. We don't want that, so the first line fixes that. The second line runs the Arch distribution (the '~' tells it to open in the default home directory).&lt;/p&gt;

&lt;p&gt;Now the rootfs we downloaded was an absolute minimal install, and includes nothing by default. To add to the problem, the package manager &lt;code&gt;pacman&lt;/code&gt; wouldn't run because all the mirrors in '/etc/pacman.d/mirrorlist' are commented by default, and we don't even have a text editor to uncomment them! To fix this, we just open it in notepad (life hack!):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;notepad.exe /etc/pacman.d/mirrorlist
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uncomment the three worldwide mirrors (or the ones based on your location). After that, we will install the basic utilities and a terminal text editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pacman-key &lt;span class="nt"&gt;--init&lt;/span&gt;
pacman-key &lt;span class="nt"&gt;--populate&lt;/span&gt; archlinux
pacman &lt;span class="nt"&gt;-Sy&lt;/span&gt; base base-devel nano
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we'd want to add a non-root user. Run the following to create a user &lt;em&gt;username&lt;/em&gt; and give it a password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;useradd &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="nt"&gt;-G&lt;/span&gt; wheel username
passwd username
&lt;span class="nv"&gt;EDITOR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nano visudo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, uncomment the line that says &lt;code&gt;%wheel ALL=(ALL) ALL&lt;/code&gt;, save and exit the editor.&lt;/p&gt;

&lt;p&gt;Exit Arch. To make this new user the default user of Arch, run this in CMD:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;LxRunOffline&lt;/span&gt; &lt;span class="kd"&gt;su&lt;/span&gt; &lt;span class="na"&gt;-n &lt;/span&gt;&lt;span class="kd"&gt;Arch&lt;/span&gt; &lt;span class="na"&gt;-v &lt;/span&gt;&lt;span class="m"&gt;1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next time you start Arch, it'll start as &lt;em&gt;username&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing KDE Plasma
&lt;/h3&gt;

&lt;p&gt;After you've created a non-root user, run the following commands in Arch's bash shell to update existing packages and install the KDE Plasma desktop environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;pacman &lt;span class="nt"&gt;-Syu&lt;/span&gt; plasma
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now there are multiple ways of enabling displays in WSL2 - X display forwarding, Virtual Network Computing and Remote Desktop Protocol. We'll cover two of them, first X and second VNC. While I was able to set up RDP connections in Debian-based WSLs, I couldn't get it to work in Arch. &lt;/p&gt;

&lt;p&gt;The first method is extremely easy - just a few clicks - and doesn't involve inputting commands. However, it might not be as responsive and reliable (when you might have multiple WSL distros) as the second. The second method requires heavy use of the commandline - for installing packages and editing configs. &lt;/p&gt;

&lt;h3&gt;
  
  
  Enabling GUI display - Method I
&lt;/h3&gt;

&lt;p&gt;Configuring a proper X-server for WSL was always a pain, until now. Enter &lt;a href="https://opticos.github.io/gwsl/" rel="noopener noreferrer"&gt;GWSL&lt;/a&gt;, a preconfigured X-server that uses &lt;a href="https://sourceforge.net/projects/vcxsrv/" rel="noopener noreferrer"&gt;VcXsrv&lt;/a&gt; under the hood. Since it is a general purpose X-server, it can be used for making graphical SSH connections, launching individual Linux apps and other cool stuff. Here we'll just press a couple of buttons to start KDE in Arch. &lt;/p&gt;

&lt;h4&gt;
  
  
  First run
&lt;/h4&gt;

&lt;p&gt;Go to the Store &lt;a href="https://www.microsoft.com/en-us/p/gwsl/9nl6kd1h33v3" rel="noopener noreferrer"&gt;page&lt;/a&gt; or pull down the latest release from its releases &lt;a href="https://github.com/Opticos/GWSL-Source/releases/" rel="noopener noreferrer"&gt;page&lt;/a&gt; and install it. Upon first launch, it'll ask for Firewall permissions; give it both Public and Private access. Once that's done, right click on the icon on the taskbar and set the Default Window Mode to 'Single Window Mode'. This is done because we want to launch the DE as a whole; this can be skipped if you just want to run Linux app GUIs in their own separate windows, through the Linux apps option in GWSL dashboard (after exporting the display variable).&lt;/p&gt;

&lt;h4&gt;
  
  
  Export environment variable
&lt;/h4&gt;

&lt;p&gt;Once that's done, left-click on the same icon to pull up the GWSL Dashboard. From there, select GWSL Distro Tools (and select Arch from there if you have multiple distros). Click on 'Auto-Export Display'. It'll automatically restart Arch for the changes to take effect. &lt;/p&gt;

&lt;h4&gt;
  
  
  Command shortcut
&lt;/h4&gt;

&lt;p&gt;Now we need to tell GWSL how to launch KDE. Open up the dashboard again and select Shortcut Creator. In this window: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Put a name of your choice in the 'Shortcut Label' field, for example &lt;code&gt;KDE-Plasma&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The 'Shortcut Command' is &lt;code&gt;dbus-launch startplasma-x11&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For the 'Run In' field, select &lt;code&gt;Arch&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click on 'Add this to Start menu' to finish. &lt;/p&gt;

&lt;p&gt;Now launch this shortcut from the Start menu, and focus on the VcXsrv window. Viola, we're in Plasma! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fapi.rashil2000.me%2Fimages%2Fblogs%2Fkde-arch-wsl%2FScreenshot_20201211_140037.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fapi.rashil2000.me%2Fimages%2Fblogs%2Fkde-arch-wsl%2FScreenshot_20201211_140037.png" alt="GWSL method"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Enabling GUI display - Method II
&lt;/h3&gt;

&lt;p&gt;VNC allows us to send input and receive graphical output over a network, and we'll use TigerVNC server on our Arch subsystem  and TigerVNC client on our Windows host system. &lt;/p&gt;

&lt;h4&gt;
  
  
  Configuring systemd
&lt;/h4&gt;

&lt;p&gt;Arch Linux allows running VNC servers only as a system service, so we'll have to make sure we have a usable systemd. This is also mentioned as an optional step in the &lt;a href="https://wsldl-pg.github.io/ArchW-docs/How-to-Setup/#install-systemctl-alternative-optional/" rel="noopener noreferrer"&gt;How to Setup | ArchWSL Documentation&lt;/a&gt; page. We'll use &lt;a href="https://github.com/arkane-systems/genie" rel="noopener noreferrer"&gt;genie&lt;/a&gt; in this tutorial. &lt;/p&gt;

&lt;p&gt;Installing genie would have been a lot easier, but unfortunately, because of reasons aforementioned, genie was pulled down from AUR. We can download and install the PKGBUILD (&lt;a href="https://gist.github.com/arlllk/7001c521de601f01735af5ca440f03ae" rel="noopener noreferrer"&gt;source&lt;/a&gt;) manually. The original PKGBUILD file has some license file issue, so I've modified the file and we'll use that. Run the following in bash:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;pacman &lt;span class="nt"&gt;-S&lt;/span&gt; base-devel
curl &lt;span class="nt"&gt;-Lo&lt;/span&gt; PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h&lt;span class="o"&gt;=&lt;/span&gt;daemonize
makepkg &lt;span class="nt"&gt;-si&lt;/span&gt;
&lt;span class="nb"&gt;rm &lt;/span&gt;PKGBUILD
curl &lt;span class="nt"&gt;-Lo&lt;/span&gt; PKGBUILD https://gist.githubusercontent.com/rashil2000/f148d5fd207eb30c43f269dcd4f7c6fb/raw/73db1b0a14634c23b35a01168b5068aee877b74c/PKGBUILD-release
makepkg &lt;span class="nt"&gt;-si&lt;/span&gt;
&lt;span class="nb"&gt;rm &lt;/span&gt;PKGBUILD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first command installs the packages needed to build other packages manually (you might get a warning regarding fakeroot, press 'n' for that). The next three commands install &lt;a href="http://software.clapper.org/daemonize/" rel="noopener noreferrer"&gt;daemonize&lt;/a&gt;, a dependency for genie. The last three install genie itself, from my modified PKGBUILD. &lt;/p&gt;

&lt;h4&gt;
  
  
  Installing VNC server
&lt;/h4&gt;

&lt;p&gt;pacman can be used to install TigerVNC server, while we can directly download and run the Windows client binary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;pacman &lt;span class="nt"&gt;-S&lt;/span&gt; tigervnc
curl &lt;span class="nt"&gt;-Lo&lt;/span&gt; ~/.local/bin/vncviewer.exe &lt;span class="nt"&gt;--create-dirs&lt;/span&gt; https://bintray.com/tigervnc/stable/download_file?file_path&lt;span class="o"&gt;=&lt;/span&gt;vncviewer64-1.11.0.exe
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ~/.local/bin/vncviewer.exe
vncpasswd
&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/tigervnc/vncserver.users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should immediately set a password for your VNC server using &lt;code&gt;vncpasswd&lt;/code&gt; (you can skip view-only password). The last command opens up a config. file where you need to put a new line saying &lt;code&gt;:1={username}&lt;/code&gt;, where username is the name of the non-root user you set earlier (remove the braces). See the examples given in that file if you're confused.&lt;/p&gt;

&lt;h4&gt;
  
  
  Running VNC client
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;genie &lt;span class="nt"&gt;-i&lt;/span&gt;
genie &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start vncserver@:1
~/.local/bin/vncviewer.exe &lt;span class="nt"&gt;-passwd&lt;/span&gt; ~/.vnc/passwd 127.0.0.1:1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first command enables systemd. The second one starts up the VNC server as a service at the first VNC port. The third connects the Windows client to that server.&lt;/p&gt;

&lt;p&gt;Viola, again! You'll have to run these three commands every time you'd like to spin up the GUI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fapi.rashil2000.me%2Fimages%2Fblogs%2Fkde-arch-wsl%2FScreenshot%2520%2847%29.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fapi.rashil2000.me%2Fimages%2Fblogs%2Fkde-arch-wsl%2FScreenshot%2520%2847%29.png" alt="VNC method"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Enabling audio forwarding
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;coming soon&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Again this is something that I was able to do only in Debian-based distros, through &lt;a href="https://en.m.wikipedia.org/wiki/PulseAudio" rel="noopener noreferrer"&gt;PulseAudio&lt;/a&gt; server. No luck in Arch yet... &lt;/p&gt;




&lt;h6&gt;
  
  
  This tutorial has been tested (somewhat) widely - on a 10-year-old PC, a modern gaming laptop and a current-gen Macbook (through Bootcamp).
&lt;/h6&gt;

</description>
      <category>archlinux</category>
      <category>kde</category>
      <category>wsl</category>
      <category>windows</category>
    </item>
  </channel>
</rss>
