Ubuntu 21.10 on Raspberry Pi 4B randomly freezes, sometimes unplugging peripherals helps

Solution 1:

I think I have resolved the issue. I have an SSD card that someone gave me and I bought a case for it and a USB3 connector cable. I realized that it was while the disk was plugged in that the mouse and keyboard froze. When I connected the disk to my laptop it caused a power surge on the usb3 port. As the SSD had been given to me it wasn't entirely clear how old it was, what size, and most importantly, how much power it would draw.

Having read a number of articles I have learned that unless the drive is consuming a very low amount of power then you either have to look at using a USB hub (which can be a bit hit or miss with RPI/Ubuntu) or some other means to get power to the drive. Basically, the more modern the technology and the faster the I/O for disk reads and writes the more power will be consumed which can quickly overwhelm the Pi.