[How-To] Set Up and Upgrade Ubuntu MATE 16.04 on a Pi 2/3/3B+

installation
system

#1

How-To Set Up and Upgrade Ubuntu MATE 16.04 on a Pi 2/3/3B+

Table of Contents

I. Introduction
II. Useful Tips
III. Project Requirements
IV. Preparations
V. Ubuntu MATE Card Setup
VI. Installing Ubuntu MATE 16.04
VII. Upgrading to Ubuntu MATE 18.04
VIII. Next Steps
IX. Notes
X. Resources
XI. Changelog

I - Introduction

Annotations Used in this How-To

  • PI – Action takes place on the Raspberry Pi.
  • PC – Action takes place on a PC (Windows or Mac).
  • TERM – Action takes place at a Command Line, in a Terminal Window.
  • GUI – Action takes place in the Raspberry Pi graphical user interface.
  • OPTIONAL – Item is optional.
  • Monospace text – Identifies command line input, system elements, and labels.

Caveats Pertaining Ubuntu MATE for the Raspberry Pi

The stock Ubuntu MATE distribution for the Raspberry Pi has several issues:

Caveats Pertaining Ubuntu MATE for the Raspberry Pi

The stock Ubuntu MATE distribution for the Raspberry Pi has several issues:

  1. The Ubuntu MATE download page says you need a card with a capacity of 6 Gib or greater. The image expands to a little over 8 Gib, so you really need a 16 Gib card or greater; no big deal if you’re aware of it.¹
  2. The fat16 (a.k.a. DOS) partition (/boot in Linux) is 64 Mib in size. The Ubuntu software updater fails because there isn’t enough room on the partition for it to run. This leaves running updates from the command line as your only option; doable but annoying.
  3. The project leaders are having issues creating downloadable images of Ubuntu MATE newer than 16.04, and the latest release is 18.04.¹ It is possible to upgrade to 18.04, but it is very time consuming and interactive. Furthermore, support for the 16.04 release is set to end in April, 2019.
  4. The Raspberry Pi port of Ubuntu MATE is compiled with the ARMv7 instruction set, not ARMv8. This means that it runs as a 32-bit system instead of 64-bit. Hopefully this is something the project leaders will be able to address in due course.
  5. The Raspberry Pi Foundation released the Pi 3B+ in March, 2018. The differences between the 3B+ and its predecessors prevent the stock Ubuntu MATE image from booting on it out of the box. Even though the 3B+ can and will run Ubuntu MATE, this author does not know if the next downloadable image will address this matter.¹

About This How-To

This How-To will walk you through the process of creating an Ubuntu MATE installation that:

  • Overcomes the /boot partition issue.
  • Renders the 16.04 end-of-support issue moot.
  • Allows Ubuntu MATE to run on a Raspberry Pi 3B+.

Although it will be helpful if you already have a little basic experience with Linux or another Unix variant, it is not necessary. The instructions contained in this How-To have been written in a manner that does not require such knowledge.

The directions are split into five distinct sections with multiple steps each. At best, the entire process they describe will take several hours to complete. It is assumed that you will want/need to take breaks as you go along, and the best place to do so is at the end of a section. Additional safe stopping places between steps are also identified.

Disclaimer

Please note that the author has not attempted to perform the procedures described in this document on a previously installed Ubuntu MATE system; the procedure described here is for a fresh install. The author shall not be held responsible if you choose to perform these steps on a previously installed Ubuntu MATE system and things go wrong. Remember: You can always back up your existing user data and then restore it on the newly created system!

II - Useful Tips

My Raspberry Pi Says…

When the Raspberry Pi is powered up, the first thing it displays is a large color gradient square. Referred to as the Rainbow Square, it quickly goes away once the Pi starts booting from the MicroSD card. If it doesn’t go away, the Pi is not able to boot it may be because there is no MicroSD card in the Pi, the card is blank, or the card got clobbered somehow. The on-board LEDs may also flash a in a pattern under these conditions.

The Raspberry Pi can also display one of three icons in the upper-right corner of the screen:

  • A yellow lightning bolt, which indicates that the Pi is not getting enough power.
  • A partially red thermometer, which indicates a CPU temperature between 80°C and 85°C.
  • A fully red thermometer, which indicates a CPU temperature above 85°C.

Turning Your Raspberry Pi Off Properly

It is extremely important that you never shut off your Raspberry Pi by simply turning off its power supply! Doing so will likely corrupt the data on all connected storage media.

  • In a best case scenario the next boot will take an extremely long time.
  • In a worst case scenario the system may not boot at all.

