<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>windows &amp;mdash; Arturo Linares</title>
    <link>https://arturo.linar.es/tag:windows</link>
    <description></description>
    <pubDate>Fri, 19 Jun 2026 10:32:57 +0000</pubDate>
    <item>
      <title>What would make WSL2 perfect for PHP development?</title>
      <link>https://arturo.linar.es/what-would-make-wsl2-perfect-for-php-development?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[I&#39;ve been using WSL2 to develop Drupal sites for some months now, and it has been a surprise to me how well it works. I have native Linux speed and great tools (I use Sublime through X server and VS Code).&#xA;!--more--&#xA;However, there&#39;s a small issue that if solved, would make the development experience perfect: DNS resolution to dev environments. I&#39;ll describe how I work to illustrate what I mean with this.&#xA;&#xA;I use Docksal to manage all my development environments on a WSL2 distribution using docker. So, to create a new Laravel project I would normally do this:&#xA;&#xA;From there I can access the project using the generated local address from Linux. Docksal uses dnsmasq to resolve these addresses:&#xA;&#xA;$ curl http://helloworld.docksal&#xA;!DOCTYPE html&#xA;html lang=&#34;en&#34;&#xA;    head&#xA;        meta charset=&#34;utf-8&#34;&#xA;        meta name=&#34;viewport&#34; content=&#34;width=device-width, initial-scale=1&#34;&#xA;...&#xA;&#xA;However, I cannot access that address from Windows. What I&#39;ve been doing until now is to add an entry in my Windows hosts file to redirect these new address to localhost:&#xA;&#xA;127.0.0.1     helloworld.docksal&#xA;&#xA;But once I added this entry, the site is still not accessible from Windows. I need to run a powershell script that I took from a github issue to create firewall rules, so I can actually access it.&#xA;&#xA;I haven&#39;t found a solution for this yet, but what I would love to see is:&#xA;&#xA;The local address created in Linux doesn&#39;t require me to add a hosts entry in Windows.&#xA;The firewall rules are automatically updated to allow access.&#xA;&#xA;Installing a custom DNS entry&#xA;&#xA;To solve the first issue I tried to use a custom DNS proxy (Acrylic) to redirect all .docksal addresses back to localhost, like I&#39;m doing with the hosts file. But when I try to execute the server it fails to start because UDP port is already in use:&#xA;&#xA;2020-02-12 10:29:00.233 [E] TDnsResolver.Execute: TDualUdpServerCommunicationChannel.Bind: Binding to IPv4 address failed with Windows Sockets error code 10048.&#xA;&#xA;What is using port 53 (the standard DNS port)? I used tcpview to find out. &#xA;&#xA;It looks it is svchost. Using the PID and the Process Explorer I found that it was related to a service called Shared Access.&#xA;&#xA;I had walked so far to stop digging now, so I opened the services and looked for ICS (maybe the initials for Internet Connection Sharing in English) and found it was configured to start manually.&#xA;&#xA;I was feeling brave and tried to stop it, but I couldn&#39;t do it. It refused to stop with an error dialog that said (in a loose translation): &#34;Windows couldn&#39;t stop the service in the local computer&#34;. Nice. I switched the service to Disabled* and decided to reboot. Upon reboot, it was enabled again, set to start in &#34;Manual&#34; mode. So no luck so far to enable a custom DNS Proxy.&#xA;&#xA;Enabling the firewall by default&#xA;&#xA;I&#39;m running the script I found in github manually when I can&#39;t access the sites in WSL2 (normally after a reboot), and since I don&#39;t often reboot I could keep doing it.&#xA;&#xA;I don&#39;t know if the script  creates security issues, but I if I get tired of running it manually I could configure it to run every time I boot or every hour even. &#xA;&#xA;Update 2021-04-28: It is possible to run the script from WSL2. Since I&#39;musing fish shell, I created the alias winfirewall to run it:&#xA;&#xA;alias --save winfirewall &#39;powershell.exe start-process PowerShell -verb runas &#34;C:\Users\alinares\firewall_rules.ps1&#34;&#39;&#xA;&#xA;#windows #wsl]]&gt;</description>
      <content:encoded><![CDATA[<p>I&#39;ve been using WSL2 to develop Drupal sites for some months now, and it has been a surprise to me how well it works. I have native Linux speed and great tools (I use Sublime through X server and VS Code).

However, there&#39;s a small issue that if solved, would make the development experience perfect: <strong>DNS resolution to dev environments</strong>. I&#39;ll describe how I work to illustrate what I mean with this.</p>

<p>I use <a href="https://docksal.io" rel="nofollow">Docksal</a> to manage all my development environments on a WSL2 distribution using docker. So, to create a new Laravel project I would normally do this:</p>

<p><img src="https://i.snap.as/9j7tIIc.image" alt=""/></p>

<p>From there I can access the project using the generated local address <strong>from Linux</strong>. <a href="https://docs.docksal.io/core/system-dns/" rel="nofollow">Docksal uses dnsmasq</a> to resolve these addresses:</p>

<pre><code>$ curl http://helloworld.docksal
&lt;!DOCTYPE html&gt;
&lt;html lang=&#34;en&#34;&gt;
    &lt;head&gt;
        &lt;meta charset=&#34;utf-8&#34;&gt;
        &lt;meta name=&#34;viewport&#34; content=&#34;width=device-width, initial-scale=1&#34;&gt;
...
</code></pre>

<p>However, I cannot access that address from Windows. What I&#39;ve been doing until now is to add an entry in my Windows <code>hosts</code> file to redirect these new address to localhost:</p>

<pre><code>127.0.0.1     helloworld.docksal
</code></pre>

<p>But once I added this entry, the site is still not accessible from Windows. I need to run a powershell script that I took from a <a href="https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723" rel="nofollow">github issue</a> to create firewall rules, so I can actually access it.</p>

<p><img src="https://i.snap.as/LYWPUI0.png" alt=""/></p>

<p>I haven&#39;t found a solution for this yet, but what I would love to see is:</p>
<ol><li>The local address created in Linux doesn&#39;t require me to add a hosts entry in Windows.</li>
<li>The firewall rules are automatically updated to allow access.</li></ol>

<h2 id="installing-a-custom-dns-entry" id="installing-a-custom-dns-entry">Installing a custom DNS entry</h2>

<p>To solve the first issue I tried to use a custom DNS proxy (<a href="https://mayakron.altervista.org/support/acrylic/Home.htm" rel="nofollow">Acrylic</a>) to redirect all <code>*.docksal</code> addresses back to localhost, like I&#39;m doing with the hosts file. But when I try to execute the server it fails to start because UDP port is already in use:</p>

<pre><code>2020-02-12 10:29:00.233 [E] TDnsResolver.Execute: TDualUdpServerCommunicationChannel.Bind: Binding to IPv4 address failed with Windows Sockets error code 10048.
</code></pre>

<p>What is using port 53 (the standard DNS port)? I used <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/tcpview" rel="nofollow">tcpview</a> to find out.</p>

<p><img src="https://i.snap.as/j17rMRc.image" alt=""/></p>

<p>It looks it is <code>svchost</code>. Using the <strong>PID</strong> and the <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer" rel="nofollow">Process Explorer</a> I found that it was related to a service called <strong>Shared Access</strong>.</p>

<p><img src="https://i.snap.as/JGFsCGu.png" alt=""/></p>

<p>I had walked so far to stop digging now, so I opened the services and looked for <em>ICS</em> (maybe the initials for <em>Internet Connection Sharing</em> in English) and found it was configured to start manually.</p>

<p><img src="https://i.snap.as/ihhsMKM.png" alt=""/></p>

<p>I was feeling brave and tried to stop it, but I couldn&#39;t do it. It refused to stop with an error dialog that said (in a loose translation): “Windows couldn&#39;t stop the service in the local computer”. Nice. I switched the service to <em>Disabled</em> and decided to reboot. Upon reboot, it was enabled again, set to start in “Manual” mode. So no luck so far to enable a custom DNS Proxy.</p>

<h2 id="enabling-the-firewall-by-default" id="enabling-the-firewall-by-default">Enabling the firewall by default</h2>

<p>I&#39;m running the script I found <a href="https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723" rel="nofollow">in github</a> manually when I can&#39;t access the sites in WSL2 (normally after a reboot), and since I don&#39;t often reboot I could keep doing it.</p>

<p>I don&#39;t know if the script  creates security issues, but I if I get tired of running it manually I could configure it to run every time I boot or every hour even.</p>

<p><strong>Update 2021-04-28</strong>: It is possible to run the script from WSL2. Since I&#39;musing fish shell, I created the alias <code>winfirewall</code> to run it:</p>

<pre><code>alias --save winfirewall &#39;powershell.exe start-process PowerShell -verb runas &#34;C:\Users\alinares\firewall_rules.ps1&#34;&#39;
</code></pre>

<p><a href="https://arturo.linar.es/tag:windows" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">windows</span></a> <a href="https://arturo.linar.es/tag:wsl" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">wsl</span></a></p>
]]></content:encoded>
      <guid>https://arturo.linar.es/what-would-make-wsl2-perfect-for-php-development</guid>
      <pubDate>Sat, 01 Aug 2020 19:36:55 +0000</pubDate>
    </item>
    <item>
      <title>Transcode a video using a context menu on Windows</title>
      <link>https://arturo.linar.es/transcode-a-video-using-a-context-menu-on-windows?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[#windows&#xA;&#xA;I&#39;m using the game bar to create quick screencasts. The only problem is that the videos are too big to show only a few clicks. So, to quickly optimize a video for sharing I need to transcode it as easy as possible. &#xA;&#xA;Updated with a new windows native tool.&#xA;!--more--&#xA;Creating a context menu in explorer would be ideal. This menu action will execute VLC to transcode the video.&#xA;&#xA;I&#39;m using this tool to easily create a context menu:&#xA;&#xA;FileActionsManager&#xA;&#xA;The paths need to be adjusted we&#39;re on Windows and VLC is a ported application. So I wrote a script to handle that (in PHP because I have it installed it and I don&#39;t know anything about PowerShell):&#xA;&#xA;if (!isset($argv[1])) {&#xA;  echo &#34;Usage: {$argv[0]} video&#34;;&#xA;  die;&#xA;}&#xA;$path = $argv[1];&#xA;$path = strreplace(&#39;\\&#39;, &#39;/&#39;, $path);&#xA;$path = pregreplace(&#39;/^C:/&#39;, &#39;&#39;, $path);&#xA;&#xA;$cmd = &lt;&lt;&lt;CMD&#xA;&#34;C:\\Program Files\\VideoLAN\\VLC\\vlc.exe&#34; &#34;-I dummy&#34; &#34;%s&#34; &#34;:sout=#transcode{vcodec=h264,scale=Automático,width=720,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:std{access=file{no-overwrite},mux=mp4,dst=&#39;%s-small.mp4&#39;}&#34; &#34;vlc://quit&#34;&#xA;CMD;&#xA;$cmd = sprintf($cmd, $argv[1], $path);&#xA;system($cmd);&#xA;&#xA;To actually create the menu entry that runs the php script, run:&#xA;&#xA;FileActionsConsole.exe add mp4 compress_video &#34;Compress Video (720p)&#34; &#34;\&#34;C:\tools\php74\php.exe\&#34; \&#34;/Users/user/bin/compress-video.php\&#34; \&#34;%1\&#xA;&#34;&#34;&#xA;&#xA;---&#xA;&#xA;Update (2020-08-26): I had to wipe my windows partition and decided to write a native tool to implement this. You can find it here.&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p><code>#windows</code></p>

