How to fix apt E: Unable to locate package rpi-imager

Problem:

While trying to installĀ rpi-imager using

sudo apt install rpi-imager

you see this error message:

Reading package lists... Done
Building dependency tree       
Reading state information... Done

No apt package "rpi-imager", but there is a snap with that name.
Try "snap install rpi-imager"

E: Unable to locate package rpi-imager

Solution

sudo apt -y install rpi-imager only works on Raspbian. On Ubuntu etc, you can installĀ rpi-imager using

sudo snap install rpi-imager

Then start it using

rpi-imager