August 9, 2020

Windows WSL, Debian, and thus Armbian

The idea now is to install WSL on my Windows 10 machine, then install Debian, then use that for Armbian.

My Windows machine has a 2000G disk (1.8G) with 186G in use, so there is plenty of space.

I am running Windows 10.0.18362.959

WSL 1 or 2 ??

WSL 1 runs via a compatibility layer, not a real linux kernel, whereas WSL 2 runs an actual linux kernel. WSL 2 is recommended both by Microsoft and my expert advisor Tim.

Just do it

I open up the PowerShell (new to me, but there is such a thing) and type:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
It tells me I need "elevated permissions" to do this. And my start menu now has the option to run the power shell either ordinary or with (admin) alongside, so I select the later to restart it. Now it takes the command and reports success.

The second command also reports success. The instructions now tell me to reboot, so I restart Windows. I get a "working on features" message as it is booting up.

Now I type:

wsl --set-default-version 2
And I get an "invalid command error". And the instructions say "it means that your OS doesn't support it and you need to update to version 2004, Build 19041 or higher." I thought I was getting regular updates, but apparently not.

Update Windows (several hours)

I go to Settings, Updates and Security, Windows Update. It tells me there is a January, 2020 update to Windows 1903 available. So I click the download button. The page also mentions a May, 2020 update that is not yet available. Perhaps it can only go in on top of the two pending updates it shows as available. At any event, a restart is required.

After the restart, "ver" still shows me running 18362. My machine is an Intel i7-3770K at 3.5 Ghz with 16G of ram. A check for updates shows nothing else available.

I do a search on "Update Assistant" which I am told will let me "force" the May, 2020 update. A web page offers me an "update now" button, which I click. This downloads an exe file, which I run. This offers to update me from 1903 to 2004, I tell it to go for it. It is downloading a lot of stuff and this looks like it will take a while. It does take a while (over an hour to download). It also seems to be taking at least as long to install the updates. It tells me it will restart several times, and it isn't lying.

Finally, it seems to finish and I can login, but then it says, "Hi -- We've got some updates for your PC".

Now "ver" shows 10.0.19041.421

Select WSL 2 (or try to)

wsl --set-default-version 2

Typing this I get:

Error: 0x1bc
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Searching on this (the recommended link is no help), I find this: I click the link on the second page above, this downloads "wsl_update_x86.msi", which I then run. After doing this, the "wsl --set-default-version 2" command seems to work fine.

Install Debian

The instructions now say to go to the Microsoft store, select a version and download it.
The instructions also provide a link for each distribution. I click the link for Debian/GNU Linux. I click on the "Get" link there. This takes me to the store where I click "Get" again. It is downloading something that is 77 M in size. It tells me it is installed, and I click "Launch". A Debian text window says it is "installing, and this may take a few minutes".

Another issue:

WslRegisterDistribution failed with error: 0x80370102
Error 0x80370102  The virtual machine could not be started because a required feature is not installed.

Get into the BIOS

It looks like this is all about enabling Virtualization in my BIOS. Windows wants to restart and install updates, so let's get that out of the way. Now, let's shut down and monkey with the BIOS.

This is not as easy as it sounds. For one thing, the BIOS screen says "no keyboard detected" and then immediately boots windows. It would seem that I first set this up with an old PS2 type keyboard, but am now using a USB keyboard. The BIOS does not recognize the USB keyboard.

For another thing, it is uncertain what key I should press once I get a suitable keyboard. (Always keep an old keyboard or two around). Supposedly F2 is more or less a standard for ASUS motherboards these days, but searching on my motherboard (a P8Z68-V Pro), the word is that the good old DEL key is the thing to pound on.

It is even worse. There is no PS2 keyboard connector on this motherboard. It is USB or nothing. Very mysterious. Well, the article below describes a way to get into the BIOS by monkeying around from within Windows, perhaps that will be the trick (and I can enable a USB keyboard while I am in there?).

While I am trying to figure out what to do about the BIOS and my keyboard, let's see if my processor even supports the necessary virtualization.
Hardware Virtualization Assist in the form of Intel VT-x
Hyper-V requires Hardware Data Execution Prevention:
Intel refers to it as Execute Disable (XD). This feature must be enabled in the system BIOS.

Both of these are supposed to be supported by my i7-3770K.