Always do a proper (orderly) shutdown and wait for the green LED to stop blinking (or another visual indication) that the shutdown completed before unplugging it. This is the golden rule.

If you do not wish to unplug the power supply once your Raspberry Pi has shut down, you have several options at your disposal:

  • Purchase a USB ► MicroUSB cable with an in-line power switch rated for the Raspberry Pi. You will still need to follow the golden rule and do an orderly shutdown first!
  • Research and obtain third party add-on hardware that will initiate an orderly shutdown by pressing a button. You will need to research this thoroughly to ensure the add-on actually does this!

Storage Media Care and Feeding

To avoid damaging the MicroUSB card and/or the Raspberry Pi, never insert or remove the card while the Raspberry Pi is getting power.

Always unmount (eject) USB flash drives or other storage media before disconnecting it from the Raspberry Pi, as it is almost certain that the data on the card will end up corrupted.

How to Access the Linux Command Line

At various points in this How-To, you will need to access the Linux Command Line. If this is your first experience with Linux, you can access it by opening a Terminal window. Its icon looks like a computer screen, and you will find it:

  • On the Me nu Bar in Raspbian.
  • Under ApplicationsSystem Tools in Ubuntu MATE.

Please note that unlike on Windows and Mac computers, the default placement of the menu bar in Linux is at the top of the screen.

III - Project Requirements

  • A Raspberry Pi2 or Pi3.
  • One Class 10 MicroSD card, 16 Gib or larger for your Ubuntu MATE system.
  • One Class 10 MicroSD card, 8 Gib or larger, with the latest release of Raspbian installed.
    Note: If you are starting from scratch, use the NOOBS image and follow the setup directions on the Raspberry Pi web site.
  • One USB flash drive with at least 50 Mib of free space.
  • One USB SD (or MicroSD) Card Reader.
  • One MicroSD ► SD adapter, should your card reader doesn’t accept MicroSD directly.
  • The Ubuntu MATE 16.04 ISO image.
  • PC: SD Formatter, an SD card formatting utility (Win/Mac).
  • PC: Etcher, a disk image flashing (writing) utility (Win/Mac).
  • PI: GParted, a disk partitioning utility.
  • OPTIONAL: Raspberry Pi3 B+.

IV - Preparations

  1. PC: Prepare the Raspbian NOOBS MicroSD card as per the instructions on the Raspberry Pi web site, and eject it when done.
  2. PC: Use SD Formatter to format the Ubuntu MATE MicroSD card.
  3. PC: Use Etcher to write the Ubuntu MATE ISO image to the MicroSD card.
  4. PC: If Etcher did not do so for you automatically, eject the Ubuntu MATE MicroSD card.
  5. PI: Insert the Raspbian NOOBS MicroSD card in the Raspberry Pi 2 or Pi 3, and boot it.
  6. GUI: Look for GParted in the Preferences menu; install it if not found:
  • TERM: sudo apt-get install gparted –y
  1. PI: Connect the USB flash drive.
  2. GUI: Open the file manager.
  3. GUI: Copy the folder /lib/firmware/brcm (a.k.a. Firmware) to a folder on the USB flash drive.
  4. GUI: Copy the content of /boot (a.k.a. Boot Folder) to a folder on the USB flash drive.
  5. PI: Eject the USB flash drive and set it aside.

V - Ubuntu MATE Card Setup

  1. Insert the Ubuntu MATE card in the reader.
  2. PI: Connect the card reader.
  3. GUI: Launch GParted to adjust partitions:
  • Select the card: Typically /dev/sda.
  • Right-click and unmount both partitions: /dev/sda1 and /dev/sda2.
  • Select the partition called /dev/sda2 (ext4).
  • Right-click and select ‘Resize/Move’, and set ‘Free Space Preceding’ to at least 64 Mib
    Note: You can create additional space to make a larger boot partition. Use increments of 16 Mib if you choose to do this. However, this How-To will continue to assume 64 Mib.
  • Select the partition called /dev/sda1 (fat16).
  • Right-click and select ‘Resize/Move’, and set ‘Free Space Following’ to 0. This will increase the partition size to 128 Mib.
  • Click apply to commit the changes.
    Note: If there’s a gap between the fat16 and ext4 partitions, repeat the last three steps to fill it by enlarging the fat16 partition. For example, enlarging the partition to 128 Mib typically produces a 1 Mib gap that requires closing.
  • Verify the fat16 partition flags are boot and lba. Set them if they are not.
  1. PI: Shut down the Raspberry Pi, and then unplug it.
  2. PI: Move the Ubuntu MATE card to the PC.
  3. PI: Remove the Raspbian NOOBS MicroSD card and put it away.
  4. PC: Format the fat16 (DOS) partition.
    Note: A Windows computer will usually prompt you to format the partition because it can’t recognize it.
    Caution: Do NOT use SD Formatter, as this will wipe the whole card!
  5. PC: Mount the USB flash drive.
  6. PC: Copy the contents of the Boot Folder [from IV.10] to the Ubuntu MATE card.
  7. PC: Eject the Ubuntu MATE card and the USB flash drive.

