Installing Ubuntu x64 on a Hyper-V Virtual Machine

I recently wanted to get a local instance of Docker on my workstation to kick around some cool things happening in the Microsoft space on Linux (e.g. Service Fabric on Linux, SQL Server on Linux, ASP.NET Core on Linux) locally so I thought I would setup a Hyper-V virtual machine with Ubuntu Server and save my MSDN Subscription Azure pennies for something more fun like an IoT Hub or two. 😊

First, I setup a Generation 1 VM with Ubuntu Server 16.10 and tried to install docker. Big fail. It wasn’t completely obvious what the problem was so I thought I would catalog my experience for others attempting the same thing. I followed Docker’s install instructions to a tee. I even brushed of my vi skills to double check the contents of the APT repository sources file (located here ‘/etc/apt/sources.list.d/docker.list’). However, whenever I ran the following command:

apt-cache policy docker-engine

I get the following:

Unable to locate package? What?!?

After much googling and binging. I discovered that it might have something to do with the CPU architecture of my virtual machine. I thought that I downloaded the x64 version of Ubuntu Server but there didn’t seem to be a separate x86 (32-bit version) so I figured it might be that they package both 32- and 64-bit versions together and automatically detect which version to install based on the CPU.

So, in order to test this theory, I setup a generation 2 VM to try and force it to use the 64-bit version of Ubuntu server. However, much to my dismay, my brand new virtual machine wouldn’t boot from the perfectly good Ubuntu Server ISO I had used to install on my Generation 1 VM just hours earlier! The plot thickens…

Back to the google. It turns out I had to disable secure boot. It’s one of those hidden features that you don’t know about unless you really care to. Of course, naturally, there is no documentation or explanation that might suggest this is the problem!

Be warned, executing the following command will return some errors:

Get-VM | Get-VMFirmware

Don’t fret. Those errors are from your Gen-1 VMs (if you have any). This is the nasty I got back when I tried to execute the command. Notice the single line of white text. Yep, that’s my sole Generation 2 VM that I plan on installing Ubuntu Server x64 on.

Executing this worked for me:

Get-VM -Name ‘Ubuntu Server 16.10 x64’ | Set-VMFirmware -EnableSecureBoot Off

I could immediately boot from the disc and install Ubuntu. Hooray!

After I got through round II of installing Ubuntu Server on my Generation 2 VM I ran through the Docker setup procedures and finally when I ran the ‘apt-cache policy docker-engine’ check, I got this:

Victory!

PS. I thought it might be worth mentioning that when I read the documentation to install Docker the other day there was also a reference to ‘yakkety’. However, today I find that only ‘xenial’ is referenced. I swear the below table had a fifth entry in it that was for Yakkety 16.10. Either somebody is messing around on the Ubuntu documentation wiki or my mind is playing tricks on me.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s