Personal website and blog of developer Stef Pletinck
by Stef Pletinck
TL:DR scroll down to the code fence, run that, it’ll be fine.
Running Raspberry Pi Imager under Wayland on Linux can cause issues, because it needs root permissions. Sure, its implementation should probably be changed so we don’t have to run the entire app as root, but this is the world we live in.
When running it as root you will often get some seemingly arcane Qt errors, complaining about failing to initialize any Qt platform plugins. There is a fairly lengthy discussion about this issue on the relevant issue tracker, but none of the suggested fixes exactly worked for me. Even the solution proposed by another Arch and Wayland user didn’t work for me, as pkexec has never really worked under Sway for me.
Luckily, you can just substitute sudo.
The real important bit is passing on the WAYLAND_DISPLAY environment.
sudo env WAYLAND_DISPLAY=$WAYLAND_DISPLAY /usr/bin/rpi-imager