<p><img src="https://i.snap.as/2vjJZvZ.png" alt=""/></p>

<p>I&#39;m using the game bar to create quick screencasts. The only problem is that the videos are too big to show only a few clicks. So, to quickly optimize a video for sharing I need to transcode it as easy as possible.</p>

<p><strong>Updated with a new windows native tool.</strong>

Creating a context menu in explorer would be ideal. This menu action will execute VLC to transcode the video.</p>

<p>I&#39;m using this tool to easily create a context menu:</p>

<p><a href="https://github.com/ORelio/FileActionsManager" rel="nofollow">FileActionsManager</a></p>

<p>The paths need to be adjusted we&#39;re on Windows and VLC is a ported application. So I wrote a script to handle that (in PHP because I have it installed it and I don&#39;t know anything about PowerShell):</p>

<pre><code class="language-php">if (!isset($argv[1])) {
  echo &#34;Usage: {$argv[0]} &lt;video&gt;&#34;;
  die;
}
$path = $argv[1];
$path = str_replace(&#39;\\&#39;, &#39;/&#39;, $path);
$path = preg_replace(&#39;/^C:/&#39;, &#39;&#39;, $path);

$cmd = &lt;&lt;&lt;CMD
&#34;C:\\Program Files\\VideoLAN\\VLC\\vlc.exe&#34; &#34;-I dummy&#34; &#34;%s&#34; &#34;:sout=#transcode{vcodec=h264,scale=Automático,width=720,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:std{access=file{no-overwrite},mux=mp4,dst=&#39;%s-small.mp4&#39;}&#34; &#34;vlc://quit&#34;
CMD;
$cmd = sprintf($cmd, $argv[1], $path);
system($cmd);
</code></pre>

<p>To actually create the menu entry that runs the php script, run:</p>

<pre><code>FileActionsConsole.exe add mp4 compress_video &#34;Compress Video (720p)&#34; &#34;\&#34;C:\tools\php74\php.exe\&#34; \&#34;/Users/user/bin/compress-video.php\&#34; \&#34;%1\
&#34;&#34;
</code></pre>

<hr/>

<p><strong>Update (2020-08-26)</strong>: I had to wipe my windows partition and decided to write a native tool to implement this. You can find it <a href="https://github.com/arturolinares/VideoCompressMenu" rel="nofollow">here</a>.</p>
]]></content:encoded>
      <guid>https://arturo.linar.es/transcode-a-video-using-a-context-menu-on-windows</guid>
      <pubDate>Wed, 29 Jul 2020 04:02:51 +0000</pubDate>
    </item>
    <item>
      <title>Windows running on a Linux kernel?</title>
      <link>https://arturo.linar.es/windows-running-linux-kernel?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[windows &#xA;&#xA;Surfae Duo&#xA;&#xA;This week Microsoft unveiled their Surface Phone, called Surface Duo. It looks great and I think it puts the company back in the innovators list.&#xA;!--more--&#xA;But the fact that the Duo runs on Android is not easy to digest. Some people think that Microsoft soon will make a Windows version that runs on a Linux kernel. Although it might be nothing more than crazy theories, they make sense when Nadella says that the operative system is not that important for Microsoft any more:&#xA;&#xA;  The operating system is no longer the most important layer for us. What is most important for us is the app model and the experience.&#xA;&#xA;To add more fuel to the conspiracy theory, Intel has been working on a highly optimized Linux distro (for Intel architecture of course) called Clear Linux.&#xA;&#xA;  Remember when I&#39;ve said that my money is on Microsoft moving Windows to a Linux kernel? Well, Android is based on Linux so this might be testing the waters with a mobile device first. Remember, Microsoft wants unified architecture&#xA;  🤔&#xA;  -- @Barnacules&#xA;&#xA;Intel has been focusing mainly in performance, and while you still run Gnome or other Desktop Environment on it, they have stated that their priority is performance and security.&#xA;&#xA;What if... they are waiting for a Windows that runs on a Linux kernel to finally integrate it in Clear Linux?&#xA;&#xA;Personally, a Windows that runs on a Linux kernel doesn&#39;t make sense to me. The main reasons why these rumors started was because Microsoft started opening source code, bought GitHub and, specially, WSL. But with the last case (WSL2), which allowed a Linux kernel to run on Windows, is a Windows technology, also used in Windows Sandbox. Why would they invest in this awesome technology that runs on Windows if you&#39;re about to jump off the boat.&#xA;&#xA;Another reason is that it would break backwards compatibility of many applications, something Windows has respected for many years. I know open source technologies like Wine have been making possible to run windows applications on Linux, but they are not perfect, and they certainly would have a limit. The same limit that Microsoft hit when trying to write their reversed Wine: WSL v1. Some issues like performance, networking and file system access are simply not easy to emulate.&#xA;&#xA;I guess only time will say, meanwhile it is worth to keep an eye on Clear Linux and, of course, the new foldable devices that are about to hit the market 😁]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://arturo.linar.es/tag:windows" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">windows</span></a></p>

