Mac Mini (mid-2011) on Linux

When Apple released MacOS Majove in 2018, the minimum hardware requirements abandon lots of great hardware. While the hardware is still usable, macOS and Apple software cannot be updated to their current releases. That sucks.

This post outlines the process of moving a Mac Mini (mid-2011) to Linux.

Mac Mini

The Mac Mini I’m rescuing is a mid-2011 with i5-2415M, 2GB RAM and 500GB HDD, running macOS High Sierra (version 10.13). It’s dreadfully slow. The goal is to use this machine as a general purpose computer in a classroom for high school students.

In addition to changing the operating system from macOS to Linux, the RAM will be upgraded to 8MB and 550GB hard drive replaced with 128GB SSD.

Steps

The overall steps:

  1. Order new hardware
  2. Upgrade RAM and Hard disk drive (HDD)
  3. Install Linux

Upgrade

I use Crucial’s website to help determine the parts I can upgrade. Using the model of the computer you’re working on, Crucial will show you the options for memory, hard drive, and SSD upgrades. I often buy the parts on Amazon.

For this upgrade, I used:

  • Memory : Crucial – 8GB Kit (2x4GB) DDR3L – 1333 SODIMM ~$60 USD
  • Solid State Drive (SSD) : Crucial – BX500 2.5 SSD 120GB ~$22 USD

Upgrading this Mac mini is straight-forward. It was built in the days when ‘upgrade-ability’ was built into the hardware design. Finding a YouTube video to guide you through the steps of taking the Mac Mini apart is very helpful. I used this video from MacSales.

The parts inside the Mac mini fit just right. The first time I did one of these upgrades, the SSD wasn’t aligned properly which prevented the wifi from fitting, and the screw holes did not align. Take your time and don’t force anything.

Installing Linux

I’ve been using Elementary OS for a few weeks, and I’m impressed. I appears to be a good distribution choice for someone coming from MAC. While my day-to-day distribution is currently Pop_OS!, I’m going to give Elementary a try with this upgrade.

Installing Linux is the same basic process for any distribution.

  • Download .iso file from the distribution’s website.
  • Create a bootable USB Drive with the .iso. There are utilities to do that with; I use Etcher.
  • Boot the target computer from the USB Drive and follow the prompts.

Elementary OS has the details of these steps outlined on the installation page of their website.

Wifi

I expected to have issues with wifi. In my experience, when installing Linux on Macs from this era, wifi does not work out of the box. I was pleasantly surprised the Elementary install screen recognized the wifi card and connected to it, and downloaded the latest software update.. After the installation was complete and the computer rebooted, the wifi card was no longer recognized. I needed to install drivers. As in the past, running the following command from the terminal fixes the issue:

sudo apt-get install firmware-b43-installer

Up and running

This upgrade was simple and straight-forward. It’s a fun project for someone that has no experience with hardware upgrades or Linux.

Benchmarks

This is my first experience running any type of benchmark. I used GeekBench on the Mac Mini before and after the upgrade. I don’t have much insight into what these numbers mean; I expect to in the future. But my hands-on benchmark tells me this computer runs as fast as much newer hardware and is totally usable.

Before – MacOS w/2GB RAM and HDD

Pre-upgrade full report available on GeekBench

After – Elementary OS w/8GB RAM and SSD

Post-upgrade full report available on GeekBench

Conclusion

The performance of this Mac Mini would have improved with only the hardware upgrades (without switching to Linux). But on Linux, the performance is really good.

A more important point is that Apple abandoned this Mac Mini. When Mojave was released in 2018, the minimum hardware requirements are:

  • MacBook: Early 2015 or newer
  • MacBook Air: Mid 2012 or newer
  • MacBook Pro: 2012 or newer, Retina display not needed
  • Mac Mini: Late 2012 or newer
  • iMac: Late 2012 or newer

Struck at High-Sierra, this computer would only receive security updates, moving forward. Many software applications cannot be updated either. After switching to Linux, this computer can run the latest operating system and applications available on Linux.

I did this upgrade for my friend, Chris. I look forward to see what experience he has in the classroom with Elementary OS.

(It took me 3x longer to write this post than it did to save that Mac mini)

Drupal 8 and Lando

Overview

Below are steps to setup a local Drupal 8 composer based environment using Lando.

Prerequisites

You need to have Lando installed using these instructions.

Steps

Create a local folder. <app> will be the name of your application folder and Lando instance.

