The Problem
I made the mistake of trying to install Ubuntu on an SSD on an already working Raspberry Pi 4. The device as Raspian on it and was working normally for over six months. However, I was playing with docker and wanted some features not available in Raspbian. Rather than flash an SD Card I thought that I would use a Samsung 840 Pro 500GB SSD that I had lying around.
I followed the instructions from Ubuntu I tried to install Ubuntu Server 21 64Bit. The SSD was written correctly but when I booted the Pi 4 the boot took ages and I got many messages of the type
EXT4-fs error (device nvme0n1p7): ext4_find_entry:1463: inode #525023
on the console. I tried Ubuntu 20 instead, this would not boot. I tried workstation 21 and it showed the same issues as server. So I reverted to Ubuntu 21 server.
Investigation
I searched for P i4 Ubuntu SSD issues and found this article. So at least I was not alone in my problems.
After more searching I found an article that suggested adding
pcie_aspm=force
or
nvme_core.default_ps_max_latency_us=5500
To the grub configuration.
Great…apart from it seems that Ubuntu on a Pi 4 doesn’t seem to use grub (perhaps I am wrong) so I couldn’t update any grub boot configuration.
A bit of searching at turns out that on the Pi you can use “quirks” mode for the USB controller. All you need is the device ID….
Following this article I found out how to get this ID for my USB enclosure.
The Solution
I flashed the SSD with a clean install of Ubuntu Server 21 (on my Windows 10 desktop). The SSD has a boot device which is readble from WIndows. I edited cmdline.txt and added
usb-storage.quirks=152d:0578:u
to the end of the single line in that file
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc quiet splash usb-storage.quirks=152d:0578:u
The 152d:0578 is the ID of my USB controller.
Plug the SSD into the Pi 4 and, voila, it boots and works