<p><img src="https://i.snap.as/f9erLiZ.png" alt="Surfae Duo"/></p>

<p>This week Microsoft unveiled their Surface Phone, called Surface Duo. It looks great and I think it puts the company back in the innovators list.

But the fact that the Duo runs on Android is not easy to digest. Some people think that Microsoft soon will make a Windows version that runs on a Linux kernel. Although it might be nothing more than crazy theories, they make sense when Nadella says that the operative system <a href="https://www.wired.com/story/microsoft-surface-duo-neo-phone/" rel="nofollow">is not that important for Microsoft any more</a>:</p>

<blockquote><p>The operating system is no longer the most important layer for us. What is most important for us is the app model and the experience.</p></blockquote>

<p>To add more fuel to the conspiracy theory, Intel has been working on a highly optimized Linux distro (for Intel architecture of course) called <a href="https://clearlinux.org/" rel="nofollow">Clear Linux</a>.</p>

<blockquote><p>Remember when I&#39;ve said that my money is on Microsoft moving Windows to a Linux kernel? Well, Android is based on Linux so this might be testing the waters with a mobile device first. Remember, Microsoft wants unified architecture
🤔
— <a href="https://twitter.com/Barnacules/status/1179549169704304640?s=20" rel="nofollow">@Barnacules</a></p></blockquote>

