Adapting official Ubuntu MATE 16.04.2 LTS image to run on Raspberry Pi 3 Model B+ (3B+)

installation
system

#1

Background

I have just bought the newest Raspberry Pi 3 Model B+. I played with NOOBS but I like Ubuntu MATE more :slight_smile:

So I went to the download page and got ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz image file. I did not know yet that it is not supported on Raspberry Pi 3 Model B+. Then I tried to perform some search here and on RaspberryPi.org forums. Both recommend to download special image for 3 B+ (another 4.32 Gb, see for example this post by MaxVMH here or on RasperryPi.org).

But from reading post on RaspberryPi.org forum I decided to somehow run rpi-update on the downloaded 16.04.2 image.

Below is my method.

Method

Prepare host

We need to use Ubuntu 18.04 LTS, and install QEMU components to it.

sudo apt-get update
sudo apt-get install qemu-user-static kpartx

As we already have downloaded ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz, we can unpack it:

cd ~/Downloads
unxz ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz

then create corresponding loop-devices for it:

sudo kpartx -a -v ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img

Then we will mount virtual SD card partitions to the system.

Mount RPi SD card to the host system

At first we need to determine their names and block devices (we need PI_BOOT and PI_ROOT):

$ sudo lsblk --fs
NAME      FSTYPE LABEL   UUID                                 MOUNTPOINT
loop0                                                         
├─loop0p1 vfat   PI_BOOT EAD0-90DA                            
└─loop0p2 ext4   PI_ROOT 9d97a4df-a4eb-4b09-92b6-bb1ccfade0ee 

Then mount them

sudo mount /dev/mapper/loop0p2 /mnt/
sudo mount /dev/mapper/loop0p1 /mnt/boot/

Copy QEMU part to the RPi file-system and copy resolv.conf to have network in the chroot:

sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

Prepare for chrooting and then go to chroot

sudo mount --bind /dev /mnt/dev/
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /sys /mnt/sys/
sudo mount --bind /proc /mnt/proc/
sudo chroot /mnt

Run rpi-update inside chroot:

rpi-update

To get Wi-Fi working (preventing kernel: [ 11.013103] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.txt failed with error -2 error) according this AskUbuntu answer we need to download the mentioned file and save it as /lib/firmware/brcm/brcmfmac43455-sdio.txt while being in chroot:

wget https://github.com/khadas/android_hardware_amlogic_wifi/raw/b6709758755568e4a0ff6e80993be0fc64c77fb9/bcm_ampak/config/6255/nvram.txt -O /lib/firmware/brcm/brcmfmac43455-sdio.txt

Then exit from chroot:

exit

Unmount SD Card from host system

Sync data and unmount all directories:

sync
cd ~/Downloads
sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt/boot
sudo umount /mnt

And finally remove loop-devices with

sudo kpartx -d -v ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img

and write this image as usual (with ddrescue or with GNOME Disks).

Boot modified SD Card in RPi

Insert modified SD Card into Raspberry and follow wizards on the screen. Wait them to finish. Insert Ethernet cable to the Raspberry.

Then login to the system and run:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get clean
sudo apt-get autoremove

As the result we have working upgraded Ubuntu 16.04.5 LTS MATE which is fully functional on our Raspberry Pi 3 Model B+. So all things (Wi-Fi, Ethernet, HDMI, 3.5mm sound, USB) work as expected.

Hope this helps both Raspberry and Ubuntu MATE community :slight_smile:


Status of Ubuntu MATE 18.04 for Raspberry Pi 3 B & B+?
Can it be done? RPi3B+ with CDS Stretch Touch Screen
How to enable support for Raspberry Pi 3B+ and 3A+ in Ubuntu MATE
#2

Thank you for your efforts!


#3

Seriously man, I very much appreciate your post, and it helped my friend and I get a great understanding on what we were doing, even a little of the why. Keep on being awesome, Thanks!


#4

Hi Norbert,

Thanks for a great instruction sheet for using Mate with the Raspberry Pi 3 B+
I have been using RPIs for a few years and updating to the newer models as they became available.

From version RPI 3 B I started using Mate 16.04 and I was very impressed with this software on such a small computer. So, as before I purchased the RPI 3 B+ when it became available and simply transferred my SD card with the operating system with the Mate desktop. As you would know, that didn’t work. So next try download a fresh version and try. Again, no go. Then most frustrating thing was that there was no information available as to why it didn’t work and what to do to get it working. I looked everywhere but didn’t find anything.

What to do? Well, I basically did what Steven is explaining in his message in this Forum: 16077. I downloaded a fresh installation of 2017-11-29-raspbian-stretch-lite and then worked out how to install Mate on that, and IT WORKED!

Now I see you method which is obviously the better way to go about this. Thank you for your effort!

Now a SUGGESTION: I would like to suggest that you make a fresh copy of your installation and offer to upload it to RaspberryPi.org so that they could make it available to people who do not have your skills, to simply download, install and use.

Thanks again,

OzOle


#5

Thanks Norbert_X for this Howto.

But, as always :sweat_smile: I have a question.
I did the install and it worked well. Next I’ve tried to run the software updater and which reported the boot-Partition to be to small. Unfortunately my gparted on my Laptop does not allow to move the root-partition to be able to resize the boot partition.

Question and suggestion: How could I resize the partition to 128 MB before writing the image to the SD-card? And maybe it would be a good idea to include this step by default in your HowTo?

Just as a remark. After the first boot the Raspi reported to have no Wifi-Hardware, but after rebooting it found the Wifi Hardware and my Wifi.

Thanks for this
Hajo


#6

I don’t own a Pi 3B+, but congrats on getting Ubuntu MATE to work on it.


#7

G’day mate (aussie greeting),

When you initially install the image to the sd card, the boot and root partitions do NOT take up all the available space on the sd card! How, do we know that? Because when you boot up the new sd card the first time, what is the first thing it does? Yeah, it first, before you even get access to the new system, automatically extends the root partition to fill the entire sd card. Therefore, if you DO NOT boot up the new card immediately after installation, and assuming you have access to a working installation with gparted, then BEFORE booting the first time, you could insert the card into this running system and using gparted extend the root partition leaving a bit of space at the top, say 128 MB. Next move the root partition up to fill the space at the top leaving unallocated space between the root and boot partitions. And, finally, extend the boot partition to take up the newly created space between the two partitions.

I have never experienced your problem, so I have not had the opportunity to try the above suggestion. If it works, then you will no doubt be pleased. If it does not work, then at worst you have wasted some time.

Please let us know whether or not it works.

Cheers,

OzOle


#8

To be honest, I have no idea what you suggest me to try.
I have tried to move the second partition and than extend the first with gparted BEFORE removing the SD-Card from my laptop. But unfortunately the second partition could not be moved.


#9

I don’t know if this will help or not, but I also documented the process of getting Ubuntu MATE to run on a Pi 3B+. My approach is a little different, but perhaps you’ll find it easier to follow(?), especially where the partition management part comes in…

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

Hope it helps! :innocent: