How to Get Ubuntu-MATE 18.04 up on Raspberry Pi 4

Most direct (but slightly buggy) way to get Ubuntu-MATE 18.04 on Pi 4.

These procedures were written and validated on 11 August 2019 and used a
laptop with Ubuntu-MATE 18.04 (AMD64 version) as a workstation to store
files and manipulate images, and a Raspberry Pi 3 (not B+ although that
should be Ok as well) as a temporary install machine. I used the most
recent ubuntu-MATE image for 32-bit Raspberry Pi3 which is:
ubuntu-mate-18.04.2-beta1-desktop-armhf+raspi-ext4.img (uncompressed) and
the Raspbian Buster install (updated to kernel 4.19-58). Any instances of
'' refer to your local user account name, and the procedures assume
that you work from your local home directory.

  1. Install and update Raspbian on your Pi 4 per Raspberry Pi instructions.
    After all files are updated, insert the microSD card in a computer (I used a
    Ubuntu-MATE AMD64 installation with a SD-to-microSD adapter so that the
    system is mounted on /media//boot and /media//rootfs). In your
    local workspace create three directories; 'Boot', 'libModules' and
    'libFirmware' and copy files from the microSD card to these directories as:

    sudo cp -rp /media/<user>/boot/* Boot/
    sudo cp -rp /media/<user>/rootfs/lib/modules/* libModules/
    sudo cp -rp /media/<user>/rootfs/lib/firmware/* libFirmware/
    
  2. Umount and remove the Raspbian installation. Insert a microSD card on
    which to install Ubuntu-MATE and unmount any partitions that automount with
    commands such as: sudo umount /dev/mmcblk0p1

  3. Assuming you have already downloaded the Ubuntu-MATE 32-bit image as
    cited above, install it on the microSD card (I use the old, slow way with:
    sudo dd if=ubuntu-mate-18.04.2-beta1-desktop-armhf+raspi-ext4.img of=/dev/mmcblk0 bs=1024K)
    When complete, remove the card and install it in
    a Raspberry Pi 3. Boot the machine and complete the installation and
    configuration as you desire. When you are satisfied with the configuration,
    power down the Raspberry Pi, remove the microSD card and mount it in your
    workstation.

  4. The directory structure of Raspbian and Ubuntu-MATE differ particularly
    in the /boot partition and we will clear out some of the Ubuntu-MATE
    structure to allow the Pi 4 to boot. First clean out some files not needed
    in the final product:

    sudo rm -rf /media/<user>/system-boot/*
    sudo rm -rf /media/<user>/writable/lib/firmware/*
    sudo rm /media/<user>/writable/initrd.img*
    sudo rm /media/<user>/writable/vmlinuz*
    

    and install our saved data from the Raspbian installation as:

    sudo cp -rp Boot/* /media/<user>/system-boot/
    sudo cp -rp libFirmware/* /media/<user>/writable/lib/firmware/
    sudo cp -rp libModules/* /media/<user>/writable/lib/modules/
    
  5. Now we need to tell the new image where to find files, so we need the
    identification of the new image partitions. I ran:

    ls -lF /dev/disk/by-partuuid
    

    which resulted in the following for the microSD card partitions:

    lrwxrwxrwx 1 root root 15 Aug  9 13:27 a91cf5fc-01 -> ../../mmcblk0p1
    lrwxrwxrwx 1 root root 15 Aug  9 13:27 a91cf5fc-02 -> ../../mmcblk0p2
    
  6. Using your favorite editor (after the 'jstar' variant of 'joe', I use
    vim.tiny), edit /media/<user>/system-boot/cmdline.txt and replace the
    PARTUUID value in the line with the value you just read above which ends
    with '-02'. This tells the Raspbian boot sequence where to find the Root
    partition. We will keep the LABEL references in the /etc/fstab image for
    now, so there is no need to edit that file for the PARTUUID, but you do need
    to edit it to reflect the correct /boot reference, so edit
    /media/<user>/writable/etc/fstab and change the entry reading
    '/boot/firmware' to just '/boot'.

  7. We also need to disable the accelerated graphics on the Pi4 since the
    version of Mesa in Ubuntu 18.04 is too old. Do this by editing
    /media/<user>/system-boot/config.txt and commenting out (by placing a '#'
    in front of) the line near the end: 'dtoverlay=vc4-fkms-v3d'. If you do not
    /do this, you will be restricted to command-line only. (NOTE: this makes it
    the same as the line in the [all] section)

Now you are ready for the big smoke test. Insert the microSD card in your
Pi4 and turn it on! Have patience since there is a lot going on behind the
scenes in the system. You should first see the 4 Raspberries, then the
Raspbian scripts followed by a quick switch to the Ubuntu-MATE symbol and then
a blank screen for a couple of minutes before the login screen appears. I
don't know why the delay is happening, but this does give you a way to get
Ubuntu-MATE 18.04 up on a Raspberry Pi 4.

After the seemingly interminable wait, you may now log into the system and
have a functioning system just as you configured on the Pi 3 system. You
will need to reconfigure the wifi (if used) since the new hardware will not
recognize the earlier Pi 3 configuration.

Hal

2 Likes

Second and longer method of getting Ubuntu-MATE 18.04 on Raspberry Pi 4.

These procedures were written and validated on 11 August 2019 and used a
laptop with Ubuntu-MATE 18.04 (AMD64 version) as a workstation to store
files and manipulate images, and a Raspberry Pi 3 (not B+ although that
should be Ok as well) as a temporary install machine. In order to duplicate
the procedure I used for real, I started with an old system which was on my
Raspberry 3 and 3+ workstations over the past few years. I found an
Ubuntu-MATE image for 16.02.2 and installed it on a microSD card, installed
in a Pi 3 and configured it to resemble my original system.

I had updated my system to 18.04 on line which necessitates expanding the
/boot partition. To do this, mount the microSD card on your workstation and
use 'gparted' to adjust partitions in the following order:
- adjust the start of mmcblk0p2 upward by approx 130-170 MB
- adjust the end of mmcblk0p1 upward to fill the freed space
Now re-insert the microSD card back in the Pi3 and execute:
sudo do-release-upgrade
and follow the prompts to upgrade to bionic beaver (18.04). When finished,
reboot the system and insure that everything is as you configured. If Ok,
you are now ready to prepare the micro-SD card for booting on a Pi 4.

  1. Install and update Raspbian on your Pi 4 per Raspberry Pi instructions.
    After all files are updated, insert the microSD card in a computer (I used a
    Ubuntu-MATE AMD64 installation with a SD-to-microSD adapter so that the
    system is mounted on /media//boot and /media//rootfs). In your
    local workspace create three directories; 'Boot', 'libModules' and
    'libFirmware' and copy files from the microSD card to these directories as:

    sudo cp -rp /media/<user>/boot/* Boot/
    sudo cp -rp /media/<user>/rootfs/lib/modules/* libModules/
    sudo cp -rp /media/<user>/rootfs/lib/firmware/* libFirmware/
    
  2. Umount and remove the Raspbian installation. Insert the microSD card
    with Ubuntu-MATE 18.04 into your workstation and you should see the two
    partitions mounted as; /media//PI_BOOT and /media//PI_ROOT.

  3. Since the directory structure of this upgraded image is similar to that
    of Raspbian, we can simply replace parts of this image with the locally
    saved Raspbian contents. Start by cleaning out some files not needed
    in the final product:

    sudo rm -rf /media/<user>/PI_BOOT/*
    sudo rm -rf /media/<user>/PI_ROOT/lib/firmware/*
    

    and install our saved data from the Raspbian installation as:

    sudo cp -rp Boot/* /media/<user>/PI_BOOT/
    sudo cp -rp libFirmware/* /media/<user>/PI_ROOT/lib/firmware/
    sudo cp -rp libModules/* /media/<user>/PI_ROOT/lib/modules/
    
  4. Now we need to tell the new image where to find files, so we need the
    identification of the new image partitions. I ran:
    ls -lF /dev/disk/by-partuuid
    which resulted in the following for the microSD card partitions:

    lrwxrwxrwx 1 root root 15 Aug  9 13:27 a91cf5fc-01 -> ../../mmcblk0p1
    lrwxrwxrwx 1 root root 15 Aug  9 13:27 a91cf5fc-02 -> ../../mmcblk0p2
    
  5. Using your favorite editor (after the 'jstar' variant of 'joe', I use
    vim.tiny), edit /media/<user>/PI_BOOT/cmdline.txt and replace the
    PARTUUID value in the line with the value you just read above which ends
    with '-02'. This tells the Raspbian boot sequence where to find the Root
    partition. We will keep the /dev/mmcblk0p1 and p2 references in the
    /etc/fstab image for now, so there is no need to edit that file.

  6. We also need to disable the accelerated graphics on the Pi4 since the
    version of Mesa in Ubuntu 18.04 is too old. Do this by editing
    /media/<user>/PI_BOOT/config.txt and commenting out (by placing a '#'
    in front of) the line near the end: 'dtoverlay=vc4-fkms-v3d'. If you do not
    /do this, you will be restricted to command-line only. (NOTE: this makes it
    the same as the line in the [all] section)

Now you are ready for the big smoke test. Insert the microSD card in your
Pi4 and turn it on! You should first see the 4 Raspberries, then the
Raspbian boot scripts and then the Ubuntu-MATE splash screen and progress
bar. Then that is done you should be presented with the login screen. You
will need to reconfigure wifi (if used) since the hardware differs from that
configured on the Pi 3, but you should now have Raspbian 18.04.3 up and
running on a Pi 4.

Hal

3 Likes

Thanks Hal for posting detailed step by step guide ... I avoid for now buying a Raspberry Pi 4, knowing no Ubuntu Mate ready image, but with your guide I might order soon.

My interest for future will be a 64bit version, so I can use ZFS storage safe on it, par example for a small in car/caravan server where I connect my mobile storage, avoid hooking it directly to laptop for safe and mobility reason.

I'd just like to say "thanks" for this excellent and comprehensive guide. Following it I now have Mate running on my Pi4 and it's amazing.

There's one thing I had to change from the guide, and it's this:

  1. Using your favorite editor (after the 'jstar' variant of 'joe', I use
    vim.tiny), edit /media/<user>/system-boot/cmdline.txt

That was /media/<user>/PI_BOOT/cmdline.txt for me.

Thanks again for the very helpful guide.

1 Like

Good catch, and thanks. I've editted to correct this. Glad you could follow my notes and get your system up.