Martin Maugeais | Blog

RSS

Of Virtual Turduckens (WSL on AWS)

October 31, 2024

One of my clients requires that I use a virtual machine to access the company network. I do all my dev work in UNIX environments, but I need a Windows machine sometimes, to test their products. I was informed that two virtual machines was an unreasonable expense, so I opted for a Windows machine, my plan being to use Ubuntu within it, thanks to WSL, the Windows Subsystem for Linux.

Sadly there seemed to be something wrong with the install, because WSL kept closing as soon as I opened it. Well, not quite. A quick search revealed that this was fine, normal, totally expected behavior: I hadn't installed any distro! What did I expect, a nice info message??

Alrighty, I thought, easy enough. I just have to wsl --install, which I did in a flash, my fingers gently brushing the keyboard. I'm almost done with this install, I told myself. You won't believe what happened next.

"Error: 0x80370102 The virtual machine could not be started because a required feature is not installed."

Which feature was, apparently, too much to ask. At least I had an error code to search in Ecosia (What? You don't like trees?). Microsoft's learning pages informed me with a characteristic corporate deadpan tone that I needed to check the Hyper-V system requirements, manuallye nable nested virtualization, fix the whatchamacallit on the hootenanny valve and get a PhD in non-euclidian geometries. Regrettably I had no time to do any of this before my lunch break.

A spy In The House Of Microsoft: Catherine Zeta-Jones in the laser scene of the movie Entrapment.

Setting up WSL is fairly straightforward with proper training.

Through the years I've maintained some of my mental sanity amist the silicon chimeras by strictly enforcing the following policy: I never descend lower than the Third Circle of Hell. Setting up WSL had brought me to the first. But now I had to learn about "Hyper-V", whatever that was, and that would take me to the second. With the "nested virtualization" I would reach the third. This "hypervisor launch" thing, then, was off-limits. Well, I could just poke a little and see what I could figure out. "How hard can it be to check requirements?", I thought. Such candor...

I plunged a toe in Circle 2 where Charon asked me whether I had second-level address translation (SLAT), Monitor Mode extensions, and if backflip armstand somersault had been properly activated in the UEFI, to prevent retrograde cascading leak exploits in the metasphere. I felt like I had just been SLAT in the face. Warm tears ran down my cheeks. I called my mommy, but only got the cold echo of my own voice for answer. I took a deep breath, wiped my tears with the back of my sleeve, pounced on my desk and swore to never give up. (Then, just to be safe, I added a condition: unless this mean machine made me cry again).

I was resolved but seemed to make no progress. After a while I understood that a powerful Shield of Boringness was preventing me to check any of the above requirements. I deflected, checked an imaginary "Agree to the terms and conditions" box and continued on my journey.

Alas the next step was to provide the name for my virtual machine, and something I couldn't simply jump over as I had done with the requirements. I immediately sensed that the task was beyond human capacities. I could find it, Microsoft said with a poorly veiled cruelty, in my "Hyper-V Manager", the smug tone implying that — of course — anyone reading this knew perfectly well what the Hyper-V Manager was and where to find it (find her?). Well, I just have to type it in that Windows search bar, right? A cool breeze down my neck made me chiver. The search results were eerily empty. There it is! I thought. Circle Four! Turn back before it's too late! Keeping my head up high, I walked out.

Windows does this over and over, by the way: giving you an error message that points you to something that it hidden so well you start doubting its existence. One of the million ways by which they sabotage your self-esteem. Earlier today I was installing the company VPN when Windows blocked the connection. "If you trust this website," it said, "you can lower security settings for the site by adding it to the Trusted sites zones." No problem, I thought (I was still young, then). I'll use that handy Windows search bar. Well, it turns out to access the "trusted sites" list, you first need to resuscitate Internet Explorer and implore its benevolence. (I didn't figure this out myself. The IT department came to the rescue.)

But I digress. I needed a new approach. Maybe running a virtual Ubuntu inside a virtual Windows running from a Mac had offended the Silicon Gods? Maybe Virtual Turduckens were taboo in the metasphere? I had not even checked if Mercury was in retrograde. How foolish of me! Having lost all hope, I prayed Saint Alan. Against all odds, my prayers were answered:

"A hypervisor has been detected"

Luke Skywalker about to blow up the Death Star

At first I took this as a good omen, since Microsoft previously wanted me to launch this "hypervisor", but apparently the orders had changed. Now the hypervisor was a big no-no, and Microsoft let me know I was going to be punished:

"Features required for Hyper-V will not be displayed."

They won't?! I... The... What features? Displayed where? What's my name? What am I doing here?

I didn't yield, this time. My blood was boiling. I had had enough of these bullies. It was time for them to pay.

Rambo

I was furious, foaming at the mouth. My rage against Microsoft was such that it rivalled with Bill Gates's that time he tried to install Movie Maker.

I clenched my tiny chubby fists and pounced on. Since Microsoft had decided to gaslight me, I would ignore whatever instructions they gave me. I would go solo, and get back to the basics. I searched "WSL on AWS" and landed on Amazon's documentation.

There are two versions of WSL, I learned. WSL 1 and WSL 2. If my instance is metal, I can install either. If it's EC2 though, I must use WSL 1. Or else. It is unclear what you should do if your instance is lined with vegan leather, if it has been whipped to hard peaks, or if it is an imperial instance. There were other considerations, such as whether I was running Windows Server 2019 or 2022 which God, in its infinite wisdom, commanded me to ignore.

EC2 or Metal, then. That was the question. Whether 'tis nobler for the mind to suffer the slings and arrow of outrageous fortune, or to take arms against a sea of troubles, and by opposing end them...

EC2 or Metal. How hard could that be? You guessed it: HARD. The valiant Kelindil had died on that hill before me. The accepted answer to his serverfault question lists 7 previous answers, each suggesting a different way to determine whether an instance is an "EC2" or "Metal" (still not a word about Triple Cream ones...). Along with an explanation as to why each one is wrong.

It is then that I was struck by a miraculous epiphany. I remembered running Systeminfo.exe earlier in my journey, and had the uncanny feeling that the answer I was looking for was there, hiding in plain sight. When I ran the command again, I could clearly see the providential letters: EC2. Eureka, I cried. Probably somewhere in that serverfault answer I skimmed is a warning not to trust this, but this comedy has lasted long enough.

With a temerity that surprised myself, I set out to follow Amazon's instructions to install WSL 1 without reading the prerequisites, terms, conditions, warnings, preliminary notes, introductory remarks or any of the related content and suggested pages. To say the least, I was a real maverick. Nothing at that point could have stopped me. I was ready to set the virtual instance ablaze, if I had to.

wsl --install --enable-wsl1

The answer came, quick and terse:

--install: unrecognized option: enable-wsl1

I rolled to the side, barely escaping the sharp blade that came crushing to the floor.

wsl --uninstall

I was on fire. I rebooted, then before the enemy could make a move:

wsl --set-default-version 1

(I had learned the incantation previously in my journey, and had stashed it away just in case).

Then, without leaving any respite to my mighty adversary, I

wsl --install

The monster screamed, and tried to fight back, prompting me to choose a distro. But I could no longer be stopped.

wsl --install -p Ubuntu

And this is how, on this Day of the Dead of 2024, I managed to install Ubuntu on Windows 11.

Happy Halloween!