VI - Installing Ubuntu MATE 16.04

These instructions must be completed on a Raspberry Pi2 or Pi3, as steps 1 to 7 will not work on a Pi 3B+!

  1. PI: Insert the Ubuntu MATE card in the Raspberry Pi 2 or Pi 3 and boot it.
  2. GUI: Go through the system setup.
  3. GUI: In the Ubuntu MATE Welcome window:
  • Click on ‘Raspberry Pi Information’ and then on ‘Resize Now
  • Reboot when instructed.
  1. GUI: If necessary, click on the network icon in the menu bar and configure the network connection.
  2. TERM: sudo BRANCH=stable rpi-update
    Note: Do not reboot when this update completes!
  3. PI: Mount the USB flash drive.
  4. TERM: sudo su -
  5. TERM: Copy the Firmware from the flash drive to /lib/firmware/brcm
  6. PI: Do one of the following:
    a. If staying on the Raspberry Pi 2 or Pi 3:
    » Reboot.
    b. If switching to the Raspberry Pi 3B+:
    » Shut down.
    » Unplug the Pi.
    » Move the Ubuntu MATE card to the Pi 3B+ and boot it.
  7. PI: Enable the updated Wireless drivers.
    Note: On a Raspberry Pi 3B+, this will also enable 5 GHz WiFi.
  • TERM: sudo su -
  • TERM: rfkill unblock wifi
  • TERM: rfkill list
    Note: This will return the status of the wireless and Bluetooth connections. If either one shows the presence of a soft or hard block, repeat the unblock.
  • TERM: apt-get --no-install-recommends install network-manager
  1. PI: Reboot to commit the changes.
  2. PI: If you encounter issues with WiFi after logging in:
  • TERM: nmcli dev wifi list
  • TERM: nmtui-connect

VII - Upgrading to Ubuntu MATE 18.04

  1. PI: Bring your Ubuntu MATE 16.04 system up to date.
    Note: The first two commands prepare for this and only take a few minutes to do so. The third performs the actual update and might take over an hour to complete based on several factors; do not interrupt it!!! That same step may prompt about replacing a configuration file; since this is a fresh installation, it makes no difference whether you replace it or not. The fourth step performs a cleanup and only takes a few minutes to complete. It is safe to take a break once this fourth step is finished.
  • TERM: sudo apt-get autoclean
  • TERM: sudo apt-get update
  • TERM: sudo apt-get upgrade -y
  • TERM: sudo apt-get autoremove -y
  1. PI: Upgrade your system to Ubuntu MATE 18.04.
    Note: The upgrade process will take a minimum of one hour to complete. Once you start it process it cannot be interrupted without consequences. There are four points where you will need to answer some prompts; accept the defaults where applicable.
  • TERM: do-release-upgrade
  • PI: Reboot the system to commit the upgrade. You can shut down the system instead, if you need to take a break.
  1. GUI: Under the System menu, launch ‘Preferences’ ► Look and FeelMATE Tweak.
  • Select ‘Panel’ in the sidebar.
  • Select the ‘Traditional’ panel layout from the dropdown menu.
    This restores the default panel with all objects, as a glitch causes some of them to disappear during the upgrade. If the Traditional layout shows as active, change it to something else and then change it back to force the reset.
  1. GUI: Under the ‘System’ menu, launch ‘Administration’ ► 'LightDM GTK+ Greeter Settings'.
  • On the ‘Appearance’ Tab, select a background image or color.
    The background image for the login/lock screen is invalid. Your choice will correct this.
  • OPTIONAL: On the ‘Window Position’ Tab, re-center the dialog by changing the horizontal value to 50.
  1. GUI: Install applications excluded from version upgrades²:
    Note: These applications are not part of the online upgrade process; they only ship in downloadable ISO images.
  • TERM: sudo snap install ubuntu-mate-welcome --classic -y
  • TERM: sudo snap install software-boutique --classic -y
  • TERM: sudo snap install pulsemixer -y

VIII - Next Steps

  1. OPTIONAL: Install useful applications:
  • TERM: sudo apt-get install gparted -y
  • TERM: sudo apt-get install glances -y
  1. Install your choice of additional applications.
  2. Customize the system to your liking.
  3. Have fun!

