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.
Microsoft maintains a handful of Linux distributions. You may have heard of CBL-Mariner:
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:
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:
CBL-Delridge is used to power Azure's Cloud Shell:
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
Next we need to create a chroot, a new root directory folder to bootstrap the CBL-D image into:
mkdir /tmp/chroot
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:
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
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.
If successful, we land at:
The contents of /tmp/chroot
look like the root folder of any Linux distro:
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
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.
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.
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:
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.
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
.
Then you can launch CBL-D on WSL with:
wsl.exe -d CBL-D
Or re-open Windows Terminal and it will be visible in the drop-down menu:
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.