Let's try the Windows trick to get to the BIOS.
I go to Settings, Updates and Security, Recovery, Advanced startup, Restart now.

Now I pick "Troubleshoot", Advanced, but no UEFI firmware settings option exists. I pick "Startup repair", but this seems to be a bad choice. No harm done. I may have to open up the case, reset CMOS and start from scratch with my BIOS. No telling why it no longer recognizes a USB keyboard.

I try the Windows 10 trick, but now when I would like to see UEFI, I pick "Startup Settings". This reboots and takes me to a screen that offers F10 for more options, but my keyboard is dead. Nothing works. I power cycle. Windows boots up normally.

No UEFI firmware option

Apparently this is a known issue: One suggestion in the list above is that I should check my CMOS battery. Hmmm. This could explain the mysterious USB keyboard now not recognized issue. I might have purchased this computer around 2012, 8 years ago, so this is more or less believable.

This command looks like a trick worth knowing:

shutdown /r /fw

I shut it down and call it a night.

A new day dawns, battery and BIOS

I open up the case and vacum out the dead rats, lint, and spider webs. I see the usual 2032 coin cell. Indeed, the motherboard is an ASUS P8Z68-V Pro.

I disconnect the SATA hard drive and power up, hoping this will force it into the BIOS. It still announces "no keyboard detected" (I am using a cheap Logitech K120 USB keyboard). then gives a message telling me to insert boot media and press a key. Ha ha ha.

I dig around on my linux machine and find a PDF copy of the manual (E6696_P8Z68-V_PRO.pdf). This shows me where the jumper to clear CMOS is. It tells me to unplug the computer, move the jumper from 1-2 to 2-3 for 10 seconds, then replace it on 1-2 and power back up, using DEL to get to the BIOS.

I replace the battery with a shiny new Sony 2032 cell (expiration date 2028), perform the CMOS clear ritual, and power back up. Now it insists that I enter setup, tells me that no keyboard is detected, then instructs me to type F1 to run setup.

I am beginning to wonder if the BIOS (AMI) will only recognize the keyboard on certain USB ports. There are only 8 choices, let me try them all. YES! That is it. When I plug the keyboard into the lowest of two ports below where the network cable plugs it, the BIOS sees it. I plug the mouse into the port above the keyboard, and that works too.

I use F5 to load "performance defaults". The BIOS has an advanced mode, and that has an advanced tab, and that has a CPU configuration tab. It shows hyperthreading enabled already, and an "execute disable bit", which is enabled already. Also, HIDDEN (I have to scroll down) is Intel Virtualization Technology, which is disabled. I enable it. I use F10 to save and reset. I reconnect my hard drive and it boots windows.

Try again to install Debian

I trip over a "Debian" thing in the start screen saying "recently installed". So I click on this and it brings up the Debian serial console installer, and it again gets the 0x80370102 missing feature error. One tip in this discussion of the issue is to fire up the Windows task manager (do this via Ctrl-Alt-Del and then selecting "task manager") Click on "more stuff" and you get a bunch of tabs. One of these is "performance". Select it and it shows you a bunch of CPU information, and near the bottom, I see:
Virtualization: disabled
Hyper-V support: yes
Well, this isn't good. Maybe when I typed the following without virtualization enabled in the BIOS, it didn't do what one might think. So let's try them again.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Getting an elevated powershell is the first hurdle. Type "powershell" into the search entry at the lower left, then when it seems to find powershell, right click on what it gives you and a menu will offer a choice that is to run as administrator. This is what you want. It will then ask for a password.

I do this, repeating just the second command above (VirtualMachinePlatform). Then I reboot, and after the reboot, checking with task manager as per the above, I now see:

Virtualization: enabled
It doesn't say anything about Hyper-V support now.

So, I select the "recently installed, Debian" thing from the start window and now it asks me to set up a user name an password. Then it says "installation successful and gives me a shell prompt.

Road test Debian

No python or ruby, but it does come with perl. Vi works. "sudo su" works nicely.

When it first came up, "ping" did not work, but now it works. Some kind of delay getting the network set up I guess. No ifconfig command. No ssh available.

Typing "ip addr show eth0" shows me the interface as up and assigned to 172.23.25.42/20.

On windows, typing "ipconfig" shows me a WSL device assigned to 172.23.16.1 with a netmask of 255.255.240.0.


Have any comments? Questions? Drop me a line!

Tom's electronics pages / [email protected]