IX - Notes

Sound

There is a possibility that sound will not work when you first install Ubuntu MATE 16.04. This will definitely be resolved once the system is brought up to date. The audio subsystem will be recognized as Analog Stereo.

After upgrading to Ubuntu MATE 18.04, audio will continue working, but the subsystem will be recognized as Analog Mono. If a fix to this is identified, this How-To will be updated accordingly¹.

Failure Message During Boot

As the Linux boot sequence progresses, status messages are displayed on the screen. After upgrading to Ubuntu MATE 18.04, you will see that one of these status messages reads:

[FAILED] Failed to start Load Kernel Modules.

Along with a description of the error, systemctl status systemd-modules-load.service will list the four modules that could not be activated. The first three of these (lp, ppdev, and parport_pc) are used by Linux to print via a Parallel Port, something the Raspberry Pi does not have. The fourth module (bcm2708_rng) is for the random number generator. If a fix to this is identified, this How-To will be updated accordingly¹.

X - Resources

This How-To was mainly compiled through trial and error. Some of the covered topics are discussed in:

Links Mentioned in This How-To

XI - Changelog

04.12.2018

  • Corrected an error in V.3 that was referencing the wrong partition for the moving step (thank you, dandnsmith).

02.11.2018

  • Corrected discrepancies in text
  • Added instructions for checking that the rfkill command “took”
  • Added instructions for eliminating issues with the LightDM GTKGreeter.

28.10.2018

  • Reformatted and reorganized for readability
  • Added sections with Pi-related information
  • Moved the changelog into the How-To
  • Published a PDF version of the How-To

28.10.2018

  • Corrections and enhancements
  • Fixed out-of sequence sub-steps
  • Beautified the content
  • Added hyperlinks where required

27.10.2018

  • First publication

¹ As of October, 2018
² Packages are part of the downloaded distribution image and must be restored manually


Version for Raspberry PI 3 B+ 2018
Is ubuntu mate available for raspberry pi 3 b+
Ubuntu Mate / Raspberry Pi 3b+
Ubuntu on Raspberry Pi 3B+
Raspberry Pi B plus support?
16.04.2 Won't boot on RPi 3 Model B+
#3

thank you for this! one trick I learned: to shutdown, create a desktop launcher with the command line: “shutdown -P now.” (without the " & . ). Set it to a command line application. I also created one to reboot: “shutdown -r now.” Note the difference in capitalization for each.


#4

This was a big help. However, I couldn’t get this to work unless I skipped steps V.5-10 If I skipped those steps everything seemed to work fine. Not sure what the ramifications are of skipping those steps are or what I did incorrectly but when I followed the steps I would get a kernel panic unable to mount root fs error. Even so this was the best help for someone with as little experience as I have to get Ubuntu Mate setup on the raspberry pi 3B+.


#5

Glad you found it helpful. Let me explain what each step does; perhaps that’ll help you shed light on your concerns/questions:

  1. You’re going to work with the Ubuntu card under Windows or OSX.
  2. You no longer need the Raspbian card, so…
  3. I’m not versed in it, so I cannot tell you what exactly, but Windows makes certain assumptions about FAT and NTFS partitions. Resizing under Linux “confuses” Windows so it thinks the partition is corrupt even though it is not. Usually you cannot access the partition in question, so formatting it under Windows fixes this. Even if you’re able to read the partition under Windows, if Windows thinks it’s corrupt, data writes may be unreliable.
  4. Self explanatory: The data you want is on the flash drive… LOL
  5. The data you “preserved” under IV.10 gets put on the Ubuntu card. Remember: You don’t create a folder called “BOOT”; the files from that folder belong in the top level of the card (along with the folder called “overlays”. If this is confusing, mount the Raspbian card in Windows/OSX and look at how it is organized: No matter whether it’s Raspbian, Ubuntu, LibreELEC, etc., that partition always looks the same.
  6. You’re done, so… self explanatory.

That said, the kernel panic could be because you either missed a step somewhere (possible because there’s so many of them), or something went awry in the process. For example: A file didn’t copy correctly to/from the USB stick, or there’s a flaky spot on the media. Which begs the obvious question: Did you start from scratch or try different media to see if it made a difference?

Just some thoughts… O:-)


#6

Well, I must have done something wrong on that one. I have gone through this several times on two different cards. I have it working now so I must have repeatedly missed a step in the begging somewhere. I did start from scratch and going through this exercise a few times is a good way to learn. I think I have my OS setup done now. Off to python and more fun. Thanks.


#7

Glad you got it working :slight_smile: