working with ubuntu for iot on a raspberry pi 4

Raspberry Pi 4 2GB memory sitting on a 4GB memory Pi.

I spent some time this Thanksgiving holiday taking Ubuntu for IoT for a quick spin on a Raspberry Pi 4 with 2GB of memory. I have three Raspberry Pi 4s, one each of 1GB, 2GB and 4GB memory capacity. The 4GB is the primary “development” system with the latest version of Raspbian Buster installed. I had the 2GB version mounted inside a Flirc case sitting on the shelf, unpowered and without an OS. I decided to experiment with that one, as I hadn’t used it since the very early days of the Raspberry Pi 4 hardware release and initial release of Raspbian Buster. Once the 4GB Raspberry Pi 4 arrived, I transferred all my work to it and ignored the other two. The 1GB board is back in its anti-static bag and in its original box. I need to pull it out and put it back to work as well. But I digress…

Setup

  • Raspberry Pi 4 with 2GB of memory
  • Firmware version – 000137ab
  • SanDisk Ultra Plus 64GB µSD card, V10, XC I, C10, A1
  • Monitor – Samsung S22C300H 1920 x 1080, 21.5 inch monitor
  • Keyboard – Logitech MK710 wireless
  • Mouse – Logitech MX Ergo trackball

Normally I use an LG 34UM61-p 2560 x 1080 monitor with my RPi 4 because Raspbian Buster is capable of driving it. But Ubuntu IoT won’t, neither in text nor graphics (desktop) mode. While the Logitech MK710 comes with its own mouse, I use the Ergo because it’s easier for me. I’ve begun to develop arthritis in my right wrist, and it’s easier for me to keep my hand still and at a 30% tilt from horizontal, and just move the track ball with my thumb.

Installing 64-bit Ubuntu Server IoT

The reason for installing 64-bit Ubuntu Server IoT on the 2GB memory RPi 4 board is that it currently will not work on the 4GB memory board.