<p>Intel has been focusing mainly in performance, and while you still run Gnome or other Desktop Environment on it, they have stated that their priority is performance and security.</p>

<p>What if... they are waiting for a Windows that runs on a Linux kernel to finally integrate it in Clear Linux?</p>

<p>Personally, a Windows that runs on a Linux kernel doesn&#39;t make sense to me. The main reasons why these rumors started was because Microsoft started opening source code, bought GitHub and, specially, WSL. But with the last case (WSL2), which allowed a Linux kernel to run on Windows, is a Windows technology, also used in Windows Sandbox. Why would they invest in this awesome technology that runs on Windows if you&#39;re about to jump off the boat.</p>

<p>Another reason is that it would break backwards compatibility of many applications, something Windows has respected for many years. I know open source technologies like Wine have been making possible to run windows applications on Linux, but they are not perfect, and they certainly would have a limit. The same limit that Microsoft hit when trying to write their reversed Wine: WSL v1. Some issues like performance, networking and file system access are simply not easy to emulate.</p>

<p>I guess only time will say, meanwhile it is worth to keep an eye on Clear Linux and, of course, the new foldable devices that are about to hit the market 😁</p>
]]></content:encoded>
      <guid>https://arturo.linar.es/windows-running-linux-kernel</guid>
      <pubDate>Mon, 07 Oct 2019 05:01:14 +0000</pubDate>
    </item>
    <item>
      <title>Git errors when using Hyper-V</title>
      <link>https://arturo.linar.es/git-errors-when-using-hyper-v?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[#windows #git&#xA;&#xA;I started having some issues when using git inside a Linux VM while setting up an experimental Drupal development environment. I wasn&#39;t able to clone repositories because I was getting some errors saying the remote host hanged unexpectedly, or couldn&#39;t push changes. However I was able to clone shallow repos, but strangely Bitbucket and Gitlab seemed to be more prone to these errors.&#xA;!--more--&#xA;$ git clone git@....&#xA;Cloning into &#39;somedir&#39;...&#xA;error: RPC failed; curl 56 GnuTLS recv error (-12): A TLS fatal alert has been received.&#xA;fatal: The remote end hung up unexpectedly&#xA;&#xA;At some point, disabling offloading solved the issue: Disabling Offloading on Ubuntu 18.04 with Netplan and/or systemd-networkd&#xA;&#xA;It apparently worked, but soon I found that only worked when using Github. Of course, that didn&#39;t make any sense. When I tried to push changes to Bitbucket or Gitlab I had again the same strange errors saying the remote host hung up unexpectedly.&#xA;&#xA;I tried to debug git using GITSSHCOMMAND, tried using https and even recompiled git to use OpenSSL instead of GnuTLS. Nothing seemed to work... Until I found an answer from this guy who found the solution): I needed to update my Wi-Fi drivers.&#xA;&#xA;Strange error indeed.&#xA;&#xA;TLDR: A bug between Hyper-V and my Wi-Fi card (Intel 5060) was causing this. Updating the drivers solved it:&#xA;&#xA;https://downloadcenter.intel.com/download/28876/Windows-10-Wi-Fi-Drivers-for-Intel-Wireless-Adapters?v=t]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://arturo.linar.es/tag:windows" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">windows</span></a> <a href="https://arturo.linar.es/tag:git" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">git</span></a></p>

