<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Box of Cables]]></title><description><![CDATA[Random technology, old and new, tossed in the box by Hayden Barnes.]]></description><link>https://boxofcables.dev/</link><image><url>https://boxofcables.dev/favicon.png</url><title>Box of Cables</title><link>https://boxofcables.dev/</link></image><generator>Ghost 5.88</generator><lastBuildDate>Sun, 05 Apr 2026 06:28:23 GMT</lastBuildDate><atom:link href="https://boxofcables.dev/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[How to build a custom kernel for WSL in 2025]]></title><description><![CDATA[Thanks to the WSL System Distro, we no longer need distro-specific instructions to build a WSL custom kernel. A standard, ephemeral build environment is right there, on every WSL installation.]]></description><link>https://boxofcables.dev/how-to-build-a-custom-kernel-for-wsl-in-2025/</link><guid isPermaLink="false">67408d67e9557114aba32540</guid><category><![CDATA[Windows Subsystem for Linux]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Sat, 23 Nov 2024 15:33:14 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2024/11/Screenshot-2024-11-22-095746.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2024/11/Screenshot-2024-11-22-095746.png" alt="How to build a custom kernel for WSL in 2025"><p>Previously, I have shown you how to build a custom kernel for WSL on <a href="https://boxofcables.dev/building-a-kernel-for-wsl-on-opensuse/" rel="noreferrer">openSUSE</a> and for <a href="https://boxofcables.dev/kvm-optimized-custom-kernel-wsl2-2022/" rel="noreferrer">KVM acceleration</a>.</p><p>Thanks to the introduction of the WSL System Distro, a lightweight Linux distro that runs on top of WSL managing various tasks, it is no longer necessary to write distro-specific guides to building a custom WSL kernel.</p><p>Because the WSL System Distro is standardized across all WSL installs, we can build a custom kernel for WSL the same way on any WSL install, regardless of your day-to-day WSL distro, whether it&apos;s AlmaLinux, Pengwin, Ubuntu, openSUSE, or Arch.</p><p>The WSL System Distro is powered by Azure Linux, also known as CBL-Mariner. The System Distro image ships with WSL, though it is mostly invisible. Unlike your day-to-day WSL distro though, the System Distro image is immutable. That means, even if you make changes in the System Distro, like installing packages or creating files, the minute you exit the System Distro, they are lost, and it reverts to the original version that the WSL team ships.</p><p>On the other hand, the WSL System Distro is the same across all WSL installations. Azure Linux is an rpm-based distribution that utilizes <code>tdnf</code>, a simplified version of <code>dnf</code>, the rpm-based package manager. <code>tdnf</code> can connect to the Azure Linux Microsoft package repository and download any dependencies you need, including all the Linux build dependencies. We just need to build the kernel and export it to our Windows file system before it closes and all is lost.</p><p>Here is how to do that and keep that System Distro environment alive in the process.</p><h3 id="requirements">Requirements</h3><ul><li>WSL 2 installed with <code>wsl.exe --install</code></li><li>Update WSL with <code>wsl.exe --update</code></li><li>Any WSL distro installed, after all, you have to have a distro to boot into with your custom kernel</li></ul><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="720" height="138" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image.png 600w, https://boxofcables.dev/content/images/2024/11/image.png 720w" sizes="(min-width: 720px) 720px"></figure><h3 id="entering-the-wsl-system-distro">Entering the WSL System Distro</h3><p>Getting root access to the WSL System Distro is as simple as:</p><pre><code>wsl.exe --system --user root</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-1.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="513" height="118"></figure><p>Note without <code>--user root</code> you will enter as the lower-privileged wslg user, which is utilized for WSLg GUI rendering, one of the aspects of the WSL experience the System Distro helps manage for WSL.</p><h3 id="note-of-caution">Note of Caution</h3><p>Because the System Distro is immutable, if for any reason you exit the System Distro, WSL is accidentally shut down, or maybe your computer sleeps while your kernel build is happening, all your progress will be lost, and you will have to start over.</p><p>To keep the System Distro instance you are working on for your build alive, without losing any progress, I recommend two things:</p><ol><li>Download <a href="https://github.com/microsoft/PowerToys" rel="noreferrer">Microsoft PowerToys</a>, enable Awake, and set it to keep your system awake indefinitely:</li></ol><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-2.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="339" height="239"></figure><ol start="2"><li>Then, open a second tab in Windows Terminal, enter the System Distro as above with:</li></ol><pre><code>wsl.exe --system --user root</code></pre><p>And then start a long sleep loop while we are working in the other tab:</p><pre><code>while true; do sleep 10000; done</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-3.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="649" height="117" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-3.png 600w, https://boxofcables.dev/content/images/2024/11/image-3.png 649w"></figure><h3 id="installing-dependencies">Installing Dependencies</h3><p>Then we need to install the build dependencies for the Linux kernel in the WSL System Distro using <code>tdnf</code>:</p><pre><code class="language-Bash">tdnf install -y gcc glibc-devel kernel-headers make gawk tar bc perl python3 bison flex dwarves binutils diffutils elfutils-libelf-devel zlib-devel openssl-devel ncurses-devel curl</code></pre><p>Just a reminder, when you exit the WSL System Distro instance, all these dependencies will be gone, and it will reset to the factory image shipped by the WSL team, and you will need to reinstall these.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-4.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1115" height="628" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-4.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-4.png 1000w, https://boxofcables.dev/content/images/2024/11/image-4.png 1115w" sizes="(min-width: 720px) 720px"></figure><h3 id="kernel-sources">Kernel Sources</h3><p>Move to your local home folder inside the WSL file system to improve build performance:</p><pre><code>cd ~</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-6.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="562" height="118"></figure><p>Grab the tar build of the latest build of the WSL sources from GitHub:</p><pre><code>curl -k -s https://api.github.com/repos/microsoft/WSL2-Linux-Kernel/releases/latest | \
grep &apos;&quot;tarball_url&quot;:&apos; | \
cut -d &apos;&quot;&apos; -f 4 | \
xargs -n 1 -I {} sh -c &apos;curl -k -L -o $(basename {} .tar.gz).tar.gz {}&apos;</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-7.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1035" height="317" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-7.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-7.png 1000w, https://boxofcables.dev/content/images/2024/11/image-7.png 1035w" sizes="(min-width: 720px) 720px"></figure><p>Unpack the tar archive:</p><pre><code>tar  -xzf ~/linux-msft-wsl-*.tar.gz</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-8.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1036" height="376" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-8.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-8.png 1000w, https://boxofcables.dev/content/images/2024/11/image-8.png 1036w" sizes="(min-width: 720px) 720px"></figure><h3 id="building-your-kernel">Building Your Kernel</h3><p>Drop into the kernel sources directory:</p><pre><code>cd microsoft-WSL2-Linux-Kernel*</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-9.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1071" height="496" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-9.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-9.png 1000w, https://boxofcables.dev/content/images/2024/11/image-9.png 1071w" sizes="(min-width: 720px) 720px"></figure><p>You will need to use a kernel config file. The default WSL2 kernel config files are in <code>./Microsoft</code>:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-10.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="984" height="174" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-10.png 600w, https://boxofcables.dev/content/images/2024/11/image-10.png 984w" sizes="(min-width: 720px) 720px"></figure><p>You can manually edit these here or copy them and make your edits there and then point to them using <code>KCONFIG_CONFIG=</code> when running <code>make</code> on your kernel build.</p><p>I personally prefer to take the respective default WSL2 kernel config file for my architecture and copy it to <code>.config</code> in my main kernel sources folder, which doesn&apos;t require setting <code>KCONFIG_CONFIG=</code>.</p><p>For this Arm device, that would be:</p><pre><code>cp Microsoft/config-wsl-arm64 .config</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-11.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="983" height="232" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-11.png 600w, https://boxofcables.dev/content/images/2024/11/image-11.png 983w" sizes="(min-width: 720px) 720px"></figure><p>On x86 devices, that would be:</p><pre><code>cp Microsoft/config-wsl .config</code></pre><h3 id="customizing-your-kernel">Customizing Your Kernel</h3><p>If you copied the default WSL2 kernel config file to <code>.config</code>, you can now edit using your preferred text editor, such as <code>nano</code>, <code>vim</code>, or <code>emacs</code>.</p><p>My personal preference, usually when turning features on and off, is simply to use the TUI interface for customizing the kernel, which can be accessed with:</p><pre><code>make menuconfig</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-12.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="957" height="541" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-12.png 600w, https://boxofcables.dev/content/images/2024/11/image-12.png 957w" sizes="(min-width: 720px) 720px"></figure><p>Gets you to here:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-13.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1115" height="628" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-13.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-13.png 1000w, https://boxofcables.dev/content/images/2024/11/image-13.png 1115w" sizes="(min-width: 720px) 720px"></figure><p>Where you can easily enable and disable features, drivers, optimizations, etc., without having to decipher .config.</p><p>Save your config file (unless you want to save elsewhere and set <code>KCONFIG_CONFIG=</code> on your kernel <code>make</code> command) as <code>.config</code>:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-14.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1115" height="628" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-14.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-14.png 1000w, https://boxofcables.dev/content/images/2024/11/image-14.png 1115w" sizes="(min-width: 720px) 720px"></figure><p>You can also apply patches, if you are advanced kernel hacker.</p><h3 id="building-your-kernel-1">Building Your Kernel</h3><p>It&apos;s now time to build your custom kernel.</p><p>Build with <code>make</code>, specifying the maximum number of cores in your system to speed things along:</p><pre><code>make -j$(nproc)</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-15.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="722" height="254" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-15.png 600w, https://boxofcables.dev/content/images/2024/11/image-15.png 722w" sizes="(min-width: 720px) 720px"></figure><p>While it&apos;s building, just to be sure, make sure that sleep loop is still running, just in case:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-16.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="651" height="121" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-16.png 600w, https://boxofcables.dev/content/images/2024/11/image-16.png 651w"></figure><p>Make you want to open another tab, drop into the System Distro, install <code>htop</code>, and see all the magic happening:</p><pre><code>tdnf install htop -y</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-17.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1075" height="319" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-17.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-17.png 1000w, https://boxofcables.dev/content/images/2024/11/image-17.png 1075w" sizes="(min-width: 720px) 720px"></figure><pre><code>htop</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-18.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1115" height="628" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-18.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-18.png 1000w, https://boxofcables.dev/content/images/2024/11/image-18.png 1115w" sizes="(min-width: 720px) 720px"></figure><h3 id="installing-your-custom-kernel">Installing Your Custom Kernel</h3><p>Once our build is complete:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-19.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1115" height="628" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-19.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-19.png 1000w, https://boxofcables.dev/content/images/2024/11/image-19.png 1115w" sizes="(min-width: 720px) 720px"></figure><p>We copy our build into place:</p><p>On Arm devices:</p><pre><code>cp arch/arm64/boot/Image $(wslpath &quot;$(cmd.exe /c &quot;echo %USERPROFILE%&quot; | tr -d &apos;\r&apos;)&quot;)</code></pre><p>On x86 devices:</p><pre><code>cp arch/x86/boot/bzImage $(wslpath &quot;$(cmd.exe /c &quot;echo %USERPROFILE%&quot; | tr -d &apos;\r&apos;)&quot;)</code></pre><p>And configure our <code>.wslconfig</code> to point to the custom kernel, if we are not replacing and existing kernel. In which case, you will want to make sure the configuration matches.</p><p>On Arm devices:</p><pre><code>powershell.exe /C &apos;Write-Output [wsl2]`nkernel=$env:USERPROFILE\Image | % {$_.replace(&quot;\&quot;,&quot;\\&quot;)} | Out-File $env:USERPROFILE\.wslconfig -encoding ASCII&apos;
</code></pre><p>On x86 devices:</p><pre><code>powershell.exe /C &apos;Write-Output [wsl2]`nkernel=$env:USERPROFILE\bzImage | % {$_.replace(&quot;\&quot;,&quot;\\&quot;)} | Out-File $env:USERPROFILE\.wslconfig -encoding ASCII&apos;</code></pre><h3 id="testing">Testing</h3><p>Once confirming <code>Image</code> or <code>bzImage</code> are in place and <code>.wslconfig</code> is properly set, we can shut down our WSL instance. Note, confirm everything we copied from the System Distro is in place before doing so because all changes (installed dependencies, kernel sources, and built kernel) will be lost.</p><pre><code>wsl.exe --shutdown</code></pre><p>Then restart WSL in the System Distro or your preferred working distro:</p><pre><code>wsl.exe --system</code></pre><p>And run:</p><pre><code>uname -a</code></pre><p>We should see our kernel with a timestamp of our build date and time:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2024/11/image-20.png" class="kg-image" alt="How to build a custom kernel for WSL in 2025" loading="lazy" width="1105" height="113" srcset="https://boxofcables.dev/content/images/size/w600/2024/11/image-20.png 600w, https://boxofcables.dev/content/images/size/w1000/2024/11/image-20.png 1000w, https://boxofcables.dev/content/images/2024/11/image-20.png 1105w" sizes="(min-width: 720px) 720px"></figure><p>Happy kernel hacking!</p>]]></content:encoded></item><item><title><![CDATA[Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL]]></title><description><![CDATA[Build cross-platform GUI apps for WIndows and Linux using C# and .NET using Avalonia in Visual Studio.]]></description><link>https://boxofcables.dev/creating-a-linux-desktop-app-in-visual-studio-using-avalonia/</link><guid isPermaLink="false">66ac089493c6612a36399ac4</guid><category><![CDATA[Linux]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Mon, 02 Oct 2023 21:39:06 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2023/10/Screenshot-2023-10-03-121504.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2023/10/Screenshot-2023-10-03-121504.png" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL"><p>Pre-requisites:</p><ul><li><a href="https://learn.microsoft.com/en-us/windows/wsl/install">WSL 2</a> enabled</li><li><a href="https://visualstudio.microsoft.com/">Visual Studio 2022</a> installed</li></ul><h3 id="install-the-avalonia-extension-in-visual-studio">Install the <a href="https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS">Avalonia Extension</a> in Visual Studio.</h3><p>Go to &quot;Manage Extensions&quot; in Visual Studio. To get there quickly, open Visual Studio start without code and look for the &quot;Extensions&quot; menu option:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-28.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="1197" height="285" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-28.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/10/image-28.png 1000w, https://boxofcables.dev/content/images/2023/10/image-28.png 1197w" sizes="(min-width: 720px) 720px"></figure><p>Click &quot;Manage Extensions&quot; and type &quot;Avalonia&quot; in the top-right search box. </p><p>Click &quot;Download&quot; on &quot;Avalonia for Visual Studio&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="458" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image.png 600w, https://boxofcables.dev/content/images/2023/10/image.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Click &quot;Download&quot; on &quot;Avalonia Toolkit&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-1.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="899" height="487" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-1.png 600w, https://boxofcables.dev/content/images/2023/10/image-1.png 899w" sizes="(min-width: 720px) 720px"></figure><p>Then click &quot;Close&quot;. Close all Visual Studio windows.</p><p>VSIX will then do some computing:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-5.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="681" height="519" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-5.png 600w, https://boxofcables.dev/content/images/2023/10/image-5.png 681w"></figure><p>When VSIX Installer asks, allow the enabled modifications:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-3.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="681" height="519" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-3.png 600w, https://boxofcables.dev/content/images/2023/10/image-3.png 681w"></figure><p>Visual Studio will do some magic:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-4.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="681" height="519" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-4.png 600w, https://boxofcables.dev/content/images/2023/10/image-4.png 681w"></figure><p>Once everything is installed, click &quot;Close&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-6.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="681" height="519" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-6.png 600w, https://boxofcables.dev/content/images/2023/10/image-6.png 681w"></figure><h3 id="enable-wsl-debug-support-in-visual-studio">Enable WSL Debug Support in Visual Studio</h3><p>Open the Visual Studio Installer and click &quot;Modify&quot; next to Visual Studio 2022:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-7.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="505" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-7.png 600w, https://boxofcables.dev/content/images/2023/10/image-7.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Click on &quot;Individual Components&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-8.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="506" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-8.png 600w, https://boxofcables.dev/content/images/2023/10/image-8.png 900w" sizes="(min-width: 720px) 720px"></figure><p>In the search box:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-9.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="505" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-9.png 600w, https://boxofcables.dev/content/images/2023/10/image-9.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Type &quot;WSL&quot; and you will see &quot;.NET Debugging with WSL&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-10.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="506" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-10.png 600w, https://boxofcables.dev/content/images/2023/10/image-10.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Check &quot;.NET Debugging with WSL&quot; and click &quot;Modify&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-11.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="505" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-11.png 600w, https://boxofcables.dev/content/images/2023/10/image-11.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Visual Studio Installer will install .NET Debugging with WSL:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-12.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="505" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-12.png 600w, https://boxofcables.dev/content/images/2023/10/image-12.png 900w" sizes="(min-width: 720px) 720px"></figure><h3 id="build-a-sample-app">Build a Sample App</h3><p>Open Visual Studio and click &quot;Create New Project&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-13.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="512" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-13.png 600w, https://boxofcables.dev/content/images/2023/10/image-13.png 900w" sizes="(min-width: 720px) 720px"></figure><p>You will see all possible project templates:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-14.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="513" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-14.png 600w, https://boxofcables.dev/content/images/2023/10/image-14.png 900w" sizes="(min-width: 720px) 720px"></figure><p>To narrow the choices, select C# under &quot;Languages&quot;, Linux in &quot;Platforms&quot;, and Avalonia in the &quot;Project Types&quot; drop-down menu:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-15.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="513" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-15.png 600w, https://boxofcables.dev/content/images/2023/10/image-15.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Select &quot;Avalonia .NET Core App&quot; and click &quot;Next&quot;:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-16.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="513" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-16.png 600w, https://boxofcables.dev/content/images/2023/10/image-16.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Choose a suitable destination folder and project name in the following screen:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-17.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="513" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-17.png 600w, https://boxofcables.dev/content/images/2023/10/image-17.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Accept the defaults in the next page. As of writing, .NET 7 is still the current stable version of .NET, though .NET 8 is right around the corner. By the time you read this, .NET 8 may be the new default.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-18.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="513" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-18.png 600w, https://boxofcables.dev/content/images/2023/10/image-18.png 900w" sizes="(min-width: 720px) 720px"></figure><p>Visual Studio will load a blank project template:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-22.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="898" height="514" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-22.png 600w, https://boxofcables.dev/content/images/2023/10/image-22.png 898w" sizes="(min-width: 720px) 720px"></figure><p>Select &quot;WSL&quot; in the target platform dropdown:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-21.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="898" height="514" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-21.png 600w, https://boxofcables.dev/content/images/2023/10/image-21.png 898w" sizes="(min-width: 720px) 720px"></figure><p>Attempt to build and run the blank template. However, when you run the app for the first time, you may see an error with this message:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-20.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="899" height="509" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-20.png 600w, https://boxofcables.dev/content/images/2023/10/image-20.png 899w" sizes="(min-width: 720px) 720px"></figure><p>.NET is missing from our WSL distro. Thankfully, Visual Studio will handle the installation of .NET on WSL on most WSL distros.</p><p>In newer builds of Visual Studio you will get this message in Visual Studio before attempting to run on WSL:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-31.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="947" height="105" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-31.png 600w, https://boxofcables.dev/content/images/2023/10/image-31.png 947w" sizes="(min-width: 720px) 720px"></figure><p>Click &quot;OK&quot; and Visual Studio will launch .NET install on our default WSL distro:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-23.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="899" height="228" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-23.png 600w, https://boxofcables.dev/content/images/2023/10/image-23.png 899w" sizes="(min-width: 720px) 720px"></figure><p>It might ask you for admin password before installation. </p><p>It will start downloading and installing the required .NET version for the default WSL distribution:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-32.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="2000" height="1095" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-32.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/10/image-32.png 1000w, https://boxofcables.dev/content/images/size/w1600/2023/10/image-32.png 1600w, https://boxofcables.dev/content/images/2023/10/image-32.png 2328w" sizes="(min-width: 720px) 720px"></figure><p>Once the installation finishes, the WSL window will close automatically, and you will see the following message in Visual Studio:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-25.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="897" height="507" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-25.png 600w, https://boxofcables.dev/content/images/2023/10/image-25.png 897w" sizes="(min-width: 720px) 720px"></figure><p>After running again, Windows will load WSL and run the application inside that. For the first start, it may take some time to load.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-26.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="898" height="514" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-26.png 600w, https://boxofcables.dev/content/images/2023/10/image-26.png 898w" sizes="(min-width: 720px) 720px"></figure><p>The application will launch using WSLg in WSL2:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-27.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="900" height="514" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-27.png 600w, https://boxofcables.dev/content/images/2023/10/image-27.png 900w" sizes="(min-width: 720px) 720px"></figure><h3 id="open-source-net-avalonia-apps">Open Source .NET Avalonia Apps</h3><p>To experiment with building additional Linux apps using .NET and Avalonia, check out the following projects:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/waliarubal/Jaya"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - waliarubal/Jaya: Cross platform file manager application for Windows, Mac and Linux operating systems. (planned mobile support)</div><div class="kg-bookmark-description">Cross platform file manager application for Windows, Mac and Linux operating systems. (planned mobile support) - GitHub - waliarubal/Jaya: Cross platform file manager application for Windows, Mac a...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">waliarubal</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/fe3c127a255b7696c8befeb338eb3fe8789b3dfb1898990603bc8147a59c853a/waliarubal/Jaya" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/dan0v/AmplitudeSoundboard"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - dan0v/AmplitudeSoundboard: A sleek, cross-platform soundboard, available for Windows, MacOS, and Linux</div><div class="kg-bookmark-description">A sleek, cross-platform soundboard, available for Windows, MacOS, and Linux - GitHub - dan0v/AmplitudeSoundboard: A sleek, cross-platform soundboard, available for Windows, MacOS, and Linux</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">dan0v</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/404493290/c3263d8f-afbf-4fae-b823-52111b871c1e" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/anovik/SmartCommander"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - anovik/SmartCommander: An open-source cross-platform file manager for Windows and Linux based on Avalonia</div><div class="kg-bookmark-description">An open-source cross-platform file manager for Windows and Linux based on Avalonia - GitHub - anovik/SmartCommander: An open-source cross-platform file manager for Windows and Linux based on Avalonia</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">anovik</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/28328aeacf9453a3041d2a303d9f1daf8bf429f235464493c0815951fe5cb32c/anovik/SmartCommander" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL"></div></a></figure><h3 id="building-smart-commander">Building Smart Commander</h3><p>Use your preferred git client, in my case I use GitHub Desktop to clone Smart Commander:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-29.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="2000" height="1375" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-29.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/10/image-29.png 1000w, https://boxofcables.dev/content/images/size/w1600/2023/10/image-29.png 1600w, https://boxofcables.dev/content/images/2023/10/image-29.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>In your default WSL distro, install libice6 and libsm6:</p><pre><code class="language-cs">sudo apt install libice6 libsm6</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-33.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="2000" height="1070" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-33.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/10/image-33.png 1000w, https://boxofcables.dev/content/images/size/w1600/2023/10/image-33.png 1600w, https://boxofcables.dev/content/images/size/w2400/2023/10/image-33.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Open Visual Studio and locate the .sln file in the /src/ folder of the project:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-30.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="2000" height="1307" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-30.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/10/image-30.png 1000w, https://boxofcables.dev/content/images/size/w1600/2023/10/image-30.png 1600w, https://boxofcables.dev/content/images/size/w2400/2023/10/image-30.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Open the project. Make sure your target is set to WSL:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-34.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="849" height="194" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-34.png 600w, https://boxofcables.dev/content/images/2023/10/image-34.png 849w" sizes="(min-width: 720px) 720px"></figure><p>And click the run button next to &quot;WSL&quot;.</p><p>Visual Studio will go into debug mode:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/image-35.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="2000" height="1189" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/image-35.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/10/image-35.png 1000w, https://boxofcables.dev/content/images/size/w1600/2023/10/image-35.png 1600w, https://boxofcables.dev/content/images/size/w2400/2023/10/image-35.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>And your Linux app will launch:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/10/Screenshot-2023-10-03-121504-1.png" class="kg-image" alt="Getting Started Creating a Linux Desktop App in Visual Studio using Avalonia and WSL" loading="lazy" width="2000" height="1188" srcset="https://boxofcables.dev/content/images/size/w600/2023/10/Screenshot-2023-10-03-121504-1.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/10/Screenshot-2023-10-03-121504-1.png 1000w, https://boxofcables.dev/content/images/size/w1600/2023/10/Screenshot-2023-10-03-121504-1.png 1600w, https://boxofcables.dev/content/images/size/w2400/2023/10/Screenshot-2023-10-03-121504-1.png 2400w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item><item><title><![CDATA[Windows Dev Drive Benchmarks]]></title><description><![CDATA[Putting Windows Dev Drive through it's paces on the Windows Dev Kit 2023.]]></description><link>https://boxofcables.dev/windows-dev-drive-benchmarks/</link><guid isPermaLink="false">66ac089493c6612a36399ac3</guid><category><![CDATA[Linux]]></category><category><![CDATA[Windows]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Tue, 30 May 2023 21:18:58 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2023/05/Screenshot-2023-05-30-104009.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2023/05/Screenshot-2023-05-30-104009.png" alt="Windows Dev Drive Benchmarks"><p>Dev Drive was recently announced at Microsoft Build 2023:</p><blockquote><a href="https://learn.microsoft.com/en-us/windows/dev-drive/">Dev Drive</a> is a new form of storage volume available to improve performance for key developer workloads.</blockquote><blockquote>Dev Drive builds on ReFS technology to employ targeted file system optimizations and provide more control over storage volume settings and security, including trust designation, antivirus configuration, and administrative control over what filters are attached.</blockquote><p>Dev Drive can be set up from the new <a href="https://learn.microsoft.com/en-us/windows/dev-home/">Dev Home</a>:</p><blockquote>Dev Home is a new control center for Windows providing the ability to monitor projects in your dashboard using customizable widgets, set up your dev environment by downloading apps, packages, or repositories, connect to your developer accounts and tools (such as GitHub), and create a Dev Drive for storage all in one place.</blockquote><p>Or Dev Drive and optionally configured under Disks &amp; volumes in Settings, and as either a virtual VHD drive or raw disk:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/05/Screenshot-2023-05-30-111140.png" class="kg-image" alt="Windows Dev Drive Benchmarks" loading="lazy" width="954" height="565" srcset="https://boxofcables.dev/content/images/size/w600/2023/05/Screenshot-2023-05-30-111140.png 600w, https://boxofcables.dev/content/images/2023/05/Screenshot-2023-05-30-111140.png 954w" sizes="(min-width: 720px) 720px"></figure><p>I wanted to put Dev Drive to the test on my developer machine, a Windows Developer Kit 2023, an Arm device, running the latest Windows Insider Dev Channel build.</p><h3 id="setup">Setup</h3><p>Windows Developer Kit 2023<br>Qualcomm Snapdragon 8cx Gen 3<br>32GB LPDDR4x RAM<br>512GB NVMe<br>Windows NTFS C: Drive<br>Windows ReFS D: Drive created as a Dev Drive<br>BitLocker Enabled on C: and D:</p><h3 id="windows-environment">Windows Environment</h3><p>Windows 11 Dev Channel Build 23466.1001<br>Windows Terminal Preview 1.18<br>Visual Studio Community 2022 Preview<br>Dev Home Preview 0.137.141.0<br>PowerShell 7.3.4<br>Python 3.11</p><h3 id="building-flask-on-windows">Building Flask on Windows</h3><p><a href="https://flask.palletsprojects.com/">Flask</a> is a Python web UI framework. This PowerShell script builds Flask on Windows from source and then runs all the build tests from the Flask repository.</p><p>I thought building a Python-heavy app natively on Windows would be a good starting point for comparison.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/05/image.png" class="kg-image" alt="Windows Dev Drive Benchmarks" loading="lazy" width="1155" height="384" srcset="https://boxofcables.dev/content/images/size/w600/2023/05/image.png 600w, https://boxofcables.dev/content/images/size/w1000/2023/05/image.png 1000w, https://boxofcables.dev/content/images/2023/05/image.png 1155w" sizes="(min-width: 720px) 720px"></figure><p>Work is done in the script to shift as much caching to the folder or parent folder on the drive the script is being run on, to minimize dev tooling&apos;s tendency to cache to C:</p><pre><code class="language-Bash">winget install python git.git --disable-interactivity #install Python

$sw = [Diagnostics.Stopwatch]::StartNew() #start timer

python -m pip cache purge #clean up global pip cache
Remove-Item -Recurse -Force $env:LOCALAPPDATA\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages #clean up local pip cache

python -m pip install --upgrade pip #upgrade pip
python -m pip install pipenv #install pipenv

Remove-Item -Recurse -Force flask #remove old repo
Remove-Item -Recurse -Force Pipfile* #remove old Pipfile
Remove-Item -Recurse -Force pipenvcache #remove old pipcache

md pipenvcache #create new pipcache folder
$env:PIPENV_CACHE_DIR = &quot;$pwd\pipenvcache&quot; #set cache folder for pipenv
$env:PIPENV_VENV_IN_PROJECT=1 #set pipenv to create virtual environment in this folder

git clone https://github.com/pallets/flask #clone repo
Set-Location flask
python -m pipenv install setuptools wheel
python -m pipenv install -r requirements/dev.txt #install flask dependencies
python -m pipenv install $pwd #install flask
python -m pipenv install -r requirements/tests.txt #install test dependencies
Get-ChildItem -Path . -Filter .\tests\*.py | ForEach-Object {python -m pipenv run python $_.FullName} #run tests
Set-Location ..

$sw.Stop() #stop timer

Write-Host $([string]::Format(&quot;`n&#x1F3C1;&#xFE0F;&#x1F3C3;&#x1F4A8; Total time: {0:d2}:{1:d2}:{2:d2} &#x23F1;&#xFE0F;&#x1F4CE;&#x1F3C6;&#xFE0F;&#x1F389;&quot;,
                                  $sw.Elapsed.Hours,
                                  $sw.Elapsed.Minutes,
                                  $sw.Elapsed.Seconds)) -ForegroundColor Green

