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

3 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

4 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.

I am missing something very fundamental. When I mount the mate sd card it only mounts these 2 partions:

sdd 8:48 1 59.5G 0 disk
├─sdd1 8:49 1 199M 0 part /media/nwayno/system-boot
└─sdd2 8:50 1 59.3G 0 part /media/nwayno/writable

There is no PI_BOOT or PI_ROOT

The ubuntu-mate is bootable and works on my PI 3. What am I doing wrong?

Also note:

[email protected]:~$ ls -lF /dev/disk/by-partuuid
total 0

lrwxrwxrwx 1 root root 10 Aug 29 21:21 2d4cd32d-01 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Aug 29 21:21 2d4cd32d-02 -> ../../sdd2

[email protected]:/media/nwayno/PI_BOOT$ cat cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[email protected]:/media/nwayno/PI_BOOT$

No partuuid in this file.

You are doing nothing wrong.. system-boot is the PI_BOOT and writable is the PI_ROOT Partition.

Use root=PARTUUID=2d4cd32d-02 as your root Parameter.

In your first message, you seem to be confusing the two different methods I described. The partition names 'system-boot' and 'writable' refer to the first procedure which updated from the Ubuntu-MATE 18.04 beta image, while 'PI_BOOT' and 'PI_ROOT' refer to the second method which is to update from Ubuntu-MATE 16.04 online, and then modify the image.

Yes I did confuse the methods. Thank you.

I got a kernel panic -- unable to mount root. Sighh. Suggestions? But that is farther then I got yesterday. This is what I have:

[email protected]:/media/nwayno/PI_BOOT$ ls -lF /dev/disk/by-partuuid
total 0
lrwxrwxrwx 1 root root 10 Aug 30 09:22 2d4cd32d-01 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Aug 30 09:22 2d4cd32d-02 -> ../../sdd2
[email protected]:/media/nwayno/PI_BOOT$ cat cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=2d4cd32d-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[email protected]:/media/nwayno/PI_BOOT$

Do things the simple way by not using partuuid, but the device. Change the root declaration in cmdline.txt to "root=/dev/mmcblk0p2".

this is what I did:

[email protected]:/media/nwayno/PI_BOOT$ cat cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[email protected]:/media/nwayno/PI_BOOT$

It still kernel panics, can't mount root. :frowning:

kernel panic - nosyncing: vfs: unable to mount root fs on unknown-block(179,7)

Let me ask a dumb question here. I am using a 64G chip. Maybe....that's an issue? I am going to try this with a 32G chip. Couldn't hurt.

Nope same error. Done for today.

Check your procedures again. It sounds as though your boot partition doesn't match the contents of /lib/modules and/or /lib/firmware. Make sure that all of the files in /boot (PI_BOOT), /lib/modules (PI_ROOT/lib/modules) and /lib/firmware (PI_ROOT/lib/firmware) come from the same release of Raspbian Buster (/boot, /rootfs/lib/modules, and /rootfs/lib/firmware respectively). If there is any mismatch, then it will most certainly not work.

I tried this again -- very meticulously following the directions. I still get a kernel panic. The directions seem confusing at step 3. We remove PI_BOOT and PI_ROOT/firmware. but you copy libModules from the raspbian sd-card to the mate sd-card. Was there a reason why you didn't delete that first, and copy afresh?

Thanks for all your help. Seems a much more daunting task than first imaged.

I will post the steps I did (with screenshots) at a later date.

I think the following approach is simpler as it does not require installing raspbian:


I tried it and it works with Ubuntu Server, but I never tried it with Ubuntu Mate.
In any case, it is fairly easy to install Mate on Server.

Alex

1 Like

Ah this looks like the info i need. My pi4 being delivered today so will try this over the weekend.

Thanks in advance

Have anyone tried ZFS drives on an RPI 4, 4gb?
My intention is to buy those if I can use them as my file server for my mobile zfs drives. Par example in my caravan when I am on camping to access drives through wireless and keep drives secured inside. Second option same thing in my car.
How about also video recording /processing from some webcam in my car / caravan?
In the end I might buy one for test but also thinking as spend money instead on some intel nucs, or even use some old netbooks as work well on zfs, but not so good on video survaillance

I have not tried ZFS, but do use JFS on most of my systems including a 900 GB partition on my Pi 4 Server. I serve music over my wired/wireless LAN in FLAC as well as MP4 videos with no problems. I find JFS to be very robust and fast on Pi's as well as my Athlon and Ryzen systems.

Thanks @Hal58 for reply. Nice audio "project" you have, I have also think about it in the past, but ...
Unfortunately I use ZFS from quite a long time, from the time OpenSolaris was my favorite OS. On that OS ZFS works on 32bit system, but on Linux it locks, so it run OK only on 64bit system (even I know that with some tweaks it might works also on 32 bit system).
All my data drives are ZFS and encrypted with Luks, and I don't want to change that, only one small documents drive that I use in a palm size server with Raspbery pi 0 is ext4 and luks encrypted.

Of course I continue to investigate this on internet as I am quite happy with those three Raspberry pi that I have 0w/2/3... so I arrive here ...

It looks this guy put some effort this autumn in the pi4, so it might be another variant to your very nice guide how to create a pi4 image, that I already saved on my PC for future use.... so thank you again for it.