Building CBL-Delridge, Microsoft's other Linux distro
Microsoft has another Linux distro you probably haven't heard of. You can easily build it and even import it into WSL.
![Building CBL-Delridge, Microsoft's other Linux distro](/content/images/size/w2000/2022/02/Untitled-2.png)
Microsoft maintains a handful of Linux distributions. You may have heard of CBL-Mariner:
![](https://www.zdnet.com/a/img/resize/121d8aeb806fe057858b5a459965eb0e819f3469/2020/11/11/c3e91470-b834-4b2d-aefc-dce07cca519d/cbllinuxmicrosoft.jpg?width=770&height=578&fit=crop&auto=webp)
CBL-Mariner is used across Microsoft, including Azure and to power WSLg on WSL 2.
You may also have heard of Microsoft's earlier networking Linux distro, SONiC:
![](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)
![](https://regmedia.co.uk/2016/03/09/debian_tattoo.jpg)
Did you know Microsoft also maintains yet another Linux distribution, CBL-Delridge?
Searches for it on Google bring up...CBL-Mariner and a mention of CBL-Delridge on my Microsoft Open Source timeline:
![](https://boxofcables.dev/content/images/2022/02/image-27.png)
CBL-Delridge is used to power Azure's Cloud Shell:
![](https://boxofcables.dev/content/images/2022/02/image-5.png)
Unlike CBL-Mariner, which is built from scratch, CBL-Delridge is based on Debian, specifically version 10, codenamed Buster.
The current version of CBL-Delridge, or CBL-D for short, is coincidentally also version 10, codenamed Quinault.
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.
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.
On openSUSE install debootstrap with:
sudo zypper in -y debootstrap
![](https://boxofcables.dev/content/images/2022/02/image-7.png)
Next we need to create a chroot, a new root directory folder to bootstrap the CBL-D image into:
mkdir /tmp/chroot
![](https://boxofcables.dev/content/images/2022/02/image-8.png)
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:
![](https://boxofcables.dev/content/images/2022/02/image-9.png)
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:
sudo cp /usr/share/debootstrap/scripts/buster /usr/share/debootstrap/scripts/quinault
![](https://boxofcables.dev/content/images/2022/02/image-11.png)
Next, we fire up debootstrap with:
sudo debootstrap --arch "amd64" --include=gnupg,sudo,nano quinault /tmp/chroot https://packages.microsoft.com/repos/cbl-d/
Our command specifies:
--arch "amd64"
because we are building for amd64. It is possible to cross-compile with debootstrap but it can be messy.
--include=gnupg,sudo,nano
to include these additional packages on top of the base Quinault image.
quinault
is the version name of our distro and the reason we copied the debootstrap script before.
/tmp/chroot
is where we want to bootstrap the image, into the new root filesystem.
https://packages.microsoft.com/repos/cbl-d/
is the location of the CBL-D apt repository.
![](https://boxofcables.dev/content/images/2022/02/image-12.png)
If successful, we land at:
![](https://boxofcables.dev/content/images/2022/02/image-13.png)
The contents of /tmp/chroot
look like the root folder of any Linux distro:
![](https://boxofcables.dev/content/images/2022/02/image-15.png)
We have a few more steps to complete though to make this a functional distro image we can use.
Our base image includes https://packages.microsoft.com/repos/cbl-d
in it'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.
Add the additional repository to sources.list with:
echo 'deb https://packages.microsoft.com/repos/cbl-d quinault-universe main' | sudo tee -a /etc/apt/sources.list > /dev/null
![](https://boxofcables.dev/content/images/2022/02/image-14.png)
The contents of /tmp/chroot/etc/apt/sources.list
should now include:
deb https://packages.microsoft.com/repos/cbl-d quinault main
deb https://packages.microsoft.com/repos/cbl-d quinault-universe main
Finally, we need to add the security keys for the Microsoft CBL-D apt repository, otherwise apt
cannot verify packages or perform upgrades. We do this by using the chroot
command to run apt-key
from inside our new chroot filesystem:
sudo chroot /tmp/chroot/ /usr/bin/apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys EB3E94ADBE1229CF
This runs /usr/bin/apt-key
inside our chroot at /tmp/chroot
as if /tmp/chroot
was the root folder. It essentially runs the command on CBL-D inside CBL-D, even though it is just a folder on openSUSE.
![](https://boxofcables.dev/content/images/2022/02/image-16.png)
Once we have imported the keys to apt to authenticate with the Microsoft repositories, we have a working image.
Now, we can play with CBL-D.
The easiest way to get started is to launch bash in the CBL-D chroot folder with:
sudo chroot /tmp/chroot/ /bin/bash
This is similar to how we used chroot
to run the apt-key
command, except this time spawning a shell we can explore with.
![](https://boxofcables.dev/content/images/2022/02/image-17.png)
Now you are running as if /tmp/chroot
was the root directory, so running apt update
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 exit
to go back to your host distro:
![](https://boxofcables.dev/content/images/2022/02/image-20.png)
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 wsl.exe --import
. Make sure if you used the command above you exit the chroot and go back to your host distro.
We create a tar of the chroot by:
sudo tar -cpzf cbld-quinault.tar.gz -C /tmp/chroot/ .
sudo
here is necessary because of some of the permissions on the bootstrapped file system.
![](https://boxofcables.dev/content/images/2022/02/image-22.png)
Then we can import it as a WSL distro, from inside WSL or separate PowerShell, with:
wsl.exe --import CBL-D "C:\WSL\CBL-D" cbld-quinault.tar.gz --version 2
This command tells WSL to import a distro with:
CBL-D
as the name, which you can call with wsl.exe -d CBL-D
or visible in Windows Terminal.
With the WSL files stored at C:\WSL\CBL-D
.
From our cbld-quinault.tar.gz
root filesystem archive.
As WSL 2 with --version 2
.
![](https://boxofcables.dev/content/images/2022/02/image-23.png)
Then you can launch CBL-D on WSL with:
wsl.exe -d CBL-D
![](https://boxofcables.dev/content/images/2022/02/image-24.png)
Or re-open Windows Terminal and it will be visible in the drop-down menu:
![](https://boxofcables.dev/content/images/2022/02/image-25.png)
CBL-D is an abbreviated version of Debian, so all of your favorite packages might not be present.
There are about 1554 as of writing, compared to 28392 in Debian 10. I have posted a list here, almost all console tools and the most basic X utilities.
![](https://boxofcables.dev/content/images/2022/02/image-26.png)