Installing Linux on an External SSD drive
Contents
MicroPython and Linux
This website is dedicated to MicroPython so why is there an article on how to install Linux?
I have mostly used Windows (since Windows 3.0) in the last 30+ years with some experience of Unix (for Oracle and SCADA systems) then Linux as its popularity increased. I still predominantly use Windows 11 as there are specialised software packages that I must use that simply aren't available for Linux (and probably never will be).
However if one is to get really serious with the MicroPython world it will eventually mean using a Linux workstation. There are new microcontroller boards appearing very regularly that have the hardware to run MicroPython firmware. An official version of firmware for a new board may not appear on the MicroPython download page for sometime, if ever.
The solution is to compile your own MicroPython firmware. This is becoming an increasingly popular activity. While all the tools required to achieve this aim are readily available (with heaps of documentation) they require Linux for their use.
What Linux Distro & Where to Install It?
My development laptop is a modern, well-resourced HP business laptop running Windows 11 on a dual monitor setup. It is an absolute requirement that I retain Windows as my main OS. So my decision was to install Linux completely separate to Windows which boots and exists on the internal SSD drive.
Thus the decision was made to install the Linux distro Fedora Workstation with KDE Plasma as the desktop on an external USB 3.2 Gen 2 SSD drive with 256 GB of capacity. This drive is seriously fast and will comfortably run the new OS with little if any lag.
Why Fedora? A quick online search revealed that many people had attempted a clean standalone install, as I intended doing, but ended with disastrous results; often destroying their Windows installation. While coming to the conclusion that in many cases this was 'operator error' the happiest stories seemed to come from those who had installed Fedora.
Why KDE Plasma desktop? The default desktop with Fedora is Gnome. It's a very simple desktop but provides very little in the way of configuration. KDE, on the other hand, provides a much richer experience and just about everything is configurable in the GUI. It is also has an environment quite similar to Windows. So for a Window's power user it's quite easy to learn.
The following sections describe what I did to successfully install Fedora to an external SSD drive attached to a Windows 11 laptop. It was essential that the Windows 11 install on the internal SSD drive remained untouched.
Preparing for the Fedora Install
The hardware requirements for this install are simple. Apart from a laptop running Windows 11 the only other essential hardware needed is:
- 1 x USB flash drive with a capacity of at least 8GB. The install process overwrites all data on the flash drive.If the flash drive has any data on it that must be retained then it should be saved elsewhere.
- 1 x external SSD drive; faster the better. Most modern SSD drives are of at least 128 GB capacity which is more than adequate. Speed is of higher importance here.
There are several prerequisite tasks that must be completed before the install can begin:
- Windows fast startup must be disabled. This is done inside Control Panel:
- Power Options
- Choose what the power buttons do
- Change settings that are currently unavailable
- Deselect "Turn on fast startup"
- Determine what key to press to enter the UEFI Setup Menu immediately after pressing the power button on the computer. On my HP laptop this is the F10 key but may be different for other computer brands.
- Determine what key to press to enter the Boot Order Menu immediately after pressing the power button on the computer. On my HP laptop this is the F9 key but may be different for other computer brands.
- USB Storage Boot must be enabled otherwise it won't be possible to boot from the flash drive for the install. On my HP laptop this is a UEFI Settings Menu option:
- Advanced menu
- Boot Options
- Enable "USB Storage Boot"
- It is essential that Fedora boots with UEFI Secure Boot enabled. On my HP laptop it is necessary to configure the UEFI to accept Microsoft signed keys. This is a UEFI Settings Menu option:
- Security menu
- Secure Boot Configuration
- Enable "MS UEFI CA key"
- Windows Recovery Drive: [OPTIONAL] Can be used to restore the internal Windows partition in the (unlikely) event something goes wrong! Requires a USB flash drive of at least 16 GB capacity. Built with the Windows 11 Recovery Drive tool.
Installing Fedora Media Writer
The Fedora Media Writer writes the Fedora installation image to the USB flash drive and makes it bootable. Don't be tempted to use a third party tool such as Rufus as this may render the flash drive unbootable while Secure Boot is enabled.
- Navigate to the Fedora Workstation download page.
- Scroll down to the Fedora Media Writer section and click the button for the Windows and Mac download. This will open up a GitHub page.
- On the GitHub page select and download the installer for FedoraMediaWriter-win64 and install the application.
Writing the Fedora Install Image to USB Flash
This is a straight forward task.
- Insert the USB flash drive into the computer and start the Fedora Media Writer application.
- Select Image Source: Choose Download automatically.
- Select Fedora Release: Select Official Editions then in the dropdown select Fedora KDE Plasma Desktop.
- Write Option: Select Delete download after writing. Click the Download & Write button.
- Exit Fedora Media Writer after the writing process has completed. Leave the USB flash drive attached to the computer.
Install Fedora Workstation & KDE Desktop
This is the critical part. Proceed slowly and with caution while checking everything on all screens. This is essential to prevent the install from overwriting the Windows install.
- Shutdown the computer, Power back on and load the Boot menu.
- Find the USB flash drive and click on it. This will force the computer to boot into the Fedora Live system ready for the install.
- After Fedora Live has loaded, click Install to Hard Drive.
- Select a Language and Keyboard.
- Leave Date and Time and Timezone at their defaults. It's often easier to sort these after the install.
- Ensure the external SSD drive is plugged into the computer.
- Click Change destination. If the external SSD drive isn't in the list then click Rescan devices.
- IMPORTANT: Select the external SSD drive. Make sure that the internal SSD drive containing the Windows OS IS NOT SELECTED.
- Select Use entire disk option.
- Don't select Encrypt my data.
- Fill out the fields for Use local account. Remember the password you have entered!
- Carefully check the Review and Install screen.
- If satisfied then acknowledge the warning and click Erase data and install button.
- After a successful install, shutdown the computer. Remove the USB flash drive and the external SSD drive. Power up the computer again; it should boot normally to Windows 11. Shutdown the computer when satisfied that Windows seems normal.
- Plug in the external SSD drive with the Fedora install. Press the computer's power button and load the Boot menu. Click on the external SSD drive entry and allow the computer to boot into Fedora and the KDE Plasma desktop.
- Shutdown the computer but leave the external SSD drive attached to the computer.
Setting the Computer's Boot Order
The final step is set up the boot order so that it is easy to select either OS to boot into whenever the computer is turned on.
- Start the computer and enter the UEFI Setup Menu.
- Find the EUFI boot order list. Move the external SSD drive above Windows Boot Manager in the list. Don't forget to save the selection before exiting the menu.
With the boot order now sorted it's easy to select which OS will be booted. If the external SSD drive is not attached then the computer will boot into Windows 11. If the the external SSD drive is attached then the computer will boot into Fedora.
Microcontroller Bits and Pieces
Tools for Microcontrollers
dfu-util Utility
esptool Utility