Write-Output $([string]::Format(&quot;Total time: {0:d2}:{1:d2}:{2:d2}&quot;,
                                  $sw.Elapsed.Hours,
                                  $sw.Elapsed.Minutes,
                                  $sw.Elapsed.Seconds)) | Out-File -FilePath .\flaskbuildtime.txt -Append</code></pre><p>You can download my Flask build script here:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/sirredbeard/devdrive-benchmarking"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - sirredbeard/devdrive-benchmarking</div><div class="kg-bookmark-description">Contribute to sirredbeard/devdrive-benchmarking development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Windows Dev Drive Benchmarks"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">sirredbeard</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/42ae8000f22ee33f05c560e10085cfd0f3872a322a5506944bf579000f565338/sirredbeard/devdrive-benchmarking" alt="Windows Dev Drive Benchmarks"></div></a></figure><p>The results showed a 10% boost in compile and testing time of Flask when run on the Dev Drive, D:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2023/05/image-1.png" class="kg-image" alt="Windows Dev Drive Benchmarks" loading="lazy" width="615" height="510" srcset="https://boxofcables.dev/content/images/size/w600/2023/05/image-1.png 600w, https://boxofcables.dev/content/images/2023/05/image-1.png 615w"></figure><p>Interesting result. I have some more benchmark scripts on the way.</p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[The GitHub Copilot Lawsuit Threatens Open Source and Human Progress]]></title><description><![CDATA[The vague complaints of the Copilot plaintiffs are nothing compared to the damage to free software and human progress if they won.]]></description><link>https://boxofcables.dev/the-github-copilot-lawsuit-threatens-open-source-and-human-progress-1/</link><guid isPermaLink="false">66ac089493c6612a36399ac2</guid><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Mon, 07 Nov 2022 14:24:51 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/11/Screenshot-2022-11-07-090626.png" medium="image"/><content:encoded><![CDATA[<h3 id="background">Background</h3><img src="https://boxofcables.dev/content/images/2022/11/Screenshot-2022-11-07-090626.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"><p>Matthew Butterick, &quot;writer, designer, pro&#xAD;gram&#xAD;mer, and law&#xAD;yer&quot; has teamed up with the class action plaintiff&apos;s law firm Joseph Saveri Law Firm to sue GitHub and Microsoft over GitHub Copilot.</p><p>Over at <a href="githubcopilotinvestigation.com">githubcopilotinvestigation.com</a>, Butterick describes his reasoning. He says:</p><blockquote>When I first wrote about Copi&#xAD;lot, I said &#x201C;I&#x2019;m not wor&#xAD;ried about its effects on open source.&#x201D; In the short term, I&#x2019;m still not wor&#xAD;ried.</blockquote><p>That&apos;s good to know. But he then goes to wax nostalgic about his specific experience in open source and how GitHub Copilot is something new and different.</p><blockquote>But as I reflected on my own jour&#xAD;ney through open source&#x2014;nearly 25 years&#x2014;I real&#xAD;ized that I was miss&#xAD;ing the big&#xAD;ger pic&#xAD;ture. After all, open source isn&#x2019;t a fixed group of peo&#xAD;ple. It&#x2019;s an ever-grow&#xAD;ing, ever-chang&#xAD;ing col&#xAD;lec&#xAD;tive intel&#xAD;li&#xAD;gence, con&#xAD;tin&#xAD;u&#xAD;ally being renewed by fresh minds....Amidst this grand alchemy, Copi&#xAD;lot inter&#xAD;lopes.</blockquote><p>It reads like someone threatened by innovative technologies, gatekeeping because this isn&apos;t how <em>he </em>did open source over the last 25 years. Butterick throws in some vague handy-wavy anti-Microsoft rhetoric, also outdated and trite (but sure to appeal to the FSF crowd), for good measure:</p><blockquote>We needn&#x2019;t delve into Microsoft&#x2019;s very check&#xAD;ered his&#xAD;tory with open source...</blockquote><p>Almost none of the people mentioned in the article he linked to, which is about Microsoft in the late 1990s and early 2000s, are still at Microsoft. Since that time, Microsoft has seen a <a href="https://boxofcables.dev/microsoft-and-open-source-an-unofficial-timeline/">profound pivot towards open source software</a>. The CEO, Satya Nadella, has not been implicated in any of the anti-FOSS activities at Microsoft during that time, has embraced-even promoted-the pivot towards open source software, and, for what it&apos;s worth, came to Microsoft from Sun Microsystems.</p><p>Most of the product managers, engineers, and decision-makers at Microsoft these days were barely out of high school in the early 2000s. In tech, it&apos;s ancient history. </p><p>Butterick even knocks Bill Gates for his <a href="https://boxofcables.dev/bill-gates-was-right/">open letter to computer hobbyists</a>, which contained the <em>radical</em> idea that developers should be able to define the terms on which their software is distributed, which is the fundamental basis of modern free and open source software. Ironic, because if there are no rules on software code, then he would have no basis for his lawsuit.</p><p>Sadly, the Copilot case also seems prepared to bring open source software patent claims, something free and open source software advocates largely solved with the GPL v3 and Red Hat&apos;s Open Innovation Network efforts:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-19.png" class="kg-image" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress" loading="lazy" width="758" height="87" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-19.png 600w, https://boxofcables.dev/content/images/2022/11/image-19.png 758w" sizes="(min-width: 720px) 720px"></figure><p>I thought we were all against software patents, particularly in open source. I guess not.</p><h3 id="why-foss-advocates-should-support-github-copilot">Why F/OSS Advocates Should Support GitHub Copilot</h3><p>The legal underpinnings of GitHub Copilot are based on two basic principles:</p><ol><li>Fair use.</li><li>The <em>de minimus</em> exception (US) or incidental inclusion (UK and elsewhere).</li></ol><p>Fair use protection is broad under US copyright law and is codified in EU copyright directives, although adoption at the member state level varies. Many other non-US and non-EU countries have similar exceptions, though the US is the broadest to my knowledge.</p><p>Fair use is a doctrine that allows the limited use of copyrighted material without obtaining prior permission of the copyright owner.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://en.wikipedia.org/wiki/Fair_use"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Fair use - Wikipedia</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://en.wikipedia.org/static/apple-touch/wikipedia.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"><span class="kg-bookmark-author">Wikimedia Foundation, Inc.</span><span class="kg-bookmark-publisher">Contributors to Wikimedia projects</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Joseph_Story.jpg/170px-Joseph_Story.jpg" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"></div></a></figure><p>Since 2016, US law has held that automated scanning, indexing, and minor reproduction of copyrighted works, specifically Google&apos;s indexing of books for Google Books, is <a href="https://techcrunch.com/2016/04/18/supreme-court-affirms-google-books-scans-of-copyrighted-works-are-fair-use/">protected fair use</a>.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://en.wikipedia.org/wiki/Authors_Guild,_Inc._v._Google,_Inc."><div class="kg-bookmark-content"><div class="kg-bookmark-title">Authors Guild, Inc. v. Google, Inc. - Wikipedia</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://en.wikipedia.org/static/apple-touch/wikipedia.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"><span class="kg-bookmark-author">Wikimedia Foundation, Inc.</span><span class="kg-bookmark-publisher">Contributors to Wikimedia projects</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Seal_of_the_United_States_Court_of_Appeals_for_the_Second_Circuit.svg/1200px-Seal_of_the_United_States_Court_of_Appeals_for_the_Second_Circuit.svg.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"></div></a></figure><p>Fair use has come into play in open source software most recently with the <em>Google v. Oracle</em> case, in which the courts held that Google&apos;s clean-room implementation of the Java API did not violate Oracle&apos;s copyright on those API calls.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://en.wikipedia.org/wiki/Google_LLC_v._Oracle_America,_Inc."><div class="kg-bookmark-content"><div class="kg-bookmark-title">Google LLC v. Oracle America, Inc. - Wikipedia</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://en.wikipedia.org/static/apple-touch/wikipedia.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"><span class="kg-bookmark-author">Wikimedia Foundation, Inc.</span><span class="kg-bookmark-publisher">Contributors to Wikimedia projects</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/Seal_of_the_United_States_Supreme_Court.svg/100px-Seal_of_the_United_States_Supreme_Court.svg.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"></div></a></figure><p>Fair use protects the reimplementation of other APIs, such as the Win32 API in ReactOS or WINE, in open source. It also protects reverse engineering of proprietary applications to create open source alternatives. Importantly, like in the Google Books case, protects scanning copyrighted datasets to develop indices, ML models, and other derivative works.</p><p>GitHub&apos;s scanning of the source code available on its servers to develop an AI model is protected fair use for this reason.</p><p>Incidental inclusion is a legal term of art from <a href="https://copyrightservice.co.uk/copyright/p27_work_of_others">UK copyright law</a>. In the UK, incidental inclusion protects accidentally including small bits of copyrighted material by this distinct carve-out:</p><blockquote>A typical example of this would be a case where a someone filming inadvertently captured part of a copyright work, such as some background music, or a poster that just happened to on a wall in the background.</blockquote><p>This specific carve-out is needed in UK and other non-US countries where fair use protections are not as broad.</p><p>In the US accidentally including small bits of copyrighted material is protected under the umbrella of broad fair use protections, but is referred to as the <em>de minimis </em>exception<em>.</em></p><p>Under US law fair use protections, the intent, amount, and effect of infringement determines whether an infringement is protected by the fair use doctrine. Where the intent, amount, and effect of infringement is minimal, it is covered by the <em>de minimis </em>exception.</p><p>GitHub Copilot is not <em>intended </em>to violate GitHub contributors&apos; copyrights.</p><p>While there have been a handful of viral examples of verbatim reproduction of code by Copilot, GitHub has produced reports that state the actual rate of verbatim reproduction is exceedingly low. There is reason to believe the model will continue to improve and that rate will go down.</p><p>Finally, the effect of that verbatim reproduction is also minimal. GitHub Copilot is not currently capable of reproducing whole software projects, undermining other companies, or destroying open source communities. </p><p>It is an AI-assisted pair programmer that is great at filling in boilerplate code we all use and borrow from each other in free and open source software, protected by FOSS licenses and fair use.</p><p>While this is a general overview of the legal basis of GitHub Copilot, there are several valuable in-depth analyses that go into further detail:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://felixreda.eu/2021/07/github-copilot-is-not-infringing-your-copyright/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub Copilot is not infringing your copyright</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://felixreda.eu/wp-content/themes/scapegoat-master/images/touch-icon.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"><span class="kg-bookmark-author">Felix Reda</span><span class="kg-bookmark-publisher">Felix Reda</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://felixreda.eu/wp-content/uploads/2022/01/shuttleworthfellow.svg" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://fossa.com/blog/analyzing-legal-implications-github-copilot/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Analyzing the Legal Implications of GitHub Copilot - FOSSA</div><div class="kg-bookmark-description">The release of GitHub Copilot raises questions about potential copyright infringement and license compliance issues.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://fossa.com/blog/favicon.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"><span class="kg-bookmark-author">Dependency Heaven</span><span class="kg-bookmark-publisher">FOSSA Editorial Team</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://fossa.com/blog/content/images/2021/07/copilot-2.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"></div></a></figure><p>It is also worth pointing out that organizations like Free Software Foundation do not actually disagree with the legality of GitHub Copilot, they just also raise similar vague <em>concerns </em>about it and throw in anti-Microsoft rhetoric for good measure, to appease their base. They must fundraise, after all.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.zdnet.com/article/is-github-copilots-code-legal-ethically-right/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Sure, GitHub&#x2019;s AI-assisted Copilot writes code for you, but is it legal or ethical?</div><div class="kg-bookmark-description">GitHub&#x2019;s Copilot is an AI-based, pair-programming service. Its machine learning model raises a number of questions. Open source experts weigh in.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.zdnet.com/a/fly/bundles/zdnetcore/images/logos/zdnet-logo-yellow.png" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"><span class="kg-bookmark-author">ZDNET</span><span class="kg-bookmark-publisher">Steven Vaughan-Nichols</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.zdnet.com/a/img/resize/cae996012bfb15495d1e9be0f1694d4ab759244f/2022/01/07/9598c060-4dfd-4ed1-b71b-ebd77473707d/machine-g5fb55c703-1920.jpg?auto=webp&amp;fit=crop&amp;height=675&amp;width=1200" alt="The GitHub Copilot Lawsuit Threatens Open Source and Human Progress"></div></a></figure><h3 id="what-could-happen-if-github-loses">What Could Happen If GitHub Loses</h3><p>What are some of the potential outcomes of the GitHub Copilot litigation?</p><ul><li><strong>Fair use and &quot;incidental inclusion&quot; in open source software becomes more restrictive.</strong></li></ul><p>Ever copy and paste code snippets from StackOverflow? Did you remember to properly cite and add the relevant Creative Commons license to your LICENSE.md file for that code? How about borrowing some sample code from a blog or looking at a GitHub Gist and reproducing it in your code?</p><p>We all know we should apply that attribution/license, but do we always? How much of that code is running in production in your company or open source community right now?</p><p>Thankfully, that kind of usage is likely protected under fair use. If that goes away, copying code like this could open free and open source developers up to additional liability, expensive lawsuits, and even troll lawsuits.</p><p>We could see a whole industry crop up of open source software copyright trolls, going after open source projects for minor infringements of licenses.</p><ul><li><strong>Training ML datasets on copyrighted materials becomes more restrictive.</strong></li></ul><p>The ability for ML developers to train their models on copyrighted datasets under fair use right now is dramatically accelerating AI/ML. The advances we have seen in open source AI/ML being developed on datasets that are otherwise copyrighted is unprecedented. Just in the last 12 months the advances we have seen in AI/ML have been extraordinary. Models and advances in model development that used to take years are taking <em>weeks</em> and sometimes just <em>days</em>.</p><p>If training ML models on copyrighted datasets becomes more restrictive, AI/ML development will slow.</p><p>For example, I know of <a href="https://arxiv.org/pdf/2005.09091.pdf">one AI/ML project</a> (PDF) that scraped publicly accessible webcams during COVID lockdowns to measure social distancing. Those webcam images were copyrighted and, if fair use did not apply, could not be used without obtaining written permission from thousands of webcam owners.</p><p>This will have profound impacts on medical research, science, models that improve accessibility for users, and other practical applications of AI/ML that improve the lives of humans and benefit our planet.</p><p>This means more lawyers involved in model training, which will then become more expensive, and slower.</p><p>It will also likely take ML model training out of the hands of hobbyists, open source developers, and individual researchers and limit it to big corporations who can afford those compliance costs.</p><p>Individual ML developers, like individual open source developers, will suddenly face much more legal ambiguity and exposure, if we do not defend fair use.</p><h3 id="conclusion">Conclusion</h3><p><strong>tl;dr</strong> Based on squeamish feelings that GitHub Copilot is something new and different, and gripes about Microsoft from 20 years ago, a tech lawyer has teamed up with a class action plaintiff&apos;s law firm to sue GitHub over an incredibly helpful tool that improves open source quality and output, the potential outcomes of which could include:</p><ul><li>Making free and open source software harder to share</li><li>Re-implementing proprietary applications, hardware, and protocols as free and open harder to do</li><li>Making training AI/ML models more expensive, taking it out of the hands of hobbyists and researchers, limiting it only to big corporations with huge legal departments</li><li>Slowing development of real-world application of AI/ML models that will improve human life and longevity</li><li>Upending the current d&#xE9;tente in the free software and open source communities over software patents</li></ul><p>You do not have to love Microsoft, GitHub, or &apos;back them&apos; in this case. But free and open source advocates who have concerns about GitHub Copilot should but<em> just as skeptical</em> of the GitHub Copilot plaintiffs based on what is at risk here.</p><figure class="kg-card kg-embed-card"><blockquote class="twitter-tweet"><p lang="en" dir="ltr">Imagine being the person who slowed down cancer detection research or the discovery of new antibiotics over vague complaints Copilot is new and different or re-hashed complaints over events from 20+ years ago.</p>&#x2014; Hayden Barnes (@unixterminal) <a href="https://twitter.com/unixterminal/status/1582479177718312961?ref_src=twsrc%5Etfw">October 18, 2022</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</figure>]]></content:encoded></item><item><title><![CDATA[Microsoft's CBL-Delridge is 404, long live CBL-Mariner]]></title><description><![CDATA[Microsoft is increasingly standardizing on its in-house CBL-Mariner Linux distribution. Is this Microsoft Linux?]]></description><link>https://boxofcables.dev/cbl-delridge-is-dead-long-live-cbl-mariner/</link><guid isPermaLink="false">66ac089493c6612a36399ac1</guid><category><![CDATA[Linux]]></category><category><![CDATA[Windows Subsystem for Linux]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Thu, 03 Nov 2022 21:46:53 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/11/Screenshot-2022-11-03-174613-2.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2022/11/Screenshot-2022-11-03-174613-2.png" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"><p>CBL-Delridge, Microsoft&apos;s Debian-based Linux distribution, is no more. As pointed out to me by <a href="https://twitter.com/maryjofoley">Mary Jo Foley</a>, the CBL-Delridge apt package repository, is now 404:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-7.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="924" height="452" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-7.png 600w, https://boxofcables.dev/content/images/2022/11/image-7.png 924w" sizes="(min-width: 720px) 720px"></figure><p>I had previously written a guide to building your own image of CBL-Delridge from that repository:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://boxofcables.dev/building-cbl-d-microsofts-other-linux-distro/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Building CBL-Delridge, Microsoft&#x2019;s other Linux distro</div><div class="kg-bookmark-description">Microsoft has another Linux distro you probably haven&#x2019;t heard of. You can easily build it and even import it into WSL.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://boxofcables.dev/favicon.png" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"><span class="kg-bookmark-author">Box of Cables</span><span class="kg-bookmark-publisher">Hayden Barnes</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://boxofcables.dev/content/images/2022/02/Untitled-2.png" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"></div></a></figure><p>I am afraid that method will no longer work.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-6.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="924" height="452" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-6.png 600w, https://boxofcables.dev/content/images/2022/11/image-6.png 924w" sizes="(min-width: 720px) 720px"></figure><p>Mary Jo Foley also wrote about CBL-Delridge:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.zdnet.com/article/surprise-theres-yet-another-microsoft-linux-distro-cbl-delridge/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Surprise: There&#x2019;s yet another Microsoft Linux distro, CBL-Delridge</div><div class="kg-bookmark-description">Microsoft has been public about its CBL-Mariner Linux release, which just hit the 2.0 milestone. But did you know there&#x2019;s also a Microsoft CBL-Delridge?</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.zdnet.com/a/fly/bundles/zdnetcore/images/logos/zdnet-logo-yellow.png" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"><span class="kg-bookmark-author">ZDNET</span><span class="kg-bookmark-publisher">Mary Jo Foley</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.zdnet.com/a/img/resize/ff7f0938e2b0e93dd1f12a7f18230171d4737e81/2022/05/13/d777c037-52bb-480a-9606-69272b944e0e/microsoftlinuxcbldelridge.jpg?auto=webp&amp;fit=crop&amp;height=675&amp;width=1200" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"></div></a></figure><p>The only external use of CBL-Delridge by Microsoft, to my knowledge, was in Azure Cloud Shell, the shell built into Azure&apos;s web portal interface and Windows Terminal:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-1.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="1755" height="750" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-1.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/11/image-1.png 1000w, https://boxofcables.dev/content/images/size/w1600/2022/11/image-1.png 1600w, https://boxofcables.dev/content/images/2022/11/image-1.png 1755w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-2.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="498" height="343"></figure><p>But you will notice if you login to Azure Cloud Shell now, another Linux distro is powering ACS, Microsoft&apos;s CBL-Mariner:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-4.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="1650" height="797" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-4.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/11/image-4.png 1000w, https://boxofcables.dev/content/images/size/w1600/2022/11/image-4.png 1600w, https://boxofcables.dev/content/images/2022/11/image-4.png 1650w" sizes="(min-width: 720px) 720px"></figure><p>CBL is short for &quot;Common Base Linux&quot;, which originally appeared to apply to a whole family of Linux distros within Microsoft, but Microsoft appears to be increasingly consolidating efforts about CBL-Mariner.</p><p>Microsoft describes CBL-Mariner as &quot;an internal Linux distribution for Microsoft&#x2019;s cloud infrastructure and edge products and services&quot; but it now powers such diverse offerings as:</p><ul><li>Azure Cloud Shell</li><li>Azure Kubernetes Service (AKS)</li><li>The lightweight layer that runs above your distro of choice on Windows Subsystem for Linux (WSL)</li></ul><p>Unlike Debian and thus .deb-based CBL-Delridge, CBL-Mariner is .rpm-based, with .spec files borrowed from VMware&apos;s <a href="https://vmware.github.io/photon/">Photon OS</a>, <a href="openmamba ">openmamba</a>, and the <a href="https://start.fedoraproject.org/">Fedora Project</a>. The project also acknowledges <a href="https://www.linuxfromscratch.org/">Linux from Scratch</a>, so despite being .rpm-based, CBL-Mariner is not a derivative of Red Hat Enterprise Linux, Fedora, or SUSE Linux. It is something new.</p><p>Also unlike CBL-Delridge, Microsoft makes installable <a href="https://aka.ms/mariner-2.0-x86_64-iso">.ISO</a> images available for CBL-Mariner. </p><p>The GUI installer on the ISO is quite fast. A full installation on a VM with just 4GB of RAM took 64 seconds.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-15.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="1024" height="768" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-15.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/11/image-15.png 1000w, https://boxofcables.dev/content/images/2022/11/image-15.png 1024w" sizes="(min-width: 720px) 720px"></figure><p>And CBL-Mariner is proud of its install speed too:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-18.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="1024" height="768" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-18.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/11/image-18.png 1000w, https://boxofcables.dev/content/images/2022/11/image-18.png 1024w" sizes="(min-width: 720px) 720px"></figure><p>You can browse the packages available in CBL-Mariner&apos;s <a href="https://packages.microsoft.com/cbl-mariner/2.0/">default repository</a>. While there is no official GUI desktop, there are some interesting GNOME packages landing in the repository:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-14.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="360" height="172"></figure><p>Development on CBL-Mariner is quite active, with <a href="https://github.com/microsoft/CBL-Mariner/releases">223 releases</a> to date on both the 1.0 and 2.0 release branches:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-8.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="934" height="671" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-8.png 600w, https://boxofcables.dev/content/images/2022/11/image-8.png 934w" sizes="(min-width: 720px) 720px"></figure><p>CBL-Mariner even provides detailed instructions <a href="https://github.com/microsoft/CBL-Mariner/blob/2.0/toolkit/docs/how_it_works/0_intro.md">on how it is built</a>:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-9.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="966" height="633" srcset="https://boxofcables.dev/content/images/size/w600/2022/11/image-9.png 600w, https://boxofcables.dev/content/images/2022/11/image-9.png 966w" sizes="(min-width: 720px) 720px"></figure><p>And <a href="https://github.com/microsoft/CBL-Mariner/blob/2.0/toolkit/docs/building/building.md">how to build it yourself</a>:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/11/image-10.png" class="kg-image" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner" loading="lazy" width="569" height="605"></figure><p>You can learn more from CBL-Mariner&apos;s GitHub page:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/microsoft/CBL-Mariner"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - microsoft/CBL-Mariner: Linux OS for Azure 1P services and edge appliances</div><div class="kg-bookmark-description">Linux OS for Azure 1P services and edge appliances - GitHub - microsoft/CBL-Mariner: Linux OS for Azure 1P services and edge appliances</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">microsoft</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/5f971013549d1f44de7217a01c9581e8aa2fa62513bc64641388311dddccba30/microsoft/CBL-Mariner" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"></div></a></figure><p>Or Microsoft&apos;s official documentation for CBL-Mariner:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://microsoft.github.io/CBL-Mariner/docs/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">CBL-Mariner Documentation</div><div class="kg-bookmark-description">CBL-Mariner is an internal Linux distribution built by Microsoft for use in Azure</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://microsoft.github.io/CBL-Mariner/apple-touch-icon.png" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"><span class="kg-bookmark-author">CBL-Mariner</span><span class="kg-bookmark-publisher">Mariner Dev Team</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://microsoft.github.io/CBL-Mariner/assets/images/conor-sexton-hRemch0ZDwI-unsplash.jpg" alt="Microsoft&apos;s CBL-Delridge is 404, long live CBL-Mariner"></div></a></figure><p>So, the question is, is CBL-Mariner going to be Microsoft Linux?</p><figure class="kg-card kg-embed-card"><blockquote class="twitter-tweet"><p lang="en" dir="ltr">Kelsey works on the WSL 2 kernel, Jim oversees CBL Mariner, and Rachel works on CBL Mariner. <a href="https://t.co/DDVqXp9azD">https://t.co/DDVqXp9azD</a></p>&#x2014; Hayden Barnes (@unixterminal) <a href="https://twitter.com/unixterminal/status/1580703089991958528?ref_src=twsrc%5Etfw">October 13, 2022</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</figure>]]></content:encoded></item><item><title><![CDATA[Building custom WSL distro images with Podman]]></title><description><![CDATA[Use Podman on Windows to build custom WSL distro images.]]></description><link>https://boxofcables.dev/building-wsl-distro-images-with-podman/</link><guid isPermaLink="false">66ac089493c6612a36399ac0</guid><category><![CDATA[Windows Subsystem for Linux]]></category><category><![CDATA[Linux]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Sat, 30 Jul 2022 02:50:20 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/07/Screenshot-2022-07-29-224946.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2022/07/Screenshot-2022-07-29-224946.png" alt="Building custom WSL distro images with Podman"><p><a href="https://podman.io/">Podman</a> is a daemonless container engine for developing, managing, and running OCI Containers on Linux, but it now has support on Windows and macOS as well.</p><p>Podman is a drop-in replacement for the Docker client. If you know the Docker CLI syntax and Dockerfile format, you know Podman. </p><p>Like Docker, it is possible to generate WSL distro images with Podman. Podman is also available for your favorite Linux distribution on WSL and for Windows, using a custom WSL backend.</p><p>This guide will walk you through the process </p><p>In PowerShell:</p><h3 id="enable-wsl">Enable WSL</h3><pre><code>wsl.exe --install</code></pre><h3 id="install-scoop">Install Scoop</h3><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-4.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="916" height="248" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-4.png 600w, https://boxofcables.dev/content/images/2022/07/image-4.png 916w" sizes="(min-width: 720px) 720px"></figure><pre><code>Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex</code></pre><h3 id="install-podman">Install Podman</h3><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-5.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="916" height="267" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-5.png 600w, https://boxofcables.dev/content/images/2022/07/image-5.png 916w" sizes="(min-width: 720px) 720px"></figure><pre><code>scoop install podman</code></pre><h3 id="initiate-podman">Initiate Podman</h3><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-6.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="916" height="704" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-6.png 600w, https://boxofcables.dev/content/images/2022/07/image-6.png 916w" sizes="(min-width: 720px) 720px"></figure><pre><code>podman machine init</code></pre><h3 id="start-podman">Start Podman</h3><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-7.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="916" height="590" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-7.png 600w, https://boxofcables.dev/content/images/2022/07/image-7.png 916w" sizes="(min-width: 720px) 720px"></figure><pre><code>podman machine start</code></pre><h3 id="create-a-base-containerfile">Create a base Containerfile</h3><p>Containerfile is the successor to the Dockerfile. The syntax is the same and has become a standard, called the <a href="https://opencontainers.org/about/overview/">OCI container format</a>.</p><p>We are going to create a very simple container image from an upstream container image of Ubuntu 22.04, <code>ubuntu:jammy</code>, add some useful packages-like Podman, and save it as Containerfile:</p><pre><code>FROM ubuntu:jammy
RUN apt update &amp;&amp; apt upgrade -y &amp;&amp; apt install ca-certificates podman -y</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-8.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="1216" height="608" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-8.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/07/image-8.png 1000w, https://boxofcables.dev/content/images/2022/07/image-8.png 1216w" sizes="(min-width: 720px) 720px"></figure><h3 id="build-the-container">Build the Container</h3><p>Back in Terminal, let&apos;s build our ContainerFile with Podman:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-9.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="1115" height="495" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-9.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/07/image-9.png 1000w, https://boxofcables.dev/content/images/2022/07/image-9.png 1115w" sizes="(min-width: 720px) 720px"></figure><pre><code>podman build --file .\Containerfile . --tag customjammy:latest</code></pre><h3 id="initiate-the-container">Initiate the Container</h3><p>We need to run our new container, customjammy, one time to initiate it:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-10.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="979" height="362" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-10.png 600w, https://boxofcables.dev/content/images/2022/07/image-10.png 979w" sizes="(min-width: 720px) 720px"></figure><pre><code>podman run -t customjammy:latest echo &quot;Hello World!&quot;</code></pre><h3 id="export-the-container-as-a-tar-file">Export the Container as a .Tar File</h3><p>Now we can export the container a .tar file to import into WSL:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-11.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="979" height="362" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-11.png 600w, https://boxofcables.dev/content/images/2022/07/image-11.png 979w" sizes="(min-width: 720px) 720px"></figure><pre><code>podman export --output customjammy.tar $(podman ps -a --format &quot;{{.Names}}&quot;)</code></pre><h3 id="import-tar-file-into-wsl">Import .Tar file into WSL</h3><p>First we create a directory to store our imported distro:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-12.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="979" height="362" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-12.png 600w, https://boxofcables.dev/content/images/2022/07/image-12.png 979w" sizes="(min-width: 720px) 720px"></figure><pre><code>mkdir C:\WSL\customjammy</code></pre><p>Next we import our distro, now bundled into a .tar file, into WSL:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-13.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="1042" height="362" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-13.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/07/image-13.png 1000w, https://boxofcables.dev/content/images/2022/07/image-13.png 1042w" sizes="(min-width: 720px) 720px"></figure><pre><code>wsl --import &quot;My-Ubuntu-Jammy&quot; C:\WSL\customjammy .\customjammy.tar</code></pre><h3 id="run-imported-wsl-distro">Run Imported WSL Distro</h3><p>Finally, we can run our imported distro with the <code>wsl.exe -d</code> command:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-14.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="1042" height="362" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-14.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/07/image-14.png 1000w, https://boxofcables.dev/content/images/2022/07/image-14.png 1042w" sizes="(min-width: 720px) 720px"></figure><pre><code>wsl.exe -d My-Ubuntu-Jammy</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-15.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="1042" height="533" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-15.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/07/image-15.png 1000w, https://boxofcables.dev/content/images/2022/07/image-15.png 1042w" sizes="(min-width: 720px) 720px"></figure><p>We can <code>cat</code> the <code>/etc/os-release</code> file to verify we are running Ubuntu 22.04 Jammy Jellyfish:</p><pre><code>cat /etc/os-release</code></pre><p>When you restart Windows Terminal you should be able to see <code>My-Ubuntu-Jammy</code> in the drop-down menu:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-16.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="799" height="400" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-16.png 600w, https://boxofcables.dev/content/images/2022/07/image-16.png 799w" sizes="(min-width: 720px) 720px"></figure><p>You can also set your new distro as the default profile in Windows Terminal settings:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/07/image-17.png" class="kg-image" alt="Building custom WSL distro images with Podman" loading="lazy" width="1372" height="486" srcset="https://boxofcables.dev/content/images/size/w600/2022/07/image-17.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/07/image-17.png 1000w, https://boxofcables.dev/content/images/2022/07/image-17.png 1372w" sizes="(min-width: 720px) 720px"></figure><p>This process can be done with any upstream image available on Dockerhub, Quay, or other Linux container registry.</p><p>You can further customize your image using standard OCI commands, like pre-installing packages and setting custom settings.</p>]]></content:encoded></item><item><title><![CDATA[Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined]]></title><description><![CDATA[Getting a scalable AI/ML model training environment set up and running on WSL 2, with Docker Desktop and CUDA GPU compute.]]></description><link>https://boxofcables.dev/running-determined-ai-on-wsl-2/</link><guid isPermaLink="false">66ac089493c6612a36399abd</guid><category><![CDATA[Windows Subsystem for Linux]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Tue, 21 Jun 2022 05:42:37 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/06/Screenshot-2022-06-21-011700-2.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2022/06/Screenshot-2022-06-21-011700-2.png" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined"><p>Determined is an open source platform for AI/ML model development and training at scale.</p><p>Determined handles the provisioning of machines, networking, data loading, and provides fault tolerance.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-22.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1053" height="777" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-22.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-22.png 1000w, https://boxofcables.dev/content/images/2022/06/image-22.png 1053w" sizes="(min-width: 720px) 720px"></figure><p>It allows AI/ML engineers to pool and share computing resources, track experiments, and supports deep learning frameworks like PyTorch, TensorFlow, and Keras.</p><p>I am still learning about AI/ML. My interest was piqued after GPU compute arrived on Windows Subsystem for Linux (WSL), starting with CUDA.</p><p>Determined seems like a very cool and easy to use platform to learn more on, it offers a web-based dashboard and includes a built-in AI/ML IDE.</p><p>There are several ways to deploy Determined, including <code>pip</code> , and to use Determined, like a terminal cli tool, <code>det</code>. </p><p>My preference is a more cloud native approach deploying with containers and interacting through the web-based dashboard.</p><p>This guide will cover setting up a local Determined deployment on WSL 2 with Docker Desktop.</p><p>We will:</p><ul><li>Verify a working GPU setup on WSL</li><li>Deploy a database backend container</li><li>Deploy a Determined master node container connected to the database</li><li>Deploy and connect a Determined agent node container to the Determined master node</li><li>Launch the JupyterLab IDE in the Determined web interface</li></ul><p>Requirements for this tutorial:</p><ul><li>Windows 11 (recommended) or Windows 10 21H2</li><li>Windows Subsystem for Linux Preview <a href="https://www.microsoft.com/store/productId/9P9TQF7MRM4R">from the Microsoft Store</a> (recommended) or the standard Windows Subsystem for Linux feature but run <code>wsl.exe --update</code> to make sure you have the latest WSL kernel</li><li>The latest NVIDIA GPU drivers <a href="https://www.nvidia.com/download/index.aspx">directly from NVIDIA</a>, not just Windows Update drivers</li><li>Any WSL distro</li><li>Docker Desktop 4.9+ installed with WSL integration enabled for the WSL distro you are going to be working in</li><li>A CUDA-enabled NVIDIA GPU, e.g. GeForce RTX 1080 or higher*</li></ul><p>*This workflow <em>does work</em> without a CUDA-enabled NVDIA GPU but will default to CPU-only if no GPU is available.</p><h2 id="links">Links</h2><ul><li><a href="https://www.determined.ai/">Determined.AI</a></li><li><a href="https://docs.determined.ai/latest/">Determined Docs</a></li><li><a href="https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl">Enable NVIDIA CUDA on WSL</a> (Microsoft Docs)</li></ul><h2 id="basics">Basics</h2><p>Verify that Docker Desktop is accessible from WSL 2:</p><pre><code>docker --version</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1033" height="191" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image.png 1000w, https://boxofcables.dev/content/images/2022/06/image.png 1033w" sizes="(min-width: 720px) 720px"></figure><p>This should not be docker-ce or an equivalent installed in WSL, but the aliases Docker Desktop places using WSL integration:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-3.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1186" height="699" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-3.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-3.png 1000w, https://boxofcables.dev/content/images/2022/06/image-3.png 1186w" sizes="(min-width: 720px) 720px"></figure><p>Verify that GPU support is working in Docker and WSL 2:</p><pre><code>docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-2.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1051" height="476" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-2.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-2.png 1000w, https://boxofcables.dev/content/images/2022/06/image-2.png 1051w" sizes="(min-width: 720px) 720px"></figure><p>Note my NVIDIA GeForce 2070 Super is visible in <code>nvidia-smi</code> output.</p><h2 id="set-up-postgresql">Set up PostgreSQL</h2><p>Start an instance of PostgreSQL:</p><pre><code>docker run -d --name determined-db -p 5432:5432 -v determined_db:/var/lib/postgresql/data -e POSTGRES_DB=determined -e POSTGRES_PASSWORD=password postgres:10</code></pre><p>I recommend changing your password to anything besides <code>password</code>.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-6.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1114" height="286" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-6.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-6.png 1000w, https://boxofcables.dev/content/images/2022/06/image-6.png 1114w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-4.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1186" height="600" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-4.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-4.png 1000w, https://boxofcables.dev/content/images/2022/06/image-4.png 1186w" sizes="(min-width: 720px) 720px"></figure><h2 id="get-your-wsl-ip-address">Get your WSL IP address</h2><p>Grab your WSL instance&apos;s <code>eth0</code> IP address from <code>ip</code>, parse it using <code>sed</code>, and stash it as an environmental variable <code>$WSLIP</code>:</p><pre><code>WSLIP=$(ip -f inet addr show eth0 | sed -En -e &apos;s/.*inet ([0-9.]+).*/\1/p&apos;)</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-7.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1114" height="286" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-7.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-7.png 1000w, https://boxofcables.dev/content/images/2022/06/image-7.png 1114w" sizes="(min-width: 720px) 720px"></figure><h2 id="start-the-determined-master-node">Start the Determined Master Node</h2><p>Start up an instance of the determined-master image, connected to the PostgreSQL <code>determined</code> database we spun up on port 5432:</p><pre><code>docker run -d --name determined-master -p 8080:8080 -e DET_DB_HOST=$WSLIP -e DET_DB_NAME=determined -e DET_DB_PORT=5432 -e DET_DB_USER=postgres -e DET_DB_PASSWORD=password determinedai/determined-master:latest </code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-8.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1114" height="286" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-8.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-8.png 1000w, https://boxofcables.dev/content/images/2022/06/image-8.png 1114w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-9.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1186" height="600" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-9.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-9.png 1000w, https://boxofcables.dev/content/images/2022/06/image-9.png 1186w" sizes="(min-width: 720px) 720px"></figure><p>Launch the Determined Master Node web dashboard:</p><pre><code>powershell.exe /c start http://$WSLIP:8080</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-11.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1118" height="579" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-11.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-11.png 1000w, https://boxofcables.dev/content/images/2022/06/image-11.png 1118w" sizes="(min-width: 720px) 720px"></figure><p>Use the default <code>admin</code> account, no password, to log in.</p><p>Now you have access to the Determined dashboard. </p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-12.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1021" height="758" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-12.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-12.png 1000w, https://boxofcables.dev/content/images/2022/06/image-12.png 1021w" sizes="(min-width: 720px) 720px"></figure><p>But we do not have any agents connected to run experiments on.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-13.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-13.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-13.png 1000w, https://boxofcables.dev/content/images/2022/06/image-13.png 1093w" sizes="(min-width: 720px) 720px"></figure><h2 id="attach-a-determined-agent-node">Attach a Determined Agent Node</h2><p>Start up an instance of the determined-agent image, pointed at our Determined Master host IP ($WSLIP) and port (8080):</p><pre><code>docker run -d --gpus all -v /var/run/docker.sock:/var/run/docker.sock --name determined-agent -e DET_MASTER_HOST=$WSLIP -e DET_MASTER_PORT=8080 -e NVIDIA_DRIVER_CAPABILITIES=compute,utility determinedai/determined-agent:latest</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-17.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="961" height="210" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-17.png 600w, https://boxofcables.dev/content/images/2022/06/image-17.png 961w" sizes="(min-width: 720px) 720px"></figure><p>Note:</p><ul><li>Include <code>--gpus all</code> is to pass-through our NVIDIA GPU to the determined-agent container.</li><li>Set <code>NVIDIA_DRIVER_CAPABILITIES</code> to also include <code>compute</code>, overriding the determined-agent default of just <code>utility</code>. This enables the agent to detect the pass-through CUDA GPU. This <a href="https://github.com/determined-ai/determined/issues/4384">issue was documented</a> and I submitted a <a href="https://github.com/determined-ai/determined/pull/4385">PR</a>.</li><li>If you do not have an CUDA-enabled GPU and wish to use CPU only, use:</li></ul><pre><code>docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name determined-agent -e DET_MASTER_HOST=$WSLIP -e DET_MASTER_PORT=8080 determinedai/determined-agent:latest</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-15.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1186" height="600" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-15.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-15.png 1000w, https://boxofcables.dev/content/images/2022/06/image-15.png 1186w" sizes="(min-width: 720px) 720px"></figure><p>Return to the Determined dashboard, to see our clusters:</p><pre><code>powershell.exe /c start http://$WSLIP:8080/det/clusters</code></pre><p>We can now see 1 connected agent and 0/1 CUDA slots allocated, ready for training deep learning models:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-18.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-18.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-18.png 1000w, https://boxofcables.dev/content/images/2022/06/image-18.png 1093w" sizes="(min-width: 720px) 720px"></figure><p>Click <code>Launch JupyterLab</code> to spin up a web-based Python IDE for notebooks, code, and data:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-19.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-19.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-19.png 1000w, https://boxofcables.dev/content/images/2022/06/image-19.png 1093w" sizes="(min-width: 720px) 720px"></figure><p>And our available CUDA GPU will be automatically assigned. You can see how it is provisioned and visible in the Determined dashboard:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/1-2.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/1-2.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/1-2.png 1000w, https://boxofcables.dev/content/images/2022/06/1-2.png 1093w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/Screenshot-2022-06-21-011700-1.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/Screenshot-2022-06-21-011700-1.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/Screenshot-2022-06-21-011700-1.png 1000w, https://boxofcables.dev/content/images/2022/06/Screenshot-2022-06-21-011700-1.png 1093w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/Screenshot-2022-06-21-011710-1.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/Screenshot-2022-06-21-011710-1.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/Screenshot-2022-06-21-011710-1.png 1000w, https://boxofcables.dev/content/images/2022/06/Screenshot-2022-06-21-011710-1.png 1093w" sizes="(min-width: 720px) 720px"></figure><p>And now we have a CUDA-accelerated <a href="https://docs.jupyter.org/en/latest/">JupyterLab</a> Python AI/ML IDE:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-20.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-20.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-20.png 1000w, https://boxofcables.dev/content/images/2022/06/image-20.png 1093w" sizes="(min-width: 720px) 720px"></figure><p>We can even start up additional CPU-only Determined worker agents:</p><pre><code>docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name determined-agent-2 -e DET_MASTER_HOST=$WSLIP -e DET_MASTER_PORT=8080 determinedai/determined-agent:latest</code></pre><p>Note the tweaked the name of the image to <code>determined-agent-2</code>.</p><p>And see those resources available in the Determined web dashboard:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/06/image-21.png" class="kg-image" alt="Running a massively scalable CUDA-accelerated AI/ML lab on WSL 2 with Determined" loading="lazy" width="1093" height="911" srcset="https://boxofcables.dev/content/images/size/w600/2022/06/image-21.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/06/image-21.png 1000w, https://boxofcables.dev/content/images/2022/06/image-21.png 1093w" sizes="(min-width: 720px) 720px"></figure><h2 id="notes">Notes</h2><ul><li>When stopping determined-agent, be sure to stop determined-fluent too.</li></ul>]]></content:encoded></item><item><title><![CDATA[Creating A Lightweight Windows Container Dev Environment without Docker Desktop]]></title><description><![CDATA[Working with Windows Containers without Docker Desktop from PowerShell.]]></description><link>https://boxofcables.dev/a-lightweight-windows-container-dev-environment/</link><guid isPermaLink="false">66ac089493c6612a36399abc</guid><category><![CDATA[Windows]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Mon, 28 Feb 2022 20:57:46 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/02/Screenshot-2022-02-28-151815.png" medium="image"/><content:encoded><![CDATA[<h3 id="introduction">Introduction</h3><img src="https://boxofcables.dev/content/images/2022/02/Screenshot-2022-02-28-151815.png" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop"><p>If you are getting started with Windows Container development, one option is to install Docker Desktop.</p><p>Docker Desktop gives you access to both Windows Containers and Linux containers, by leveraging WSL 2.</p><p>Another option may eventually be Rancher Desktop if they <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/255">add Windows support</a>, but it is currently limited to Linux containers.</p><p>But if you prefer a lighter, command line approach to working with Windows Containers, it is possible to install and use Docker static binaries without Docker Desktop.</p><p>The Docker static binaries are distributed under the <a href="https://github.com/moby/moby/blob/master/LICENSE">Apache 2 license</a> and do not require a Docker Desktop subscription, even for commercial use.</p><p>The downside to this approach is that Docker static binaries on Windows do not support Linux containers, <code>buildx</code>, <code>docker scan</code>, or <code>docker compose</code> functionality.</p><p>The flip side though is that if you are the type that prefers minimal command line interfaces then you can also install &apos;native&apos; Linux <a href="https://dev.to/bowmanjd/install-docker-on-windows-wsl-without-docker-desktop-34m9">Docker on WSL 2 without Docker Desktop</a> and switch back and forth as needed.</p><h3 id="requirements">Requirements</h3><p>Windows Containers requires Windows 10/11 Pro or Enterprise version 1607 or higher. </p><p>To get started, in Windows Features enable:</p><ul><li>Containers</li><li>Hyper-V</li></ul><p>and reboot if necessary.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-28.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="415" height="368"></figure><p>Alternatively, you can open PowerShell as Administrator and run:</p><pre><code>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enable-WindowsOptionalFeature -Online -FeatureName Containers</code></pre><h3 id="install-scoop">Install <a href="https://scoop.sh/">Scoop</a></h3><p>Open <a href="https://www.microsoft.com/store/productId/9P95ZZKTNRN4">PowerShell</a> as your normal user, ideally in the new <a href="https://www.microsoft.com/store/productId/9N8G5RFZ9XK3">Windows Terminal</a>, and run:</p><pre><code>Invoke-Expression (New-Object System.Net.WebClient).DownloadString(&apos;https://get.scoop.sh&apos;)</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-30.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1056" height="438" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-30.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-30.png 1000w, https://boxofcables.dev/content/images/2022/02/image-30.png 1056w" sizes="(min-width: 720px) 720px"></figure><p>If you get an error about PowerShell script execution policy:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-45.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="912" height="161" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-45.png 600w, https://boxofcables.dev/content/images/2022/02/image-45.png 912w" sizes="(min-width: 720px) 720px"></figure><p>You need to change the execution policy with:</p><pre><code>Set-ExecutionPolicy RemoteSigned -scope CurrentUser</code></pre><p>Then re-run:</p><pre><code>Invoke-Expression (New-Object System.Net.WebClient).DownloadString(&apos;https://get.scoop.sh&apos;)</code></pre><h3 id="install-useful-scoop-tools">Install Useful Scoop Tools</h3><p>In PowerShell use Scoop to install tools that improve the use of Scoop, specifically git and aria2. git enables Scoop to update itself. aria2 speeds up downloads.</p><pre><code>scoop install git aria2</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-31.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1056" height="438" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-31.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-31.png 1000w, https://boxofcables.dev/content/images/2022/02/image-31.png 1056w" sizes="(min-width: 720px) 720px"></figure><h3 id="install-docker-binaries">Install Docker Binaries</h3><p>In PowerShell use Scoop to install the Docker static binaries:</p><pre><code>scoop install docker</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-32.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1056" height="457" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-32.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-32.png 1000w, https://boxofcables.dev/content/images/2022/02/image-32.png 1056w" sizes="(min-width: 720px) 720px"></figure><h3 id="enable-the-docker-service-in-windows">Enable the Docker Service in Windows</h3><p>We now need to enable and start the Docker Service in Windows. This requires a PowerShell instance with elevated privileges as Administrator. In PowerShell start an elevated shell with:</p><pre><code>Start-Process PowerShell -verb RunAs</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-33.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="840" height="286" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-33.png 600w, https://boxofcables.dev/content/images/2022/02/image-33.png 840w" sizes="(min-width: 720px) 720px"></figure><p>Enable the elevated PowerShell to make changes in the prompt. Then in the elevated PowerShell run:</p><pre><code>dockerd --register-service ; Start-Service docker ; exit</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-36.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1056" height="418" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-36.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-36.png 1000w, https://boxofcables.dev/content/images/2022/02/image-36.png 1056w" sizes="(min-width: 720px) 720px"></figure><p>This will register the service, start it, and then exit the elevated Administrator shell. If you open Services, you should now see the Docker Engine listed:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-46.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="806" height="593" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-46.png 600w, https://boxofcables.dev/content/images/2022/02/image-46.png 806w" sizes="(min-width: 720px) 720px"></figure><p>It will start automatically on Windows boot. If desired, you can configure it using Services to only start it manually.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-38.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="406" height="468"></figure><h3 id="enable-user-access-to-docker-service">Enable User Access To Docker Service</h3><p>By default, non-privileged Windows users cannot reach the Docker Service. At this point if you run <code>docker run hello-world:nanoserver</code> as a non-privileged user, you will encounter the following error:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-39.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="840" height="286" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-39.png 600w, https://boxofcables.dev/content/images/2022/02/image-39.png 840w" sizes="(min-width: 720px) 720px"></figure><pre><code>docker: error during connect: This error may indicate that the docker daemon is not running.: Post &quot;http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create&quot;: open //./pipe/docker_engine: Access is denied.
See &apos;docker run --help&apos;.</code></pre><p>There are two solutions.</p><p><strong>One</strong>, to always use an elevated PowerShell to work with Docker. This is quick and easy but <u>is not advised</u>. One mistake and you can cause irreparable damage to your Windows installation. You can even configure this in Windows Terminal:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-56.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1409" height="686" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-56.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-56.png 1000w, https://boxofcables.dev/content/images/2022/02/image-56.png 1409w" sizes="(min-width: 720px) 720px"></figure><p><strong>Second</strong>, <u>my recommended method</u>, is to use <code>dockeraccesshelper</code> to enable and configure access to the Docker Service for non-privileged users.</p><h3 id="install-dockeraccesshelper">Install <a href="https://github.com/tfenster/dockeraccesshelper">dockeraccesshelper</a></h3><p><code>dockeraccesshelper</code> is an open source PowerShell module to allow non-privileged users to connect to the Docker Service.</p><p>To configure <code>dockeraccess</code> module, open another elevated PowerShell:</p><pre><code>Start-Process PowerShell -verb RunAs</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-33.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="840" height="286" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-33.png 600w, https://boxofcables.dev/content/images/2022/02/image-33.png 840w" sizes="(min-width: 720px) 720px"></figure><p>Enable the elevated PowerShell to make changes. Then in the elevated PowerShell install <code>dockeraccesshelper</code> with:</p><pre><code>Install-Module -Name dockeraccesshelper</code></pre><p>Accepting all the prompts.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-41.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1043" height="483" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-41.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-41.png 1000w, https://boxofcables.dev/content/images/2022/02/image-41.png 1043w" sizes="(min-width: 720px) 720px"></figure><p>Import the <code>dockeraccesshelper</code> module with:</p><pre><code>Import-Module dockeraccesshelper</code></pre><p>Note, if you encounter the following error:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-42.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1030" height="473" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-42.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-42.png 1000w, https://boxofcables.dev/content/images/2022/02/image-42.png 1030w" sizes="(min-width: 720px) 720px"></figure><p>Run the following to enable execution of remote signed PowerShell scripts for the current user:</p><pre><code>Set-ExecutionPolicy RemoteSigned -scope CurrentUser</code></pre><p>Then re-run:</p><pre><code>Import-Module dockeraccesshelper</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-47.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1050" height="485" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-47.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-47.png 1000w, https://boxofcables.dev/content/images/2022/02/image-47.png 1050w" sizes="(min-width: 720px) 720px"></figure><p>Finally, we need to configure <code>dockeraccesshelper</code> by running:</p><pre><code>Add-AccountToDockerAccess DOMAIN\USERNAME</code></pre><p>Substituting DOMAIN and USERNAME for the domain and username of your <em>non-privileged user</em>.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-49.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1042" height="469" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-49.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-49.png 1000w, https://boxofcables.dev/content/images/2022/02/image-49.png 1042w" sizes="(min-width: 720px) 720px"></figure><p>If you are not sure what your domain and username are, you can use the <code>whoami</code> command in the PowerShell shell <em>of your non-privileged user</em>, then copy and paste it into the elevated PowerShell:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-48.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="840" height="286" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-48.png 600w, https://boxofcables.dev/content/images/2022/02/image-48.png 840w" sizes="(min-width: 720px) 720px"></figure><p>Then exit your elevated PowerShell and return to your non-privileged PowerShell with <code>exit</code>:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-50.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1031" height="465" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-50.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-50.png 1000w, https://boxofcables.dev/content/images/2022/02/image-50.png 1031w" sizes="(min-width: 720px) 720px"></figure><p>If we return to the non-privileged PowerShell, we can re-run <code>docker run hello-world:nanoserver</code>:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-51.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1029" height="419" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-51.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-51.png 1000w, https://boxofcables.dev/content/images/2022/02/image-51.png 1029w" sizes="(min-width: 720px) 720px"></figure><p>And with everything right we should see:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-52.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1029" height="609" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-52.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-52.png 1000w, https://boxofcables.dev/content/images/2022/02/image-52.png 1029w" sizes="(min-width: 720px) 720px"></figure><p>You now have a lightweight environment configured for working with Windows containers using Docker from PowerShell.</p><p>At rest, dockerd uses about 20MB of RAM:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-53.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="666" height="593" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-53.png 600w, https://boxofcables.dev/content/images/2022/02/image-53.png 666w"></figure><h3 id="build-example-windows-container">Build Example Windows Container</h3><p>I have a <a href="https://github.com/sirredbeard/nim-windows-container/blob/main/Dockerfile">Dockerfile</a> that builds a Windows container with a development environment for the <a href="https://nim-lang.org/">Nim programming language</a>.</p><p>You can clone the repository with:</p><pre><code>git clone https://github.com/sirredbeard/nim-windows-container</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-54.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="993" height="305" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-54.png 600w, https://boxofcables.dev/content/images/2022/02/image-54.png 993w" sizes="(min-width: 720px) 720px"></figure><p>Drop down into the directory:</p><pre><code>cd .\nim-windows-container\</code></pre><p>And build it locally with:</p><pre><code>docker build . --file Dockerfile --tag nimstable-ltsc2022</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-55.png" class="kg-image" alt="Creating A Lightweight Windows Container Dev Environment without Docker Desktop" loading="lazy" width="1029" height="457" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-55.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-55.png 1000w, https://boxofcables.dev/content/images/2022/02/image-55.png 1029w" sizes="(min-width: 720px) 720px"></figure><p>Or, alternatively, pull it directly from the GitHub package repository with:</p><pre><code>docker pull ghcr.io/sirredbeard/nim-windows-container/nimstable-ltsc2022:latest</code></pre><p>To start playing with it and see how Windows Containers are built.</p><h3 id="maintenance">Maintenance</h3><p>To update Scoop, run:</p><pre><code>scoop update</code></pre><p>To update Docker using Scoop, run:</p><pre><code>scoop update docker</code></pre><h3 id="additional-windows-container-documentation">Additional Windows Container Documentation</h3><ul><li><a href="https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/run-your-first-container">Run your first Windows Container</a></li><li><a href="https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/building-sample-app">Containerize a .NET Core App</a></li></ul>]]></content:encoded></item><item><title><![CDATA[Building CBL-Delridge, Microsoft's other Linux distro]]></title><description><![CDATA[Microsoft has another Linux distro you probably haven't heard of. You can easily build it and even import it into WSL.]]></description><link>https://boxofcables.dev/building-cbl-d-microsofts-other-linux-distro/</link><guid isPermaLink="false">66ac089493c6612a36399abb</guid><category><![CDATA[Windows Subsystem for Linux]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Wed, 02 Feb 2022 23:17:45 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/02/Untitled-2.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2022/02/Untitled-2.png" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"><p>Microsoft maintains a handful of Linux distributions. You may have heard of CBL-Mariner:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/microsoft/CBL-Mariner"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - microsoft/CBL-Mariner: Linux OS for Azure 1P services and edge appliances</div><div class="kg-bookmark-description">Linux OS for Azure 1P services and edge appliances - GitHub - microsoft/CBL-Mariner: Linux OS for Azure 1P services and edge appliances</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">microsoft</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/0eaf653d5ddeebeb0e6ebeb78b563d03e4e10fe9297a7a309dc4fa05e651cd9d/microsoft/CBL-Mariner" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.zdnet.com/article/cbl-mariner-microsofts-internal-linux-distribution-for-azure-first-party-services-and-edge-appliances/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">CBL-Mariner: Microsoft&#x2019;s internal Linux distribution for Azure first-party services and edge appliances | ZDNet</div><div class="kg-bookmark-description">The Linux Systems Group at Microsoft has developed a Linux distribution for internal use and made it available on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.zdnet.com/a/fly/bundles/zdnetcss/images/logos/logo-192x192.png" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"><span class="kg-bookmark-author">ZDNet</span><span class="kg-bookmark-publisher">Mary Jo Foley</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.zdnet.com/a/img/resize/121d8aeb806fe057858b5a459965eb0e819f3469/2020/11/11/c3e91470-b834-4b2d-aefc-dce07cca519d/cbllinuxmicrosoft.jpg?width=770&amp;height=578&amp;fit=crop&amp;auto=webp" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"></div></a></figure><p>CBL-Mariner is used across Microsoft, including Azure and to power <a href="https://github.com/microsoft/wslg">WSLg</a> on WSL 2.</p><p>You may also have heard of Microsoft&apos;s earlier networking Linux distro, SONiC:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://en.wikipedia.org/wiki/SONiC_(operating_system)"><div class="kg-bookmark-content"><div class="kg-bookmark-title">SONiC (operating system) - Wikipedia</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://en.wikipedia.org/static/apple-touch/wikipedia.png" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"><span class="kg-bookmark-author">Wikimedia Foundation, Inc.</span><span class="kg-bookmark-publisher">Contributors to Wikimedia projects</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Free_and_open-source_software_logo_(2009).svg/28px-Free_and_open-source_software_logo_(2009).svg.png" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.theregister.com/2016/03/09/microsoft_sonic_debian/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Microsoft has crafted a switch OS on Debian Linux. Repeat, a switch OS on Debian Linux</div><div class="kg-bookmark-description">Toolkit for wrangling networks released</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.theregister.com/design_picker/4ee431b84ac2d23c13376f753522acd7ecbb9b47/graphics/favicons/apple-touch-icon.png" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"><span class="kg-bookmark-author">The Register</span><span class="kg-bookmark-publisher">Chris Williams</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://regmedia.co.uk/2016/03/09/debian_tattoo.jpg" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro"></div></a></figure><p>Did you know Microsoft also maintains yet another Linux distribution, CBL-Delridge? </p><p>Searches for it on Google bring up...CBL-Mariner and a mention of CBL-Delridge on my <a href="https://github.com/sirredbeard/microsoft-opensource">Microsoft Open Source</a> timeline:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-27.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="702" height="720" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-27.png 600w, https://boxofcables.dev/content/images/2022/02/image-27.png 702w"></figure><p>CBL-Delridge is used to power Azure&apos;s Cloud Shell:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-5.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="978" height="900" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-5.png 600w, https://boxofcables.dev/content/images/2022/02/image-5.png 978w" sizes="(min-width: 720px) 720px"></figure><p>Unlike CBL-Mariner, which is built from scratch, CBL-Delridge is based on Debian, specifically version 10, codenamed Buster.</p><p>The current version of CBL-<a href="https://en.wikipedia.org/wiki/Delridge,_Seattle">Delridge</a>, or CBL-D for short, is coincidentally also version 10, codenamed <a href="https://www.nps.gov/olym/planyourvisit/visiting-quinault.htm">Quinault</a>.</p><p>The apt package repositories for CBL-D are public and therefore it is possible to build our own image of CBL-D for our own purposes and even import it into WSL.</p><p>First, we need debootstrap. debootstrap allows you to bootstrap Debian-family distributions from apt repositories. deboostrap can be found in most other distro package repositories, including openSUSE.</p><p>On openSUSE install debootstrap with:</p><pre><code>sudo zypper in -y debootstrap</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-7.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1035" height="472" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-7.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-7.png 1000w, https://boxofcables.dev/content/images/2022/02/image-7.png 1035w" sizes="(min-width: 720px) 720px"></figure><p>Next we need to create a <a href="https://wiki.archlinux.org/title/Chroot">chroot</a>, a new root directory folder to bootstrap the CBL-D image into:</p><pre><code>mkdir /tmp/chroot</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-8.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1035" height="472" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-8.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-8.png 1000w, https://boxofcables.dev/content/images/2022/02/image-8.png 1035w" sizes="(min-width: 720px) 720px"></figure><p>Then we need to give debootstrap some very basic information about CBL-D. debootstrap includes this info for common Debian family distributions, including Debian, Kali, Ubuntu, and Devuan:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-9.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1035" height="472" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-9.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-9.png 1000w, https://boxofcables.dev/content/images/2022/02/image-9.png 1035w" sizes="(min-width: 720px) 720px"></figure><p>No Quinault here though. But Quinault is based on Debian Buster, so we can just copy the debootstrap script for Buster and debootstrap will find it and use it:</p><pre><code>sudo cp /usr/share/debootstrap/scripts/buster /usr/share/debootstrap/scripts/quinault</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-11.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1145" height="518" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-11.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-11.png 1000w, https://boxofcables.dev/content/images/2022/02/image-11.png 1145w" sizes="(min-width: 720px) 720px"></figure><p>Next, we fire up debootstrap with:</p><pre><code class="language-Bash">sudo debootstrap --arch &quot;amd64&quot; --include=gnupg,sudo,nano quinault /tmp/chroot https://packages.microsoft.com/repos/cbl-d/</code></pre><p>Our command specifies:</p><p><code>--arch &quot;amd64&quot;</code> because we are building for amd64. It is possible to cross-compile with debootstrap but it can be messy.</p><p><code>--include=gnupg,sudo,nano</code> to include these additional packages on top of the base Quinault image.</p><p><code>quinault</code> is the version name of our distro and the reason we copied the debootstrap script before.</p><p><code>/tmp/chroot</code> is where we want to bootstrap the image, into the new root filesystem.</p><p><a href="https://packages.microsoft.com/repos/cbl-d/"><code>https://packages.microsoft.com/repos/cbl-d/</code></a> is the location of the CBL-D apt repository.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-12.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1145" height="518" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-12.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-12.png 1000w, https://boxofcables.dev/content/images/2022/02/image-12.png 1145w" sizes="(min-width: 720px) 720px"></figure><p>If successful, we land at:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-13.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1145" height="518" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-13.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-13.png 1000w, https://boxofcables.dev/content/images/2022/02/image-13.png 1145w" sizes="(min-width: 720px) 720px"></figure><p>The contents of <code>/tmp/chroot</code> look like the root folder of any Linux distro:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-15.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1090" height="495" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-15.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-15.png 1000w, https://boxofcables.dev/content/images/2022/02/image-15.png 1090w" sizes="(min-width: 720px) 720px"></figure><p>We have a few more steps to complete though to make this a functional distro image we can use.</p><p>Our base image includes <a href="https://packages.microsoft.com/repos/cbl-d"><code>https://packages.microsoft.com/repos/cbl-d</code></a> in it&apos;s apt sources.list file, but there is an additional repository for CBL-D published by Microsoft that contains Go, Python, and a handful of utilities.</p><p>Add the additional repository to sources.list with:</p><pre><code>echo &apos;deb https://packages.microsoft.com/repos/cbl-d quinault-universe main&apos; | sudo tee -a /etc/apt/sources.list &gt; /dev/null</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-14.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1145" height="518" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-14.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-14.png 1000w, https://boxofcables.dev/content/images/2022/02/image-14.png 1145w" sizes="(min-width: 720px) 720px"></figure><p>The contents of <code>/tmp/chroot/etc/apt/sources.list</code> should now include:</p><pre><code>deb https://packages.microsoft.com/repos/cbl-d quinault main
deb https://packages.microsoft.com/repos/cbl-d quinault-universe main</code></pre><p>Finally, we need to add the security keys for the Microsoft CBL-D apt repository, otherwise <code>apt</code> cannot verify packages or perform upgrades. We do this by using the <code>chroot</code> command to run <code>apt-key</code> from inside our new chroot filesystem:</p><pre><code>sudo chroot /tmp/chroot/ /usr/bin/apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys EB3E94ADBE1229CF</code></pre><p>This runs <code>/usr/bin/apt-key</code> inside our chroot at <code>/tmp/chroot</code> as if <code>/tmp/chroot</code> was the root folder. It essentially runs the command on CBL-D <em>inside </em>CBL-D, even though it is just a folder on openSUSE.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-16.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1090" height="495" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-16.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-16.png 1000w, https://boxofcables.dev/content/images/2022/02/image-16.png 1090w" sizes="(min-width: 720px) 720px"></figure><p>Once we have imported the keys to apt to authenticate with the Microsoft repositories, we have a working image.</p><p>Now, we can play with CBL-D.</p><p>The easiest way to get started is to launch bash in the CBL-D chroot folder with:</p><pre><code>sudo chroot /tmp/chroot/ /bin/bash</code></pre><p>This is similar to how we used <code>chroot</code> to run the <code>apt-key</code> command, except this time spawning a shell we can explore with.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-17.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1090" height="495" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-17.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-17.png 1000w, https://boxofcables.dev/content/images/2022/02/image-17.png 1090w" sizes="(min-width: 720px) 720px"></figure><p>Now you are running as if <code>/tmp/chroot</code> was the root directory, so running <code>apt update</code> is going to check the Microsoft repository for upgrades for CBL-D, even here in a folder on openSUSE. You can exit the chroot with <code>exit</code> to go back to your host distro:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-20.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1090" height="656" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-20.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-20.png 1000w, https://boxofcables.dev/content/images/2022/02/image-20.png 1090w" sizes="(min-width: 720px) 720px"></figure><p>If you want to bundle up your chroot environment to import into WSL to play with, then we need to make a .tar.gz archive and then import with <code>wsl.exe --import</code>. Make sure if you used the command above you exit the chroot and go back to your host distro.</p><p>We create a tar of the chroot by:</p><pre><code>sudo tar -cpzf cbld-quinault.tar.gz -C /tmp/chroot/ .</code></pre><p><code>sudo</code> here is necessary because of some of the permissions on the bootstrapped file system.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-22.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1079" height="403" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-22.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-22.png 1000w, https://boxofcables.dev/content/images/2022/02/image-22.png 1079w" sizes="(min-width: 720px) 720px"></figure><p>Then we can import it as a WSL distro, <em>from inside WSL</em> or separate PowerShell, with:</p><pre><code>wsl.exe --import CBL-D &quot;C:\WSL\CBL-D&quot; cbld-quinault.tar.gz --version 2</code></pre><p>This command tells WSL to import a distro with:</p><p><code>CBL-D</code> as the name, which you can call with <code>wsl.exe -d CBL-D</code> or visible in Windows Terminal.</p><p>With the WSL files stored at <code>C:\WSL\CBL-D</code>.</p><p>From our <code>cbld-quinault.tar.gz</code> root filesystem archive.</p><p>As WSL 2 with <code>--version 2</code>.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-23.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1079" height="403" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-23.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-23.png 1000w, https://boxofcables.dev/content/images/2022/02/image-23.png 1079w" sizes="(min-width: 720px) 720px"></figure><p>Then you can launch CBL-D on WSL with:</p><pre><code>wsl.exe -d CBL-D</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-24.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1079" height="472" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-24.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-24.png 1000w, https://boxofcables.dev/content/images/2022/02/image-24.png 1079w" sizes="(min-width: 720px) 720px"></figure><p>Or re-open Windows Terminal and it will be visible in the drop-down menu:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-25.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="611" height="276" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-25.png 600w, https://boxofcables.dev/content/images/2022/02/image-25.png 611w"></figure><p>CBL-D is an abbreviated version of Debian, so all of your favorite packages might not be present. </p><p>There are about 1554 as of writing, compared to 28392 in Debian 10. I have posted <a href="https://gist.github.com/sirredbeard/34c209d656ee0cee706a0d530e5bfeea">a list here</a>, almost all console tools and the most basic X utilities.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-26.png" class="kg-image" alt="Building CBL-Delridge, Microsoft&apos;s other Linux distro" loading="lazy" width="1069" height="381" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-26.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-26.png 1000w, https://boxofcables.dev/content/images/2022/02/image-26.png 1069w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item><item><title><![CDATA[February 1 Live Stream: Trying (and failing) to install openSUSE and SmartOS on Vultr]]></title><description><![CDATA[<figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/rkeyAAsPRZw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure>]]></description><link>https://boxofcables.dev/february-1-live-stream-trying-and-failing-to-install-opensuse-and-smartos-on-vultr/</link><guid isPermaLink="false">66ac089493c6612a36399aba</guid><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Wed, 02 Feb 2022 01:43:16 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/02/Untitled-1.png" medium="image"/><content:encoded><![CDATA[<figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/rkeyAAsPRZw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure>]]></content:encoded></item><item><title><![CDATA[How Oracle saved rpm on WSL 1]]></title><description><![CDATA[Oracle to the rescue.]]></description><link>https://boxofcables.dev/how-oracle-saved-rpm-on-wsl-1/</link><guid isPermaLink="false">66ac089493c6612a36399ab9</guid><category><![CDATA[Windows Subsystem for Linux]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Tue, 01 Feb 2022 20:57:06 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/02/Untitled.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2022/02/Untitled.png" alt="How Oracle saved rpm on WSL 1"><p>Oracle Linux has been published <a href="https://www.microsoft.com/store/productId/9P06H18WXBVP">on the Microsoft Store for WSL</a>. Oracle Linux is compiled from the sources of Red Hat Enterprise Linux (RHEL). On WSL 2 you are going to get the Microsoft WSL 2 kernel by default. But notably Oracle Linux for bare metal and VMs is available with a choice of two Linux kernels, one that is guaranteed to be compatible with RHEL and one that is Oracle&apos;s custom kernel, called the <a href="https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/about-oracle-linux-and-the-unbreakable-enterprise-kernel.html">Unbreakable Enterprise Kernel</a> (UEK). Oracle Linux competes in the enterprise Linux space with RHEL and <a href="https://www.microsoft.com/store/productId/9NVGTG6752JM">SUSE Enterprise Linux</a> (SLES). </p><p>Unlike RHEL and SLES, Oracle Linux and it&apos;s package repositories are completely free, no subscription is required. Oracle even publishes <a href="https://linux.oracle.com/switch/centos/">a handy script</a> to switch from CentOS directly to Oracle Linux. This makes it an option for administrators running CentOS who want to remain downstream of RHEL and not go to CentOS Stream:</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-2.png" class="kg-image" alt="How Oracle saved rpm on WSL 1" loading="lazy" width="881" height="511" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-2.png 600w, https://boxofcables.dev/content/images/2022/02/image-2.png 881w" sizes="(min-width: 720px) 720px"></figure><p>Oracle Linux can then be managed alongside RHEL, Ubuntu, and SLES with <a href="https://www.suse.com/products/suse-manager/">SUSE Manager</a>.</p><p>Oracle Linux officially landing on WSL reminds me of a story about Oracle and WSL from 2019 I wanted to share.</p><p><code>rpm</code>, the Red Hat package manager, tool was very flaky on WSL 1. It saw frequent rpmdb corruption and would seg fault regularly, with issues reported back to early 2018.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-3.png" class="kg-image" alt="How Oracle saved rpm on WSL 1" loading="lazy" width="1017" height="502" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-3.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-3.png 1000w, https://boxofcables.dev/content/images/2022/02/image-3.png 1017w" sizes="(min-width: 720px) 720px"></figure><p>This issue affected Red Hat Enterprise Linux and all related distributions, including CentOS, Oracle Linux, Scientific Linux, and to a lesser extent Fedora. It occurred on Windows builds 17134 (1803) through 18383 (1909).</p><p>It, ironically, did not affect openSUSE or SUSE Enterprise Linux because even though zypper is based on <code>rpm</code>, SUSE had <a href="https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20#issuecomment-468068581">a patched rpm</a>, including the part that triggered this bug on WSL 1.</p><p>At <a href="https://www.whitewaterfoundry.com/">Whitewater Foundry</a>, we wanted to ship <a href="https://www.whitewaterfoundry.com/fedora-remix-for-wsl">Fedora Remix for WSL</a> and <a href="https://www.whitewaterfoundry.com/pengwin-enterprise">Pengwin Enterprise</a>, but <a href="https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20">this rpm bug</a> held back our progress. Pengwin Enterprise shipped with <a href="https://scientificlinux.org/">Scientific Linux</a> in the Microsoft Store but could be custom built with RHEL for enterprise customers with valid RHEL subscriptions.</p><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2022/02/image-4.png" class="kg-image" alt="How Oracle saved rpm on WSL 1" loading="lazy" width="1051" height="463" srcset="https://boxofcables.dev/content/images/size/w600/2022/02/image-4.png 600w, https://boxofcables.dev/content/images/size/w1000/2022/02/image-4.png 1000w, https://boxofcables.dev/content/images/2022/02/image-4.png 1051w" sizes="(min-width: 720px) 720px"></figure><p>I reached out to Red Hat, who we were partners with, for assistance in isolating the rpm bug on WSL 1. We had narrowed the bug down to the database function in rpm, related to a bad mmap function. </p><p>Unfortunately our relationship with Red Hat at the time was...complicated. </p><p>While the Red Hat partnership and sales teams were excited by our partnership, prominent figures in engineering were not happy at all. Unfortunately this meant Red Hat engineering would not help us with the rpm bug, even as mutual customers asked for help.</p><blockquote>While Red Hat still has not shipped Red Hat Enterprise Linux for WSL, they have since indicated they <a href="https://github.com/containers/podman/issues/11494#issuecomment-988102928">plan to ship a Podman app for Windows based on WSL</a>. That is progress.</blockquote><p>Eventually I reached out to Oracle, as a long shot, for assistance. Much to my surprise, Oracle was incredibly responsive to my inquiry. I detailed the issue and our progress on the bug.</p><p>Oracle assigned an experienced engineer to the project who replied with sample C code that reproduced the WSL 1 bug, provided below, confirming a bug in mmap handling on WSL 1.</p><p>Working with the WSL team at Microsoft, a fix for the WSL 1 bug was then tested in <a href="https://github.com/MicrosoftDocs/WSL/blob/live/WSL/release-notes.md#build-18890">Windows Insider build 18890</a> and shipped in Windows 10 19041 (20H1).</p><p>Oracle provided their assistance no questions asked, even though we were officially partnered with Red Hat, and improved the experience of running all RHEL-based distros on WSL 1.</p><p>That is how Oracle helped save <code>rpm</code> on WSL 1.</p><h3 id="additional-reading">Additional Reading</h3><ul><li><a href="https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20">rpm --rebuilddb causes all future rpm functions to segfault/yum to hang</a> WhitewaterFoundry/Pengwin-Enterprise #20</li><li><a href="https://github.com/Microsoft/WSL/issues/3939">Unexpected behavior in mmap causing issues with rpm</a> microsoft/WSL #3939</li></ul><h3 id="sample-c-code-from-oracle">Sample C code from Oracle</h3><pre><code class="language-C">/*
 * Author: Lauren Foutz
 * This program demonstrates a bug in extending an mmapped file in WSL, 
 * where the mappings to the extended part end up effecting mappings to
 * the beginning of the file.
 *
 * Output Should Be:
 *   Fill the first 64K bytes with &apos;A&apos;.
 *   Extend the file to 1MB
 *   Now fill the extended part of the file with &apos;B&apos;.
 *   First byte of the extended part of the file at address 0x7f03a50d6000, should be B: B
 *   First byte of the file at mapped address 0x7f03a50c6000, should be A: A
 *   Address 0x7f03a50d6000 is now: C, address 0x7f03a50c6000 should still be A, is now: A 
 *   Reopen the file and read the first 5 bytes.
 *   First five bytes of the file should be &apos;AAAAA&apos;: AAAAA
 *
 * On WSL the output is:
 *   Fill the first 64K bytes with &apos;A&apos;.
 *   Extend the file to 1MB
 *   Now fill the extended part of the file with &apos;B&apos;.
 *   First byte of the extended part of the file at address 0x7fe1db720000, should be B: B
 *   First byte of the file at mapped address 0x7fe1db710000, should be A: B
 *   Address 0x7fe1db720000 is now: C, address 0x7fe1db710000 should still be A, is now: C
 *   Reopen the file and read the first 5 bytes.
 *   First five bytes of the file should be &apos;AAAAA&apos;: CBBBB
 */

