How I Fell in Love (Again) with Linux on a Weekend

Jan 4, 2020

A couple of weeks ago, I started taking the course Computer Systems Security from MIT’s Open Courseware (OCW) platform. I decided to (finally) begin with it, since we recently started a new software development project at work in which we want security baked-in from the start. I had been wanting to dig deeper into secure software application development, and this seemed like the perfect moment to start. I really like using MIT’s OCW because they offer the full-blown class, including videos of the actual classroom lectures, reading materials and homework. And, for this course in particular, what I really loved is that most of the reading assignments are published research papers on the subject. Lately, I had been trying to read more research papers, but it is sometimes difficult to choose from the vast corpus of literature. I think it is a great way to keep up (and learn) with the most recent advances in your field of interest, especially in the STEM fields. This was yet another reason I decided to continue spending time going through the course in my spare time.

There are six lab assignments in the course, which are sequential. Each one builds on the previous one, or requires that some tasks be completed before you can move forward. They all perform a different kind of security attack or defense on a provided web server software, which needs to be run on a virtual machine. So, they recommend using VMware to spin up a virtual machine (VM) image also provided for the labs. However, the free version of VMware is only available for Windows or Linux. MIT has a license for the macOS version (not available for free), but you have to be a registered MIT student. Additionally, there is the option for Linux users to use KVM to run the provided VM image.

Linux to the Rescue

I have a Macbook, so installing VMware wasn’t really an option. However, I had used VirtualBox in the past to work in Ubuntu Linux inside a VM. So, my plan was to simply use KVM with Ubuntu inside VirtualBox. I tried this approach but failed. Apparently, my old Intel-based Mac doesn’t support nested virtualization (i.e. running a virtual machine inside a virtual machine). This was disappointing, although I remembered that I had run into the same issue some time ago when I was playing around with Docker containers. I then decided to run Ubuntu using a bootable USB drive. After downloading the ISO image and flashing the USB drive, I was ready to boot into Ubuntu. Everything was running smoothly, however, I needed to install KVM. But, since I was not using the full Ubuntu version, some drivers were missing including the wi-fi driver, so I could not fetch the KVM package to install.

Third Time’s a Charm

After my second failed attempt, I realized that I could simply install Ubuntu directly in the USB drive. Now, the flash drive I’m using has only 16GB of capacity, so I thought it was going to be a bit of a stretch installing the full version of Ubuntu 18.04 in it. But, I went ahead and installed it anyway. — this was my last option before giving up doing the labs altogether, and just proceeding with the course doing only the reading assignments (not ideal). — During installation, I created only a single root partition occupying the full capacity of the flash drive, there was no need for a swap partition. After the installation process, I booted up my machine from the USB drive, and I was surprised to see that it felt quite fast and responsive.

Ubuntu linux on a Mac computer

My old mac running Ubuntu 18.04 from the 16-GB flash drive.

I had now all the drivers installed, so I was able to easily connect to the wi-fi network and download and install KVM. I then ran the lab’s VM and was able to compile and run the provided web server software, all inside the VM running on KVM. Everything worked smoothly.

Virtual machine running Ubuntu

Virtual Machine running Ubuntu 14.04LTS server version.

I Love Linux

Thinking about this experience made me remember that old Linux premise that it will work on almost any computer, no matter how resource-constrained it might be. Running it in an old 16GB flash drive that I had laying around makes a strong argument in its favor. I know this is not a very good way to run Linux, since flash drive designs have a limited read/write cycle lifetime, and using them in this way might shorten their lifespan. However, I needed to run Linux to do my course’s labs and I didn’t want to partition the hard drive in my current computer (let alone get a new one) to install the new OS, which I might not use after finishing the course. Not to mention that I already use VirtualBox to run VMs (remember that my machine doesn’t support nested virtualization either). So, this solution was cheap, easy, fast and got the job done. Thank you Ubuntu Linux, it was a fun weekend!