I followed the directions on the Ubuntu site (https://ubuntu.com/download/raspberry-pi), flashing the 64-bit Ubuntu Server image to the µSD card using balenaEtcher (https://www.balena.io/etcher) on my Mac. If you don’t use balenaEtcher (on Linux, macOS, or Windows) then you’re only making it harder on yourself. balenaEtcher is incredibly simple to use and nearly foolproof.

Bootup was bit peculiar compared to Raspbian command line. It took awhile for the Ubuntu image to completely boot. When it finally presented a login prompt and I logged in, it had converted all the empty space on the µSD card into a Linux volume. The total amount of disk space that Server took for itself on that volume was less than 2GB, which isn’t bad at all.

Logging in the first time was annoying. The login prompt would appear, then get wiped as late starting services would announce themselves as via text to the console. I learned to wait until startup was truly finished before attempting to log in.

I had the Pi connected to my network via a wired cable. The server image doesn’t have everything necessary to turn on WiFi on the board. I had to install network tools in order to make wireless work, and I had to create by hand an initial wpa_supplicant.conf configuration file with my wireless networks SSID and password. At the next reboot the WiFi network came up and Ubuntu IoT was running in 64 bit mode with WiFi. After that it was ‘apt update’ and more waiting. Bringing up WiFi is very simple, and very easy, with Raspbian. It can be done either with a text tool or on the desktop. Ubuntu Server IoT could take a page from the Raspbian setup manual on how it should be done.

Now I know that security is a Big Deal with the Ubuntu IoT crew. I really get that. But forcing me to change my password into something long and complex is a royal pain in my behind. I hate that crap. Trust me: if and when I decide to deploy based on this (which at this time I won’t, but keep reading) then I’ll harden login. I didn’t fall off the turnip truck to get here. And I certainly don’t need such a sledgehammer reminder as the one in Ubuntu Server IoT right off the bat.

Installing a Desktop

After installing Server I followed the direction’s advice and installed Lubuntu Desktop. That took some time as a large number of packages had to be installed, and many others updated. When it finished and the RPi 4 rebooted, it showed a graphical login screen. I logged in and beheld a typical Linux graphical desktop.

It was, for the most part, rather uneventful, which is a Good Thing. I noticed that the applications installed were rather sparse, which is another Good Thing. There were no ancient games, for example. What I did find unusual is that LibreOffice was installed. I don’t need an office suite installed on a RPi development board. That’s why I never install the full Raspbian desktop plus applications, only the basic Raspbian desktop.

I also discovered that gcc isn’t installed either. I understand not having it with the Server image, but the desktop image should have the development tools as part of the overall package. Python 3 was there as was Vim, so I could have taken off with that if I’d wanted to. And yes, I can certainly apt install all the development tools. But still…

I did like the look of Lubuntu, but not necessarily it’s operation. The desktop software operated in a halting, janky sort of fashion. I’d move the mouse across the desktop and watch it stutter a bit. It wasn’t all the time, and it didn’t get in the way of getting work done. But compared to Raspbian, it didn’t feel quite as polished while using it.

I spent a half hour poking about, looking at things, and appreciating it was actually running in 64-bit mode. That’s my biggest complaint about Raspbian, that it’s still 32-bit. Once set up I shut it down and attempted to bring it back up with the LG monitor. While Ubuntu Server came up, the monitor stayed dark. I could ping it and ssh into it, but the graphical desktop was non-functional. In the end I pulled out the µSD card, put it away, and brought the 2GB RPi 4 in up-to-date Raspbian.

Thoughts

I’m not sure what to say. It feels rough, especially the desktop. My advice there is to pick just one desktop, and then to tailor it more towards development, including such applications as gcc and supporting development tools.  Or if you don’t want to bloat the desktop meta package then create a Languages Development meta-package that has everything needed, while trimming back the desktop package.

Ubuntu Server IoT has a lot of promise and I will tinker with it some more in the near future, but for now, based on my very limited experience, if you’re starting out with the Raspberry Pi, then chose Raspbian. There are three Raspbian images; one minimal command line, one basic desktop, and a desktop with all sorts of additional goodies. I personally use the first two. But I can’t ignore the fact that Ubuntu Server has a 64-bit foundation. They’re all good and solid and will get you up and running with a minimum of fuss.

One other positive aspect about Ubuntu Server plus desktop. It’s disk footprint is noticeably smaller than Raspbian, even with the desktop meta package installed. I certainly appreciated that. It’s memory footprint also is rather small as well. Again, another aspect to appreciate.

I’m not giving up on Ubuntu Server IoT. I just need to think of the best way to use it in the future.

discovering kivy on raspbian buster and the rpi4B

3D render of Blender monkey using Kiva

Because of a chance comment on an earlier post (an absolute failure – unable to build qt5 on a raspberry pi 4, https://arcanesciencelab.wordpress.com/2019/09/02/an-absolute-failure-unable-to-build-qt5-on-a-raspberry-pi-4/) by developer outsourcedguru (https://outsourcedguru.wordpress.com/) I have “fallen” for yet something else to get involved with: Kivy (https://kivy.org/). To be honest I’d never heard about it before now. It uses Python like PyQt5 does, to provide the programmatic bones on which to build very interesting applications using other tooling for desktop application rendering, which is 3D in this case.

I went looking and found directions for getting everything installed for Kivy. I then found a GitHub repo with this example in it (https://github.com/kivy/kivy/tree/master/examples/3Drendering). I downloaded everything and got it going as-is. It is now my new favorite thing to just run on my desktop. I’ve been monitoring both CPU usage as well as memory usage, and with this simple example it has basically no impact at all. Startup is near instantaneous. CPU temperature crept up a few degrees C, if that. With Chromium open with fourteen or so tabs and my other tools open as well, it should be doing some kind of work.

Something else for me to explore. I’m going to pull this onto my Macs as well.