My current hobby is 3D printing. I've spent quite a bit of time and money upgrading my printer and getting it working well. My latest foray was to convert it to use Klipper via running Mainsail on one of my raspberry pi computers. I discovered that the Moonraker API can control smart plugs, so you can do things like remotely power on your printer and other devices. I bought two cheap wifi smart plugs from Amazon that turned out to be Tuya/Smart Life based - which Moonraker doesn't support. Boo.
Moonraker does provide a generic http plugin interface for controlling smart devices, so Moonraker Tuya Generic HTTP Server was born!
Ultimately this is related to setting up MainsailOS for use with my modified 3D printer (Creality CR6-SE).1
I had a Pi4B 8Gb running Home Assistant OS on an m1 sata SSD in a USB enclosure, which I had no issues with whatsoever, however all my intentions for Home Assistant haven't materialized, so I figured I'd get more use out of it if I switched to running Klipper on it. Ultimately I decided on using Mainsail via their MainSailOS raspberry pi image.
Considering that the Home Assistant OS installation on the SSD was easy enough via Raspberry Pi Imager when I decided to convert from using an SD Card to using an SSD, and since Mainsail OS is available via RPI Imager, I figured it would be easy to just write the image to the SSD and off I go.
It was not to be. 2
After allowing some time for the system to boot and resize the partition, I was still unable to ping the device's IP (set via static DHCP). I connected a screen and keyboard to the pi and restarted it (as it was headless it had not initialized the display). The system started booting, then complained about disk corruption. It also threw a kernel panic. Some boots it would attempt to do the partition resizing but then complain of missing partitions. But it usually ended up with a kernel panic.
I connected the SSD to my desktop, cleared the partitions, created a windows partition then ran a surface scan on it to rule out any issues with the device. It passed with zero issues. I cleared the partitions again and re-wrote the image. The pi booted and had the same issue. I tried the 32bit version of the image with the same result. I then tried the raspberry pi OS lite image. Same issues again.
I wrote the Mainsail OS image to an SD Card, and successfully booted off that. I thought that if it was having an issue booting off the SSD for whatever reason, I could allow the SD Card to boot, the manually copy the data across to the SSD and then try booting it again. After successfully booting off the SD Card, I shutdown the system, put the SD Card in to a USB reader, and connected it and the SSD to another linux box. I successfully copied the data to the SSD, adjusted the UUIDs and tried to boot the pi with the SSD. I got a lot further this time, but still had issues.
I tried re-copying the SD Card to the SSD using rpi-clone however it failed very soon in to the operation saying that the device had disappeared. Syslog message indicated tha the XHCI USB device had disconnected.
After some googling, I determined that the current pi kernel has an issue with certain USB devices and the uas (USB Attached SCSI Mass Storage) driver. It seems it hates the JMicron controller that the USB enclosure uses.
The fix was to add a line to
/boot/cmdline.txt. I just had to get the vendorID and productID of the device, which is available via the
This article was very helpful.
usb-storage.quirks=152d:0578:u to the beginning of
/boot/cmdline.txt, separating it from the subsequent commands with a space. I rebooted the pi with the new setting.
I cleared the partitions on the SSD and used rpi-clone again, and this time it completed successfully.
I shut down the pi, removed the SD Card, and booted with just the SSD connected. SUCCESS! The pi booted quickly this time, with no further errors.
Troubleshooting this issue took much longer than it should have, but that's just the way of it.
I now have a working Mainsail installation. Now to configure it to work with my slightly customised Creality CR6-SE.
I've left out some of the additional troubleshooting and testing that I did. ↩
I don't know why seemingly simple things that should take 5 minutes always end up sucking the life out of you. For example, I needed to replace one of my 8tb disks in my NAS as it was constantly having errors. So I took the system down to replace the drive, and of course I removed the wrong drive cage initially - I have now marked the drives for future reference - but eventually found the drive, and swapped it out. I put everything back and powered up the system only to discover the entire pool is gone. Having replaced drives in the pools before, this is not normal. I realized that the system wasn't seeing two of the 5 drives in the pool, so I had obviously managed to disconnect them, and sure enough when I powered down the machine to check, I had accidentally unplugged two of the drives. >.< I then connected everything properly and powered on the system and the pool was still missing. I reimported the pool, ran the drive swap command and all was good. What should have taken 5 minutes took me about 30. I digress. ↩