#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;sys/mman.h&gt;

#include &lt;errno.h&gt;
#include &lt;stddef.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;string.h&gt;

int
main(argc, argv)
	int argc;
	char *argv[];
{
	    const char *io_file = &quot;tmp_mmap4_f&quot;;
	    int fid = 0, i = 0;
	    void *addr1 = NULL;
	    int open_flags = 0, mode = 0, total_size = 0;
	    char buf[256], *caddr;

	    unlink(io_file);

	    open_flags = O_CREAT | O_TRUNC | O_RDWR;
	    mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;

	    /* Open a file. */
	    fid = open(io_file, open_flags, mode);

	    total_size = 1024 * 1024;

	    /* Fill the first 64K bytes with &apos;A&apos;*/
	    printf(&quot;Fill the first 64K bytes with &apos;A&apos;.\n&quot;);
	    memset(buf, (int)&apos;A&apos;, sizeof(buf));
	    for (i = 0; i &lt; 256; i++) {
		lseek(fid, i * 256, SEEK_SET);
		write(fid, buf, sizeof(buf));
	    }

	    /* mmap the file */
	    addr1 = mmap(NULL, total_size, PROT_READ | PROT_WRITE, MAP_SHARED, fid, 0);

	    /* Extend the file, write the last byte */
	    printf(&quot;Extend the file to 1MB\n&quot;);
	    lseek(fid, total_size - 1, SEEK_SET);
	    write(fid, buf, sizeof(buf[0]));

	    printf(&quot;Now fill the extended part of the file with &apos;B&apos;.\n&quot;);
	    caddr = (char *)(addr1);
	    for (i = 256 * 256; i &lt; total_size; i++) {
		caddr[i] = &apos;B&apos;;
	    }   
	    caddr = caddr + (256 * 256);
	    printf(&quot;First byte of the extended part of the file at address %p, should be B: %c\n&quot;, caddr,  caddr[0]);
	    printf(&quot;First byte of the file at mapped address %p, should be A: %c\n&quot;, addr1, *(char *)addr1);
	    caddr[0] = &apos;C&apos;;
	    printf(&quot;Address %p is now: %c, address %p should still be A, is now: %c \n&quot;, caddr, caddr[0], addr1, *(char *)addr1);

	    munmap(addr1, total_size);
	    fsync(fid);
	    close(fid);

	    /* Reopen the file and read the first 5 bytes. */
	    printf(&quot;Reopen the file and read the first 5 bytes.\n&quot;);
	    fid = open(io_file, O_RDWR, mode);
	    read(fid, buf, sizeof(buf[0]) * 5);
	    close(fid);
	    buf[5] = &apos;\0&apos;;
	    printf(&quot;First five bytes of the file should be &apos;AAAAA&apos;: %s\n&quot;, buf);

	    return 0;
}
</code></pre>]]></content:encoded></item><item><title><![CDATA[Installing Retro Home on the Raspberry Pi 400]]></title><description><![CDATA[Let's celebrate New Years and install Retro Home on a Raspberry Pi 400 and play some games.]]></description><link>https://boxofcables.dev/installing-retro-home-on-the-raspberry-pi-400/</link><guid isPermaLink="false">66ac089493c6612a36399ab8</guid><category><![CDATA[Linux]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[Vintage]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Thu, 13 Jan 2022 20:35:36 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2022/01/YouTube-Thumbnail-Card.png" medium="image"/><content:encoded><![CDATA[<figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/AWBTSUSPKEw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure>]]></content:encoded></item><item><title><![CDATA[Installing RISC OS on the Raspberry Pi 400]]></title><description><![CDATA[<p>Let&apos;s learn about the origins of ARM and RISC OS at Acorn, download and flash a RISC OS image for the Pi 400 using another ARM device ironically, tangent into BeOS and Haiku, and then explore the unique UI of RISC OS.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/whnKV34_twY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure>]]></description><link>https://boxofcables.dev/installing-risc-os-on-the-raspberry-pi-400/</link><guid isPermaLink="false">66ac089493c6612a36399ab7</guid><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Fri, 31 Dec 2021 00:53:05 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-30-204403-b.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-30-204403-b.png" alt="Installing RISC OS on the Raspberry Pi 400"><p>Let&apos;s learn about the origins of ARM and RISC OS at Acorn, download and flash a RISC OS image for the Pi 400 using another ARM device ironically, tangent into BeOS and Haiku, and then explore the unique UI of RISC OS.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/whnKV34_twY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure>]]></content:encoded></item><item><title><![CDATA[Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition]]></title><description><![CDATA[Updated, simpler guide for building a custom Linux kernel for WSL 2 optimized for running nested KVM guests.]]></description><link>https://boxofcables.dev/kvm-optimized-custom-kernel-wsl2-2022/</link><guid isPermaLink="false">66ac089493c6612a36399ab6</guid><category><![CDATA[Windows Subsystem for Linux]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Wed, 15 Dec 2021 23:04:03 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-15-220450.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-15-220450.png" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition"><p></p><p>This guide walks you through the process of building a basic accelerated KVM custom kernel for WSL 2 that can be used with any WSL 2 distro you have installed.</p><p>This guide has been updated and simplified. </p><h3 id="requirements">Requirements</h3><p>Windows 11, build 22000+<br><a href="https://docs.microsoft.com/en-us/windows/wsl/install">WSL 2</a> <br><a href="https://www.microsoft.com/store/productId/9MSSK2ZXXN11">OpenSUSE Tumbleweed</a><br>This guide works with Intel and AMD processors</p><figure class="kg-card kg-gallery-card kg-width-wide"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-15-161523-1.png" width="1239" height="650" loading="lazy" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/Screenshot-2021-12-15-161523-1.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/Screenshot-2021-12-15-161523-1.png 1000w, https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-15-161523-1.png 1239w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-15-161543-1.png" width="460" height="423" loading="lazy" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition"></div><div class="kg-gallery-image"><img src="https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-15-161718-2.png" width="1006" height="466" loading="lazy" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/Screenshot-2021-12-15-161718-2.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/Screenshot-2021-12-15-161718-2.png 1000w, https://boxofcables.dev/content/images/2021/12/Screenshot-2021-12-15-161718-2.png 1006w" sizes="(min-width: 720px) 720px"></div></div></div></figure><h3 id="update-opensuse-and-install-build-dependencies">Update openSUSE and install build dependencies</h3><p>Run:</p><pre><code class="language-Bash">sudo zypper -n up

sudo bash -c &quot;zypper in -y -t pattern devel_basis &amp;&amp; zypper in -y bc openssl openssl-devel dwarves rpm-build libelf-devel aria2 jq&quot;</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-18.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1006" height="466" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-18.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-18.png 1000w, https://boxofcables.dev/content/images/2021/12/image-18.png 1006w" sizes="(min-width: 720px) 720px"></figure><h3 id="get-the-microsoft-wsl-2-kernel-sources">Get the Microsoft WSL 2 kernel sources</h3><p>Run:</p><pre><code>curl -s https://api.github.com/repos/microsoft/WSL2-Linux-Kernel/releases/latest | jq -r &apos;.name&apos; | sed &apos;s/$/.tar.gz/&apos; | sed &apos;s#^#https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/#&apos; | aria2c -i -

tar -xf *.tar.gz</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-21.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1114" height="682" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-21.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-21.png 1000w, https://boxofcables.dev/content/images/2021/12/image-21.png 1114w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-22.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1114" height="178" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-22.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-22.png 1000w, https://boxofcables.dev/content/images/2021/12/image-22.png 1114w" sizes="(min-width: 720px) 720px"></figure><h3 id="change-to-the-kernel-directory">Change to the kernel directory</h3><p>Run:</p><pre><code>cd &quot;$(find -type d -name &quot;WSL2-Linux-Kernel-linux-msft-wsl-*&quot;)&quot;</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-23.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1162" height="466" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-23.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-23.png 1000w, https://boxofcables.dev/content/images/2021/12/image-23.png 1162w" sizes="(min-width: 720px) 720px"></figure><h3 id="copy-the-default-microsoft-kernel-configuration">Copy the default Microsoft kernel configuration</h3><p>Run:</p><pre><code>cp Microsoft/config-wsl .config</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-24.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1162" height="466" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-24.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-24.png 1000w, https://boxofcables.dev/content/images/2021/12/image-24.png 1162w" sizes="(min-width: 720px) 720px"></figure><h3 id="tweak-the-default-microsoft-kernel-configuration-for-kvm-guests">Tweak the default Microsoft kernel configuration for KVM guests</h3><p>The following tweaks are based on kernel version 5.14.</p><p>Run:</p><pre><code>sed -i &apos;s/# CONFIG_KVM_GUEST is not set/CONFIG_KVM_GUEST=y/g&apos; .config

sed -i &apos;s/# CONFIG_ARCH_CPUIDLE_HALTPOLL is not set/CONFIG_ARCH_CPUIDLE_HALTPOLL=y/g&apos; .config

sed -i &apos;s/# CONFIG_HYPERV_IOMMU is not set/CONFIG_HYPERV_IOMMU=y/g&apos; .config

sed -i &apos;/^# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set/a CONFIG_PARAVIRT_CLOCK=y&apos; .config

sed -i &apos;/^# CONFIG_CPU_IDLE_GOV_TEO is not set/a CONFIG_CPU_IDLE_GOV_HALTPOLL=y&apos; .config

sed -i &apos;/^CONFIG_CPU_IDLE_GOV_HALTPOLL=y/a CONFIG_HALTPOLL_CPUIDLE=y&apos; .config

sed -i &apos;s/CONFIG_HAVE_ARCH_KCSAN=y/CONFIG_HAVE_ARCH_KCSAN=n/g&apos; .config

sed -i &apos;/^CONFIG_HAVE_ARCH_KCSAN=n/a CONFIG_KCSAN=n&apos; .config
</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-27.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1318" height="466" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-27.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-27.png 1000w, https://boxofcables.dev/content/images/2021/12/image-27.png 1318w" sizes="(min-width: 720px) 720px"></figure><h3 id="build-the-kernel">Build the kernel</h3><p>Run:</p><pre><code>make -j 8</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-28.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1318" height="466" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-28.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-28.png 1000w, https://boxofcables.dev/content/images/2021/12/image-28.png 1318w" sizes="(min-width: 720px) 720px"></figure><h3 id="copy-the-built-kernel-to-your-windows-users-home-folder">Copy the built kernel to your Windows user&apos;s home folder</h3><p>From WSL:</p><pre><code>powershell.exe /C &apos;Copy-Item .\arch\x86\boot\bzImage $env:USERPROFILE&apos;</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-29.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1318" height="610" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-29.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-29.png 1000w, https://boxofcables.dev/content/images/2021/12/image-29.png 1318w" sizes="(min-width: 720px) 720px"></figure><h3 id="point-to-your-custom-kernel-in-wslconfig">Point to your custom kernel in .wslconfig</h3><p>From WSL:</p><pre><code>powershell.exe /C &apos;Write-Output [wsl2]`nkernel=$env:USERPROFILE\bzImage | % {$_.replace(&quot;\&quot;,&quot;\\&quot;)} | Out-File $env:USERPROFILE\.wslconfig -encoding ASCII&apos;</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-32.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1318" height="610" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-32.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-32.png 1000w, https://boxofcables.dev/content/images/2021/12/image-32.png 1318w" sizes="(min-width: 720px) 720px"></figure><h3 id="restart-wsl">Restart WSL</h3><p>Open a PowerShell terminal and run:</p><pre><code>wsl.exe --shutdown</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-33.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1150" height="400" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-33.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-33.png 1000w, https://boxofcables.dev/content/images/2021/12/image-33.png 1150w" sizes="(min-width: 720px) 720px"></figure><h3 id="confirm-you-are-booting-your-custom-kernel">Confirm you are booting your custom kernel</h3><p>Confirm you are running your new kernel by checking the date, which should be very recent. Run:</p><pre><code>wsl.exe uname -a</code></pre><figure class="kg-card kg-image-card"><img src="https://boxofcables.dev/content/images/2021/12/image-34.png" class="kg-image" alt="Build An Accelerated KVM Guest Custom Kernel for WSL 2 - 2022 Edition" loading="lazy" width="1402" height="562" srcset="https://boxofcables.dev/content/images/size/w600/2021/12/image-34.png 600w, https://boxofcables.dev/content/images/size/w1000/2021/12/image-34.png 1000w, https://boxofcables.dev/content/images/2021/12/image-34.png 1402w" sizes="(min-width: 720px) 720px"></figure><p></p><p>Congrats, your WSL 2 kernel is now optimized for KVM guests. </p><p>Now...what are you going to run with that?</p>]]></content:encoded></item><item><title><![CDATA[Bill Gates was right]]></title><description><![CDATA[Gates' 'Open Letter to Hobbyists' wasn't a declaration of war against open source. It is a key foundation of it.]]></description><link>https://boxofcables.dev/bill-gates-was-right/</link><guid isPermaLink="false">66ac089493c6612a36399ab5</guid><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Hayden Barnes]]></dc:creator><pubDate>Wed, 08 Dec 2021 21:11:37 GMT</pubDate><media:content url="https://boxofcables.dev/content/images/2021/12/Untitled-3.png" medium="image"/><content:encoded><![CDATA[<img src="https://boxofcables.dev/content/images/2021/12/Untitled-3.png" alt="Bill Gates was right"><p>The <a href="https://en.wikipedia.org/wiki/Homebrew_Computer_Club">Homebrew Computer Club</a> was a personal computing hobbyist group in Menlo Park, California, which began in 1975 and met until 1986.</p><p>It was an informal gathering of computing enthusiasts to swap parts, circuits, software, and served as a forum to share information about DIY projects, when most personal computing was, in fact, DIY.</p><p>Its members included Steve Jobs, Steve Wozniak, <a href="https://en.wikipedia.org/wiki/Jerry_Lawson_(engineer)">Jerry Lawson</a>, <a href="https://en.wikipedia.org/wiki/Adam_Osborne">Adam Osbourne</a>, and other early personal computing pioneers, hackers, and entrepreneurs, many of whom would go on to start companies, launch revolutionary products, and become tech legends.</p><p>There is no denying that the Homebrew Computer Club and the exchange of ideas there was a critical incubator in the growth of personal computing.</p><p>But the swapping of software at the Homebrew Computer Club, on tape form at the time, is often cited as an antecedent to open source in open source lore. I take issue with that notion.</p><p>In 1976, Bill Gates, co-founder of what was then &apos;Micro-Soft&apos;, published an <a href="https://en.wikipedia.org/wiki/Open_Letter_to_Hobbyists">open letter to hobbyists</a> in the Homebrew Computer Club newsletter, decrying rampant piracy of Altair BASIC among the hobbyist community, including at meetings of the Homebrew Computer Club.</p><p>In his letter, Gates argued that widespread piracy of Altair BASIC made development of software for the burgeoning hobbyist market unsustainable:</p><blockquote>The feedback we have gotten from the hundreds of people who say they are using BASIC has all been positive. Two surprising things are apparent, however, 1) Most of these &quot;users&quot; never bought BASIC (less than 10% of all Altair owners have bought BASIC), and 2) The amount of royalties we have received from sales to hobbyists makes the time spent on Altair BASIC worth less than $2 an hour.</blockquote><p>For many, this letter was the beginning of an ideological war between what would become open source and proprietary software, of free software vs. Microsoft.</p><p>For example, in the otherwise excellent documentary &quot;<a href="https://en.wikipedia.org/wiki/Revolution_OS">Revolution OS</a>&quot; at 7:15, Gates&apos; letter was cast as a declaration of war on computing freedom:</p><figure class="kg-card kg-embed-card"><iframe width="200" height="150" src="https://www.youtube.com/embed/PcdnamUOeaA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure><p>Or <a href="https://www.theguardian.com/books/firstchapters/story/0,6761,471281,00.html">in this excerpt</a> from &quot;Rebel Code&quot;:</p><blockquote>In the light of his Open letter to Hobbyists, the open source movement emerges as Bill Gates&apos; worst nightmare magnified a thousand times. Not just a few hobbyists who &quot;steal&quot;, but a thriving community that writes its own - excellent - code, and then gives it away. Because their actions patently do not &quot;prevent good software from being written,&quot; they implicitly call into question the very basis of the Microsoft Empire: If good software can be written and given away like this, who needs Microsoft or companies like it?</blockquote><p><em>Excerpt from Rebel Code by Glyn Moody. Published by Allen Lane. Copyright &#xA9; 2001 Glyn Moody.</em></p><p>This all makes for a compelling apocryphal story. But it gets it wrong.</p><p>Piracy is not the foundation of open source. The exchange of pirated copies of Altair BASIC among hobbyists is, at best, an antecedent to warez BBS and boards in the 80s and 90s. That is a vastly different story than the story of open source.</p><p>Open source is a social contract between the developer and users. </p><p>That social contract relies on developers having the right to dictate the terms of distribution of their software and users adhering, in most cases voluntarily, to those terms.</p><p>At a minimum that social contract includes respecting the applied license. Under licenses such as the GPL, that contract also includes sharing derivative code. </p><p>The social contract between developers of open source and users can go further than just the license, of course. It can include contributing upstream, fostering community, and financial support, even if not explicitly required by the terms of the license.</p><p>It is this social contract and adherence to the developer&apos;s license that allows open source to work, mostly because <a href="https://boxofcables.dev/the-myth-of-open-source/">we just all agree this is how it should work</a>.</p><p>The notion, put forward by Gates in his open letter, that developers have the right to license software as they see fit and have that license respected, is not the antithesis of open source, it is the <em>foundation </em>of it.</p><p>It was a revolutionary idea at the time, that developers set their terms and users should respect them, upon which the free software and later open source movements were entirely based.</p><p>Gates was right.</p><p>It would be seven years before <a href="https://en.wikipedia.org/wiki/Apple_Computer,_Inc._v._Franklin_Computer_Corp.">courts would recognize</a> that software code could be copyrighted. </p><p>The open letter was not a declaration of war against open source. Without respect for licensing, that unique social contract between developer and user, the GPL and open source would not function, nor would we have the benefit of all the quality open source software upon which modern computing is based.</p><p>The open source movement owes a nod to the idea Gates put forward in his open letter. The open letter deserves its proper context in the development of open source.</p><p><em>More Reading</em></p><ul><li><a href="http://www.bambi.net/bob/homebrew.html">Memoir of a Homebrew Computer Club Member</a></li><li><a href="https://www.computerhistory.org/revolution/personal-computers/17/312">The Homebrew Computer Club</a> entry at the Computing History Museum</li><li><a href="https://en.wikipedia.org/wiki/Open_Letter_to_Hobbyists">Open Letter to Hobbyists</a>, Wikipedia</li><li><a href="https://opensource.org/osd">The Open Source Definition</a>, Open Source Initiative</li></ul>]]></content:encoded></item></channel></rss>