mkdir <app>

Position your working directory as your new folder

cd <app>

Initialize Lando and answer a few questions. This utility creates a .lando.yml file in your working directory. When you start Lando in the next step, this file is used to define the Lando configuration.

lando init
Choose: current working directory
Choose: Drupal8
Enter for webroot: web
Enter for app: <app>

Start Lando

lando start

Install Drupal code using composer. Note – Drupal is being install in a Docker container, not on your local computer.

Drupal 8.8 and Later:

lando composer create-project drupal/recommended-project blah -n

Prior to Drupal 8.8:

lando composer create-project drupal-composer/drupal-project:8.x-dev blah -n

The above command uses composer to install Drupal and it’s dependencies into a folder called ‘blah’. Now, the files/folders in ‘blah’ will be move up one level into your directory and the ‘blah’ folder will be removed.

mv blah/* .
mv blah/.* .
rm -rf blah

Rebuild Lando containers.

lando rebuild -y

On a success rebuilt on Lando, it’s time to install Drupal 8. Goto the local URL for your Drupal 8 website.

https://<app>.lndo.site  

Follow the steps in the Drupal installation Wizard. When the database page appears, use ‘drupal8’ for the database name, username and password. Also, use ‘database’ for the host name (under the Advanced settings.

You should be up and running,

Updates

12/10/2019 – As of Drupal 8.8.0, Composer project templates are now available as part of Drupal core. The composer create-project command was updated to reflect this change.

WordPress

This website, stephencross.com, has mostly been a place for me to play with new technology. Moving forward, I’m going to play somewhere else, and use this location to share information.

This time around I’m using WordPress. I picked a simple theme, and copied a few posts from the previous version of stephencross.com. I haven’t used WordPress in many years. I’m impressed how quickly I was able to put this website together and feel comfortable publishing the first draft.

$100 Development Laptop

At the beginning of 2018 I switch to Linux as my ‘daily driver’. I have a desktop and laptop from System76 running Pop_OS!. I’m super happy about that switch.

Linux is everywhere; from Rasperry PIs to supercomputers. It runs nuclear submarines, refrigerators, air traffic control and my Drupal development environment. It can run fantastically on modern hardware and bring life back to the forgotten computer in the closet.

I wondered if it was possible to configure an under $300 laptop for Drupal development. I started by looking at low-end consumer laptops. Best Buy has Intel and AMD laptops, 4-8GBs Ram with an SSD, preinstalled with Windows, on sale in that price range. I asked for recommendations in an online Linux community. I was advised by many not to buy consumer ‘junk’, but instead, look for used enterprise-class laptops on Ebay in the same price range or less. In my research, I found a cult-like following for the Thinkpad T420, a laptop released in 2011 (see video The $110 Lenovo Thinkpad T420, a Laptop with a Legacy). It’s known for its durability, performance and ‘old-school’ keyboard. That seemed like a reasonable place to start.

Acquisition

The price range on eBay for a T420 with an SSD was between $125 – $225. I found one without an HD (or SSD) or power cord. With those two essential parts missing, I was highest bigger at $45 (plus 12.97 shipping). This T420 has as i5-2520M @ 3.200GHz with 8GB Ram. I bought a 240GB SSD for $28.95 and power cord for $10.99. At worse case, this would be a failed $97.91 experiment.

ThinkPad T420

You never know what you’re going to get with used equipment. The Thinkpad was in surprisingly good shape. As promised, everything was in working order with normal wear for a nine-year-old computer. I unboxed it, slid in the SSD and had Manjaro Linux installed in 10 minutes. Manjaro is my first experience with a Linux distribution outside of Pop_OS!.

Infamous Linux Wifi Issue?

I had one hiccup, the wireless card wouldn’t work. It wasn’t a big problem because the T420 has lots of ports, one of which is ethernet (take that Apple). I tried to get wireless working late into the evening, then decided to install the distribution I was familiar with, maybe it was a software issue. I installed POP_OS! and immediately identified the issue from a message, something like “wireless hardware switch is off”. What!!?? Sure enough, there’s a small hardware switch on the side of the T420 to turn off blue tooth and wireless. This problem was undoubtedly not software or hardware related. I decided to leave Pop_OS! running, I will experiment with Manjaro at another time.

Wifi Hardware Swtich

Drupal Development

The primary software requirements for my Drupal development includes web browsers (Chrome and Firefox), Lando (and required software) and VS Code (IDE). While there are many other tools I use day to day, those are the must-haves. Outside of Docker needing some extra attention, loading this software was straight forward. I’m was up and running in short order.

Observations

After a month of using the T420 as a second laptop for Drupal development and general computing tasks, my observations are:

  • The Thinkpad T420 is a solid computer. It feels and is a quality build.
  • I like the feel of the classic, “clicky clack” keyboard. It’s easy to use.
  • I missed a laptop with lots of ports and single purpose buttons
  • This computer is fast, not just fast enough. While I didn’t push the limit with lots of containers running at the same time I’m editing audio on a Zoom call, it performs well.

Summary

This T420 running Linux is at least a solid backup computer, and maybe a daily driver for most developers. It feels good to sit behind a classic laptop, running a current OS, while building a modern website. Maybe it’s like cruising down the road in a 1964 Mustang. Is it a fluke that I was able to put this system together for under $100? No. I’ve bought two more and have done the same thing.

Backstop JS and Lando

I’ve recently started using Backstop JS for visual regression testing. You can add the following settings to your Lando configuration, .lando.yml, to include Backstop JS.

services:
   node:
     type: node:10
     globals:
       backstopjs: "latest"
     command: npm start
     run_as_root:
       - apt-get -y update && apt-get -y install software-properties-common
       - wget https://dl-ssl.google.com/linux/linux_signing_key.pub && apt-key add linux_signing_key.pub
       - add-apt-repository "deb http://dl.google.com/linux/chrome/deb/ stable main"
       - apt-get -y update && apt-get -y install google-chrome-stable
 tooling:
   backstop:
     service: node

You will need to use the .internal URL from Lando to access the local website. For example:

  "scenarios": [
    {
      "label": "Homepage",
      "url": "http://appserver_nginx.your-site-name.internal"
    }

The backstop commands will be run through Lando tooling:

lando backstop reference
lando backstop test

Recovering Home Video

I have forty-six tapes with home videos that cover family events from 1996 to 2005. These tapes have been stored in a box for as many years. I recently took on the project of moving them to a format we can enjoy. My two challenges: how to get them off of the tapes and how to make them accessible to everyone in the family.

Camera to Computer

The camera used to take these videos, a Sony Digital HandyCam DCR TRV 120 , is still operational. I made that discovery after purchasing a power cord from Amazon. Then I needed cabling to connect the camera to my computer. This was hit and miss because it wasn’t clear to me which cables would work. I’m thankful Amazon has a generous return policy. I had three cable attempts fail. I settled on a combination of two cables that allowed me to go from a 1/4 inch camera output to composite and then composite to USB. The composite to USB came with drivers and software to capture video on a Mac.

Cables:

HDE 3ft. Feet RCA Male to 3.5mm Male Jack Composite Audio Video A/V Cable

S-Video / Composite to USB Video Capture Cable Adapter w/ TWAIN and Mac Support – VHS to USB Composite Svideo

Capture Process

The capture process requires each tape to be played from the camera and recorded on the Mac. A 45-minute recording takes 45 minutes to capture. I learned the capture process is a bit fragile. After recording eighteen videos (aka eighteen hours of recording), I discovered eleven videos had no audio or the audio was out of sync. I made some changes to my process to ensure the remaining recording would go well.

  • The video capture software should be the only application running on the Mac during the capture process
  • Play the audio through the Mac, not the camera, to verify the audio is getting to the camera
  • Rebooted at the start of each recording session or after every four tapes

Some tapes had sixty minutes of content while others had thirty-five. The best process for me was to let the 60-minute tape run through and edit out the blue screen when it completed. This allowed me to do other things while capturing the video. When the recording was complete, I would open the resulting .mov file in QuickTime and trim out the blank recording from the end.

Serving Home Video

I chose to serve the home videos through Plex. Plex allows you to store, manage, and stream your personal media. I expect I will be using Plex home movies and maybe photos in the future. Plex is an open source application that requires a central server to stream content to Plex clients. A Plex client can be almost any device. For me it will be Apple TV, iPads, iPhones, a Roku, and Fire TVs. Content can be streamed in and out of my home network. With grown-up children, having remote access to the video content is important.

After a bit of research, I learned that a Raspberry Pi could be used as a server, but it may not be powerful enough. Since I had a Pi 3, I decided to give it a try. Comfortable with Linux and the command line, I had a Plex server running on the Pi in 15 minutes using a resource like How to set up a Raspberry Pi Plex server. I connected a USB external drive to the Pi to store the 140GB of home videos.

It worked! The quality of the video is fantastic. When streaming a 30-minute video from a device, it will stop a few times and buffer. A “your server is not powerful enough…” type message will also appear, but it works. (See Update 12-31-18 below)

Next Steps

Plex Server Upgrade – My next project is to upgrade the $35 Raspberry Pi to a more powerful single board computer (SBC). I’m looking at a RockPro64 or NanoPC T4 with 250GB m.2 storage. I think this will deliver my minimal needs and not break the bank. And more importantly, it’s a fun tech project. Stay tuned. (See Update 12-31-18 below)

Video Editing – I discovered that the 19-year-old video labeled as Christmas 1999, was really four events starting in December, 1999 and ending in July, 2000. Now that I have the videos on my computer, I’ll be breaking them into smaller videos. No commitment on when this will be complete.

Moving forward – We all take lots of video with our smartphones. For me, it’s not intentional, long-form video, like my Digital 8 tapes. It’s short bursts of interesting things. Moving forward, I need to figure out how to aggregate that video in a format my kids can enjoy in 25 years.

UPDATE: 12-31-18

It turns out, I don’t need to upgrade the Raspberry Pi, I just needed to educate myself on video formats, transcoding, and Plex. As I utilize more features of Plex in the future, I may need more power than a Raspberry Pi 3 provides, but for now, it will work fine to serve my fifty home movies.

The power of Plex is its ability to transcode video for the device viewing the content. When converting my video from tape to digital, I create .mov files. When viewing these videos on Apple TV or iPads, they are transcoded from MPEG to H.264. This is a CPU heavy process.

Plex provides the ability to pre-optimize videos and save them on the server. For my videos, that format is H.264 at 480p resolution. When viewing a pre-optimized video, Plex doesn’t need to transcode the video, just stream it, which is not CPU intensive. This is called Direct Play.

When you have a low powered Plex server, like a Raspberry Pi, the goals is to Direct Play all videos by pre-optimizing them for the devices they are viewed on.

Pre-Optimizing is very easy. You simply choose one or more videos and select the Optimize option. Since this process is CPU intensive, it may take a long time for each video, but it’s only a one-time process.

From Mac to Linux

In 2005 I made the switch from Windows to Mac as my primary working environment. In 2018 I made a similar switch to Linux. In both cases, the change was somewhat gradual, and the process was the same. In 2005 purchased the newly released Mac Mini and set it up on my desk to the side. Over a few weeks I got comfortable with MacOS, and eventually, my Windows computer was moved to the side. The same happened at the end of 2017. I purchased a Meerkat from System76, which has a similar physical profile as the 2005 Mac Mini. It too sat to my side as I became familiar with the Linux desktop experience. Linux is now my primary os.

Why switch? For me, it was practical reasons.

Knowledge. 80% of my computer time is spent doing web development on a LAMP stack (Linux, Apache, MySQL, and Apache). Linux is at the core of my local development environment, as well as, the server environments my websites run on. Like most Drupal developers, I’m doing more DevOps, all of which is based on Linux software. The primary reason for my switch was to spend more time in the Linux environment to improve my Linux knowledge and skills.

Hardware choices. While I’m an Apple fan and will continue to use a Mac and iOS devices, they frustrate me. My daughter still uses her 2010 MacBook Pro, that’s possible because I could upgrade the RAM and change the hard drive. The hard drive has been replaced twice, first an upgrade to a 250 GB hard drive, then a 500GB SSD. I believe that was the last Mac Book you could upgrade. Moving to Linux gives me unlimited choices in hardware. Desktops and laptops configured how I choose and they can be updated and modified as I need them to.

It’s Possible. Linux distributions and open source software has matured to the point that it’s possible for me to use Linux exclusively. I’m currently using the Pop_OS Linux distribution. From a user interface perspective, it’s as elegant and powerful as Mac OS. While it lacks the level of integration of the Mac, it’s refreshing to have less integration. It feels lighter and less bloated. What about MS Office? Libre Office is a fitting replacement. I discontinued my Office 360 subscription. I’m finding that Linux could also use the tagline “there’s an app for that.”

Performance. Linux on current hardware is fast.

I don’t believe I’ll switch back to Mac, but who knows!