Moving to WSL 2

Windows 10 version 2004, rolled out from 27 May 2020, arrived on my machines, allowing a move from Windows Subsystem for Linux (WSL) 1 to WSL 2. However, there was a wrinkle.

File Explorer integration

WSL promises access to the Linux root file system with File Explorer, by entering explorer.exe .. This did not work; File Explorer opened in This PC\Documents.

Sven Groot had a solution. The two registry keys, each named PROVIDERORDER, at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order and \HwOrder were missing P9NP from the comma-delimited string value.

Adding that, fixed the problem. From ~, File Explorer opened at \\wsl$\Ubuntu\home\mpilgrem.

After the fix, the advanced settings of the Network Connections dialog include Plan 9 Network Provider in the list.

Solarized Dark

I use Ethan Schoonover’s Solarized Dark theme in the terminal. So, I edited the default .bashrc file to make the prompt colour codes compatible with the theme; green replaced ‘bright green’ and blue replaced ‘bright blue’.

I used Sebastian Tramp’s ~/.dircolors file for Solarized Dark (dircolors.ansi-dark), so that the coloured output of the ls command worked with the theme.

Powerline

I installed the Go language (sudo apt install golang), and edited the .bashrc file to set the GOPATH environment variable to $HOME/code/go. This was a prerequisite for installing Janne Mareike Koschinski’s Go port of Buck Ryan’s Powerline style prompt for Bash and other shells (go get -u github.com/justjanne/powerline-go).

I made the suggested addition to .bashrc:

The PROMPT_COMMAND environment variable contains commands executed before prompt PS1 is displayed. $(command) allows command substitution: the command is replaced by its standard output. $? expands to the error status of the most recent command.

powerline-go allows for alternative themes using the --theme option, which can refer to a file in JSON format. I did not like the in-built theme solarized-dark16, so I edited default.json to select alternative colours from the Solarized Dark palette.