Raspberry PI 4 Boot from USB HDD not working GPT

This is more of a note for me than a guide or help for anyone else.

At present the PI4 does NOT support boot from USB, but you can work around this like the old days by using an SD card for the /boot and setting this to load the root from USB Stick/HDD.

However, this only appears to work for me using MBR partition type and just hangs when using GPT. This may be because I’m also encrypting the disk and using headless network boot. But that side does work and the disk/paritions are decrypt and list in /dev/disk/by-label but the OS just will NOT boot for me. Copying everything to the exact same partition layout and labels under MBR and it just works.

It seems a weird problem, as the SD card that’s actually booting and has the kernel is MBR and I don’t see why it would then care, the kernel has to be aware of GPT and as I said lists everything correctly. I can even decrypt and mount during the dropbear network boot bit, but the OS just wont boot. Workaround at present is to place the OS on it’s own drive/stick and use GPT on bigger disks purely for data. I’ve only found this while trying to use a 5Tb disk for both OS and Data. the 2Tb disk I can use MBR on without loosing space so the workaround isn’t really needed, just use MBR.

Raspberry PI 4 Blink Power LED (Locate in Cluster)

I bought a small cluster rack for my Raspberry PI 4’s. I have 4 of them racked and the idea was to keep it simple, assign static IP addresses .80,.81,.82,.83 with {NAME}-00, {NAME}-01 etc, starting at the bottom. Makes complete sense! however before I bought the rack they were all laid out flat and I thought in order left to right. When it came time to rack them I carefully screwed them all in place and powered up. All good. That is until I needed to work on No.3, shut it down and found it 2nd up in the rack 🙁 No.1 was next and No.2 on top. I don’t think I could have made the order worse if I was trying to lol.

Anyway, I finally got a bit of time to sort out the order. I’d already powered down No.2 and I know 100% No.0 is on the bottom. but that still left 50/50 that I’d be moving the correct PI (having to take the entire rack apart). So I thought I must be able to blink the ACT LED. Well a quick test and yes you can but disk access overrides it, so it’s not exactly great. but then I found contrary to what one of the guides say that the PWR LED can be controlled, it’s not just hard wired to 3v (this may be true on earlier PI’s, no idea and I don’t need to test it atm).

So a nice quick script:

nano locate_pi.sh
#!/bin/bash

# Setup the keyboard interrupt.
trap '{ echo "Stop Blinking. Setting LED to ON." ; echo 1 > /sys/class/leds/led1/brightness ; exit 0 ; }' INT

# Blink the Power LED
echo "Blinking Power LED..."
i=0
while true ; do
echo $i > /sys/class/leds/led1/brightness
sleep 1
i=$(((i==0?1:0)))
done

Make it executable:

chmod +x locate_pi.sh

Then you can run it:

./locate_pi.sh

And hey presto a nice flashing LED on the PI in a rack. Now you could be really fancy and assign a few different patterns of flashes by doing a bit of coding in the ‘while’ or simply adjusting the sleep time if your lazy. That could allow you to find more than 1 pi if you set them to blink differently but for my use a simple blink is plenty (for now).

As always, hope this helps someone. you could even move the locate_pi.sh to /bin or /usr/bin to allow you to just run it from wherever you are.

NB: I’m assuming writing to /sys/class/leds/led1/brightness can only be done by root (unless you change the permissions), as such this script will need to be run as root to work but I haven’t test as another user to know if this is true.