Windows Subsystem for Linux

From Funtoo
Revision as of 21:30, November 25, 2023 by Drobbins (talk | contribs) (→‎Bind USB to WSL)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Windows Subsystem for Linux provides support for running Funtoo Linux under Windows 10 and Windows 11. The latest version is WSL 2, which provides full system call compatibility, and improvement over the original WSL.


To install WSL 2 on Windows, you need the following things:

  • Windows 11 (any version, including Home), or:
  • Windows 10 (any version, including Home) builds 18917 or higher

Technically you can install WSL 2 on an “insider” build of Windows 10 build 18917 or later.


To initially set up WSL 2, run a PowerShell prompt as an administrator and type:

PowerShell> # wsl --install

After this command completes, and you reboot your system, it is then recommended to install Windows Terminal, which is available from this link -- this is actually a Microsoft Learn site describing Windows Terminal, but it does provide a link to the Microsoft Store page for Windows Terminal:

Start Windows Terminal. You can now use wget under PowerShell to download the stage3 of your choice:

PowerShell> # wget -Uri -OutFile stage3.tar.xz

Once the download completes, you will need to decompress it. This can be done by directly downloading the .exe for Windows, available from, and running the following command:

PowerShell> # .\Downloads\7zr.exe x stage3.tar.xz

Now run the following command in PowerShell -- you do not need to be administrator to run this as long as you have previously installed WSL 2. The arguments specify that we want to import a distribution named "funtoo", which will be installed to the funtoo directory, using stage3.tar as a source.

PowerShell> # wsl.exe --import "funtoo" funtoo stage3.tar --version 2
Import in progress, this may take a few minutes.
The operation completed successfully.
PowerShell> #

When this command completes, Funtoo Linux has been

The wsl -d command (-d stands for "distribution") is an oddly-named command which will start the named imported distribution (in our case, Funtoo Linux) if it is not started, and then provide a direct root console to Funtoo Linux. Alternatively, simply typing wsl and hitting Enter also curiously has this same behavior:

PowerShell> # wsl -d funtoo
root #

You are now running Funtoo under Windows 11. However, Funtoo is not fully set up. We will want to configure WSL 2 to start the default runlevel when Funtoo is started. To do this, we create a /etc/wsl.conf file inside your Funtoo installation as follows:

root # nano /etc/wsl.conf

Add the following contents to this file:

   /etc/wsl.conf - wsl.conf file
command = "/sbin/openrc default"

Now, it is necessary to stop and restart Funtoo to have this setting take effect. However, OpenRC is not working yet, so you will need to do this from the PowerShell command prompt:

root # exit
PowerShell> # wsl -t funtoo
PowerShell> # wsl -d funtoo
root #

The above command terminates the existing Funtoo VM, and then re-starts and re-enters it. At this point, you should see OpenRC functioning properly:

root # rc-status
Runlevel: default
 netmount                                                                                                [  started ]
 sshd                                                                                                    [  started ]
 udev-postmount                                                                                          [  started ]
 local                                                                                                   [  started ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual

As you can see, sshd is running which will allow you to locally "ssh" into the Funtoo VM if you like, and it also demonstrates that other services can be added to the default runlevel that you might want to start. You can now start using Funtoo Linux as you normally would, with the exception that the reboot and shutdown commands will not work.

root # ego sync
root # emerge -C debian-sources
root # emerge -avuND @world


instead of putting goodies to be executed at start in .bashrc, you should place them in .bash_profile


  • in powershell:
root # wsl.exe --unregister funtoo