Raspberry Pi 4 provisioning and KVM pod setup

A few weeks ago, I tried to do something similar to what you did. I had made a simple implementation of a power driver for maas which calls some kind of API on an esp32 (but it could be anything else). Then the esp32 can read the state of a pin or switch a relay. It seemed to work but it was just a test implementation.

As for the raspberry, if you use the uefi firmware you cannot install the operating system on the sd card but only on an external disk. I don’t know if it’s possible to avoid using uefi, I have my doubts.

This is amazing, I hope it works for me. If I can automate my K8s cluster then I’m going to send you some money:) or a coffee maybe:)

Awesome instructions! I ran into all the same problems (and some more) in my recent attempt in even July 2021!

Just want to share a few notes on worked for me in July 2021:

  1. We can now use hwe-20.04 (Kernel 5.8) instead of the groovy image trick. This way we can deploy KVM using the web UI as well.
  2. MaaS is not recognizing USB flash drives for UEFI firmware v1.16. So I’m using v1.28. PXE still doesn’t work, but we can use the HTTP v4 boot option (move this to the top of boot order rather than PXE v4). Apparently HTTP network boot also works with MaaS.
  3. Have to pick USB flash drive as boot drive (rather than the default SD card) in MaaS web UI to deploy to the correct drive. After KVM deployment, MaaS somehow wipes my micro SD, so I re-copied the UEFI v1.28 and re-setup UEFI with (>3GB memory, and change boot order). Then, it works!

My setup:

  • MaaS v3.0.0
  • RPi UEFI v1.28
  • Ubuntu HWE-20.04 (Kernel 5.8)
2 Likes

hi @someo_new (and anyone else interested in this) - I’m the PM for MAAS, and I’m glad that you managed to solve the MAAS side issues you had there.

I’m wondering if you would be interested to author an article about what you did (tutorial)? If you are, then we could link to it from our new resources page that we are building for MAAS.

I realise that it’s some work, but I’d love to have it out there for everyone and to make it more visible.

We also have a standard way to write tutorials for ubuntu.com if you wanted to host it there.

Let me know and I can loop in our RPI and Desktop product managers too :slight_smile:

1 Like

Hi

I am having a real hard time trying to get this whole thing going from the starting point.
Do you have a full set of instructions authored or published anywhere?

Thanks,
Jay

Hi anton5mith,

I would be willing to write up detailed instructions if I can get all this to work.
Unless of course someone has already done so.

Currently I am having problems putting all the pieces together.

What I do have is:

  1. prep of the pi for uefi - and that works

  2. maas3.1 installed and setup with DHCP

  3. trying to build maas with the needed extra pxe for RPI options mentioned in the source article:
    Provisioning of Raspberry Pi 4 with MAAS - Users - MAAS | Discourse

Thanks,
Jay

1 Like

thanks @lory696 and @someo_new these tips really helped.

I’m trying to put together a step by step guide here https://github.com/gilesknap/IaC-at-home/blob/main/nas/03-maas/RaspiMASS.md.

However my issue is that MAAS overwrites the SD card UEFI partitions and kills the next boot. It all works fine if the partitions are already set up and I check ’ retain storage configuration’

Does anyone know how to avoid this? (it seems to be different to what lory696 experienced when just using the flat pattern)

I have solved the issue reported above simply by removing the sdcard physical disk from storage configuration.

I believe I now have reliable, step by step set of instructions in draft form here https://github.com/gilesknap/IaC-at-home/blob/main/nas/03-maas/RaspiMASS.md.

It uses:
MAAS v3.0.0
Ubuntu 20.04 LTS with hwe kernel
UEFI v1.32

3 Likes

Hi there, super exciting. We are also discussing internally about making a tutorial for Rpi and including a way to do power drivers with usb hubs, so people can build e.g. a bare metal K8s cluster with rpis and MAAS.

I’m going to share your guide and maybe we will adopt some of it - we want a tutorial that is reproducable on maas.io/tutorials. If you are interested in collaboration, I’m sure we can find a way to merge it together :slight_smile:

Hi Anton, that sounds great. Most of he info for my guide comes from this thread so thanks to @lory696.

I’m doing this specifically to build a bare metal k8s cluster and will continue to add notes to the same repo.

2 Likes

great. what we might do is take some of the things you did in the UI and create some scripting to use the MAAS API or python sdk, so we can speed things up/make it easier to setup.

really great work that you, and the others, have done.

Hi there, just wondering if you released the webhook power driver API you created? I also wrote one although it was just a toy with no error checking etc. If yours is in a decent shape it would be useful to others I think.

Hi Anton, do you have any hubs in mind for the article? I’m having trouble finding any with remote control.

Hi, can you see the tutorials category here in discourse? tutorials are written there in markup (take a look at some of the existing ones there), and when ready, we can publish them on maas.io/tutorials.

I should have been more clear. I’m happy for you to use any of my work to write a tutorial, it sounds like you are aiming for a CLI based approach and that does make more sense. I was just asking if you already know of any remote control hubs so I can look into getting one.

(I’m also OK to reformat what I have into markup and put it up here if you feel that is useful)

Ah sorry, yes I misunderstood you. I have been looking at uhubctl which we were thinking we could wrap with a REST API and then use the webhook driver:
https://github.com/mvp/uhubctl

There they have a list of supported hubs, I have looked for a few of them on amazon etc but haven’t tried anything. For RPIs, I think the most important thing is to pay attention to the total power output + power output per port (2.4A needed I think?).

If you try something, let me know.

Unfortunately, I have already been to that site and been unable to get hold of any of the listed hubs. But I am in the UK so maybe that is not helping :slight_smile:

hmm I’m in Sweden, same problem. This one might work, haven’t read the manual yet to understand how the power control works:
https://www.uugear.com/product/7-port-usb-hub-for-raspberry-pi/

edit: read up on it, doesnt support per port.

this one might work: https://www.uugear.com/product/mega4-4-port-usb-3-ppps-hub-for-raspberry-pi-4b/

I found something available in europe ‘UUGear MEGA4’.

It does 2.5A per port, total of 5A over 4 ports == 1.25A / port. But I reckon the raspi only needs 6W == 1.2A to run flat out as long as its USB ports are not drawing current (see https://uni.hi.is/helmut/2021/06/07/power-consumption-of-raspberry-pi-4-versus-intel-j4105-system/)

I have ordered one and will let you know how I get on.

1 Like