<p><img src="https://i.snap.as/laC4Y9p.png" alt=""/></p>

<p><strong>I started having some issues when using git inside a Linux VM</strong> while setting up an <a href="https://arturo.linar.es/en/blog/drupal-development-windows" rel="nofollow">experimental Drupal development environment</a>. I wasn&#39;t able to clone repositories because I was getting some errors saying the remote host hanged unexpectedly, or couldn&#39;t push changes. However I was able to clone shallow repos, but strangely Bitbucket and Gitlab seemed to be more prone to these errors.
</p>

<pre><code>$ git clone git@....
Cloning into &#39;somedir&#39;...
error: RPC failed; curl 56 GnuTLS recv error (-12): A TLS fatal alert has been received.
fatal: The remote end hung up unexpectedly
</code></pre>

<p>At some point, disabling offloading solved the issue: <a href="https://michael.mulqueen.me.uk/2018/08/disable-offloading-netplan-ubuntu/" rel="nofollow">Disabling Offloading on Ubuntu 18.04 with Netplan and/or systemd-networkd</a></p>

<p>It apparently worked, but soon I found that only worked when using Github. Of course, that didn&#39;t make any sense. When I tried to push changes to Bitbucket or Gitlab I had again the same strange errors saying the remote host hung up unexpectedly.</p>

<p>I tried to debug git using <code>GIT_SSH_COMMAND</code>, tried using https and even recompiled git to use OpenSSL instead of GnuTLS. Nothing seemed to work... Until I found an answer from <a href="https://stackoverflow.com/a/56946337/547972" rel="nofollow">this guy who found the solution</a>): I needed to update my Wi-Fi drivers.</p>

<p>Strange error indeed.</p>

<p><strong>TLDR</strong>: A bug between Hyper-V and my Wi-Fi card (<em>Intel 5060</em>) was causing this. Updating the drivers solved it:</p>

<p><a href="https://downloadcenter.intel.com/download/28876/Windows-10-Wi-Fi-Drivers-for-Intel-Wireless-Adapters?v=t" rel="nofollow">https://downloadcenter.intel.com/download/28876/Windows-10-Wi-Fi-Drivers-for-Intel-Wireless-Adapters?v=t</a></p>
]]></content:encoded>
      <guid>https://arturo.linar.es/git-errors-when-using-hyper-v</guid>
      <pubDate>Sat, 05 Oct 2019 04:56:47 +0000</pubDate>
    </item>
    <item>
      <title>Drupal development on Windows</title>
      <link>https://arturo.linar.es/drupal-development-windows?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[#drupal #windows&#xA;&#xA;Recently I wrote on how I replaced my MacBook Pro with a PC and still being productive when developing on several Drupal environments.While PopOS! is a wonderful Linux distro, I decided to give Windows a try. The primary reasons were the usual: hardware.&#xA;!--more--&#xA;The drivers are optimized to work on Windows and some small features that are nice-to-have only work on this controversial OS: Login with an infrared camera (Windows Hello), a solid workspace with several monitors (maybe this is the most important reason), better Dolby sound from the speakers and battery optimizations. Nothing critical really, but things that improve the experience.&#xA;&#xA;What means to have a productive development environment?&#xA;&#xA;This:&#xA;&#xA;Bash command line.&#xA;Fast docker environment (without unison, I&#39;ve had enough problems with it already).&#xA;Working git&#xA;Be able to launch several development environments, fast, from command line, and use custom domain names to access them and its related services.&#xA;A good editor, like Sublime Text or Visual Studio Code. (I know, I don&#39;t use PHP Storm and don&#39;t want to).&#xA;&#xA;Since I had tried WSL before (and failed), I decided to get rid of it and move directly to install a VM.&#xA;&#xA;An Ubuntu server checks first three items in the above list, but the next two can get messy. Sharing source code files with the Windows host as a Samba share defeats the purpose because its bad performance, symlinks weirdness, among other things. Sharing it using sshfs could be an option, but then how could I control docker?&#xA;&#xA;Editor&#xA;&#xA;The solution came on a recent iteration on Visual Studio Code: Remote code extensions, specifically, Remote Coding via SSH. This extension allowed me to open remote directories through SSH and work with them. This is not like running Dreamweaver to edit files on a server (remember?). It works splitting the editor in two pieces, a client (the UI) and a server, where the indexing and language processing extensions run. The result is a very responsive editor, while working remotely with all the extensions I would normally use. Even the integrated terminal in the editor opens automatically a bash prompt in the server, a really useful feature.&#xA;&#xA;This remote feature in Visual Studio Code gives me the full Linux experience right from the editor.&#xA;&#xA;However, I normally access docker websites using custom URLs, a pretty common practice. If using docksal, for example: super-awesome-client.docksal, db.super-awesome-client.docksal, etc., you get the idea. I needed to find a way to re-route custom URLs to my VM.&#xA;&#xA;Networking&#xA;&#xA;On a Mac or on Linux this would work out of the box after installing docksal (or lando or whatever docker wrapper you use). I wanted this to work the same way:&#xA;&#xA;I didn&#39;t want to configure each custom website manually&#xA;This had to work on new sites created with docksal&#xA;Should work on any network&#xA;&#xA;To achieve this transparent routing, I needed a static IP for the VM, so I could always reference it if I was at home, at a coffee shop, or in an airport. I&#39;m using Hyper-v, so I created a NAT using the instructions below:&#xA;&#xA;Windows 10: How to setup NAT network for Hyper-V guests?br&#xA;br&#xA;Then in the VM, configured the static IP address using netplan, created file /etc/netplan/01-netcfg.yaml (I used the same IP address as the guide to create the NAT above).&#xA;&#xA;network:&#xA;    ethernets:&#xA;        eth0:&#xA;            dhcp4: no&#xA;            dhcp6: no&#xA;            addresses: [192.168.200.11/24]&#xA;            gateway4: 192.168.200.1&#xA;            nameservers:&#xA;                addresses: [8.8.8.8]&#xA;&#xA;After enabling the ssh server in the VM, and configuring my ssh keys I was able to jump into the server from Windows very quickly, or even configure ConEmu or the new Windows Terminal to automatically connect to ssh.&#xA;&#xA;To access the web servers running in docker containers created with docksal, I installed a DNS proxy: Acrylic DNS Proxy, and used this hosts configuration:&#xA;&#xA;192.168.200.11 *.docksal&#xA;&#xA;Visual Studio Code Configuration&#xA;&#xA;In Visual Studio Code I installed the Remote Development extensions for SSH. The configuration was straight forward and worked really well (the extension guides you until you are successfully connected to a SSH server).&#xA;&#xA;Huge Drupal projects were indexed really fast and the performance when browsing them was like working on Linux. Debugging worked out of the box (this thanks to Docksal configs, but still, using docker-compose shouldn&#39;t be a problem).&#xA;&#xA;The only downside I&#39;ve found is that I can&#39;t commit, push or pull using the editor, which is not a big deal since I can use the integrated terminal. From the documentation:&#xA;&#xA;  If you clone a Git repository using SSH and your SSH key has a passphrase, VS Code&#39;s pull and sync features may hang when running remotely. Either use an SSH key without a passphrase, clone using HTTPS, or run git push from the command line to work around the issue.&#xA;&#xA;I ended up creating an SSH key for my repos without a passphrase.&#xA;&#xA;Recap&#xA;&#xA;Working on PHP natively on Windows it is still impossible, but using a VM and Visual Studio Code with Remote Code extensions works very well, with the price of more memory usage, but memory is cheap now, and that is one of the reasons I left Apple in the first place: to have an upgradable development computer.&#xA;&#xA;One unexpected bonus is that I can recover from suspend and the VM will load up with all services that were running, something that in Linux didn&#39;t happen; I had to to run fin up or docker-compose up again after the laptop woke.&#xA;&#xA;Aside: WSL2&#xA;&#xA;The Windows Subsystem for Linux v2 is about_ to be released, which uses a custom Linux Kernel in a very lightweight VM (it is already in Windows Internals fast ring, but expected to reach public release until 2020).&#xA;&#xA;In theory, it has all the same good points of this setup with a VM, and seems so be a great setup for a future development environment because of these:&#xA;&#xA;The VM file system can be accessed directly from Windows using a p9 file system (that alone is awesome).&#xA;The performance is very close to native one.&#xA;Shared memory and processor cores.&#xA;Much tighter integration, it is possible to run windows programs from within the VM.&#xA;&#xA;This technology can really change the development experience on Windows, lets see if it is up to the expectations when it is released (because I won&#39;t subscribe to the fast ring in my main development computer).&#xA;&#xA;Stranger things&#xA;&#xA;While setting the environment I found an error that didn&#39;t allow me to clone big repos or to push changes. It turned out to be a bug in my WiFi drivers. So if you find the error below and have an Intel WiFi card, update your drivers.&#xA;&#xA;$ git clone git@somrerepo-bla-bla.git&#xA;Cloning into &#39;somedir&#39;...&#xA;error: RPC failed; curl 56 GnuTLS recv error (-12): A TLS fatal alert has been received.&#xA;fatal: The remote end hung up unexpectedly&#xA;&#xA;`]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://arturo.linar.es/tag:drupal" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">drupal</span></a> <a href="https://arturo.linar.es/tag:windows" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">windows</span></a></p>

<p><img src="https://user.fm/files/v2-44bb602b05cc72314032900b5c5dba15/image_5.png" alt=""/></p>

<p>Recently I wrote on how I replaced my MacBook Pro with a PC and still being productive when developing on several Drupal environments.While <a href="https://system76.com/pop" rel="nofollow">Pop_OS!</a> is a wonderful Linux distro, I decided to give Windows a try. The primary reasons were the usual: hardware.

The drivers are optimized to work on Windows and some small features that are nice-to-have only work on this controversial OS: Login with an infrared camera (<em>Windows Hello</em>), a solid workspace with several monitors (maybe this is the most important reason), better Dolby sound from the speakers and battery optimizations. Nothing critical really, but things that improve the experience.</p>

<h2 id="what-means-to-have-a-productive-development-environment" id="what-means-to-have-a-productive-development-environment">What means to have a productive development environment?</h2>

<p>This:</p>
<ol><li>Bash command line.</li>
<li>Fast docker environment (without unison, I&#39;ve had enough problems with it already).</li>
<li>Working git</li>
<li>Be able to launch several development environments, fast, from command line, and use custom domain names to access them and its related services.</li>
<li>A good editor, like Sublime Text or Visual Studio Code. (I know, I don&#39;t use PHP Storm and don&#39;t want to).</li></ol>

<p>Since I had tried WSL before (and failed), I decided to get rid of it and move directly to install a VM.</p>

<p>An Ubuntu server checks first three items in the above list, but the next two can get messy. Sharing source code files with the Windows host as a Samba share defeats the purpose because its bad performance, symlinks weirdness, among other things. Sharing it using <code>sshfs</code> could be an option, but then how could I control docker?</p>

<h2 id="editor" id="editor">Editor</h2>

<p>The solution came on a recent iteration on Visual Studio Code: <strong>Remote code extensions</strong>, specifically, <strong>Remote Coding via SSH</strong>. This extension allowed me to open remote directories through SSH and work with them. This is not like running Dreamweaver to edit files on a server (remember?). <strong>It works splitting the editor in two pieces, a client (the UI) and a server</strong>, where the indexing and language processing extensions run. The result is a very responsive editor, while working <em>remotely</em> with all the extensions I would normally use. Even the integrated terminal in the editor opens automatically a bash prompt in the server, a really useful feature.</p>

<p>This remote feature in Visual Studio Code gives me the full Linux experience right from the editor.</p>

<p>However, I normally access docker websites using custom URLs, a pretty common practice. If using <a href="http://docksal.io" rel="nofollow">docksal</a>, for example: <code>super-awesome-client.docksal</code>, <code>db.super-awesome-client.docksal</code>, etc., you get the idea. I needed to find a way to re-route custom URLs to my VM.</p>

<h2 id="networking" id="networking">Networking</h2>

<p>On a Mac or on Linux this would work out of the box after installing docksal (or lando or whatever docker wrapper you use). I wanted this to work the same way:</p>
<ul><li>I didn&#39;t want to configure each custom website manually</li>
<li>This had to work on new sites created with docksal</li>
<li>Should work on any network</li></ul>

<p>To achieve this transparent routing, I needed a static IP for the VM, so I could always reference it if I was at home, at a coffee shop, or in an airport. I&#39;m using Hyper-v, so I created a NAT using the instructions below:</p>

<p><a href="https://anandthearchitect.com/2018/01/06/windows-10-how-to-setup-nat-network-for-hyper-v-guests/" rel="nofollow">Windows 10: How to setup NAT network for Hyper-V guests?</a><br>
<br>
Then in the VM, <strong>configured the static IP</strong> address using <code>netplan</code>, created file <code>/etc/netplan/01-netcfg.yaml</code> (I used the same IP address as the guide to create the NAT above).</p>

<pre><code class="language-yaml">network:
    ethernets:
        eth0:
            dhcp4: no
            dhcp6: no
            addresses: [192.168.200.11/24]
            gateway4: 192.168.200.1
            nameservers:
                addresses: [8.8.8.8]

</code></pre>

<p>After <strong>enabling the ssh server in the VM</strong>, and configuring my ssh keys I was able to jump into the server from Windows very quickly, or even configure <a href="https://conemu.github.io/" rel="nofollow">ConEmu</a> or the new <a href="https://github.com/microsoft/terminal" rel="nofollow">Windows Terminal</a> to automatically connect to ssh.</p>

<p>To access the web servers running in docker containers created with docksal, <strong>I installed a DNS proxy</strong>: <a href="http://mayakron.altervista.org/wikibase/show.php?id=AcrylicHome" rel="nofollow">Acrylic DNS Proxy</a>, and used this <code>hosts</code> configuration:</p>

<pre><code>192.168.200.11 *.docksal

</code></pre>

<h2 id="visual-studio-code-configuration" id="visual-studio-code-configuration">Visual Studio Code Configuration</h2>

<p>In Visual Studio Code I installed the <a href="https://code.visualstudio.com/docs/remote/ssh" rel="nofollow">Remote Development extensions for SSH</a>. The configuration was straight forward and worked really well (the extension guides you until you are successfully connected to a SSH server).</p>

<p>Huge Drupal projects were indexed really fast and the performance when browsing them was like working on Linux. Debugging worked out of the box (this thanks to Docksal configs, but still, using <code>docker-compose</code> shouldn&#39;t be a problem).</p>

<p>The only downside I&#39;ve found is that I can&#39;t commit, push or pull using the editor, which is not a big deal since I can use the integrated terminal. From the <a href="https://code.visualstudio.com/docs/remote/ssh#_known-limitations" rel="nofollow">documentation</a>:</p>

<blockquote><p>If you clone a Git repository using SSH and your SSH key has a passphrase, VS Code&#39;s pull and sync features may hang when running remotely. Either use an SSH key without a passphrase, clone using HTTPS, or run git push from the command line to work around the issue.</p></blockquote>

<p>I ended up creating an SSH key for my repos without a passphrase.</p>

<h2 id="recap" id="recap">Recap</h2>

<p>Working on PHP natively on Windows it is still impossible, but using a VM and Visual Studio Code with Remote Code extensions works very well, with the price of more memory usage, but memory is cheap now, and that is one of the reasons I left Apple in the first place: to have an upgradable development computer.</p>

<p>One unexpected bonus is that I can recover from suspend and the VM will load up with all services that were running, something that in Linux didn&#39;t happen; I had to to run <code>fin up</code> or <code>docker-compose up</code> again after the laptop woke.</p>

<h2 id="aside-wsl2" id="aside-wsl2">Aside: WSL2</h2>

<p>The Windows Subsystem for Linux v2 is <em>about</em> to be released, which uses a custom Linux Kernel in a very lightweight VM (it is already in Windows Internals fast ring, but expected to reach public release until 2020).</p>

<p>In theory, it has all the same good points of this setup with a VM, and seems so be a great setup for a <a href="https://www.youtube.com/watch?v=A0eqZujVfYU" rel="nofollow">future development environment</a> because of these:</p>
<ul><li>The VM file system can be accessed directly from Windows using a p9 file system (that alone is awesome).</li>
<li>The performance is very close to native one.</li>
<li>Shared memory and processor cores.</li>
<li>Much tighter integration, it is possible to run windows programs from within the VM.</li></ul>

<p>This technology can really change the development experience on Windows, lets see if it is up to the expectations when it is released (because I won&#39;t subscribe to the fast ring in my main development computer).</p>

<h2 id="stranger-things" id="stranger-things">Stranger things</h2>

<p>While setting the environment <a href="/en/blog/git-errors-when-using-hyper-v" rel="nofollow">I found an error</a> that didn&#39;t allow me to clone big repos or to push changes. It turned out to be a bug in my WiFi drivers. So if you find the error below and have an Intel WiFi card, update your drivers.</p>

<pre><code>$ git clone git@somrerepo-bla-bla.git
Cloning into &#39;somedir&#39;...
error: RPC failed; curl 56 GnuTLS recv error (-12): A TLS fatal alert has been received.
fatal: The remote end hung up unexpectedly

</code></pre>
]]></content:encoded>
      <guid>https://arturo.linar.es/drupal-development-windows</guid>
      <pubDate>Thu, 26 Sep 2019 05:04:31 +0000</pubDate>
    </item>
  </channel>
</rss>