Your system has messed up, I doubt that it is a fresh install as this problem should not be there on a fresh install, anyways, I would recommend reinstalling as the first choice but if you cannot then here is an answer which may help you to get out of these errors.
Note
- I am putting "*" after every solution that will most probably work.
Short answer *
Simple remove and reinstall packages:-
You can remove the packages by:-
$ sudo dpkg --remove --force-remove-reinstreq linux-firmware
$ sudo dpkg --remove --force-remove-reinstreq linux-image-raspi
$ sudo dpkg --remove --force-remove-reinstreq linux-raspi
$ sudo dpkg --remove --force-remove-reinstreq initramfs-tools
$ sudo dpkg --remove --force-remove-reinstreq linux-image-5.13.0-1011-raspi
$ sudo apt-get -f install
Then reinstall them
sudo apt-get install linux-firmware linux-image-raspi linux-raspi initramfs-tools linux-image-5.13.0-1011-raspi
Advanced solutions:-
Using force install. *
Generally, using apt -f install
works!
Run:
sudo apt -f install
If the error is fixed then congratulations but if not then proceed.
Going a little advance *
You may want to clear the cache files of apt
to fix this issue. Generally, it wouldn't harm your OS in any way.
You can run
sudo rm -rf /var/cache/apt/archives/*.deb
More likely, it will fix the error! If not then proceed.
Another solution.
You can try this also -
sudo -E apt-get install aptitude
sudo -E aptitude safe-upgrade
sudo -E aptitude dist-upgrade
After that
mkdir ~/debs
cd ~/debs
ls
sudo apt download linux-firmware linux-image-raspi linux-raspi initramfs-tools linux-image-5.13.0-1011-raspi
sudo dpkg -i --force-all ./*.deb
Removing and reinstalling the packages.
You can remove the packages by:-
$ sudo dpkg --remove --force-remove-reinstreq linux-firmware
$ sudo dpkg --remove --force-remove-reinstreq linux-image-raspi
$ sudo dpkg --remove --force-remove-reinstreq linux-raspi
$ sudo dpkg --remove --force-remove-reinstreq initramfs-tools
$ sudo dpkg --remove --force-remove-reinstreq linux-image-5.13.0-1011-raspi
$ sudo apt-get -f install
Then reinstall them
sudo apt-get install linux-firmware linux-image-raspi linux-raspi initramfs-tools linux-image-5.13.0-1011-raspi
Last option *
As a last option, you could try removing the post-installation files of the error packages. This won't solve the error, but your system will ignore the errors.
cd /var/lib/dpkg/info/
mkdir ~/backup
mv linux-firmware ~/backup
mv linux-image-raspi ~/backup
mv linux-raspi ~/backup
mv initramfs-tools ~/backup
mv linux-image-5.13.0-1011-raspi ~/backup
sudo apt -f install
Did it work?
If it didn't work then there is no luck. If these commands didn't work then your system is more messed up than it was before. As you said, it is a fresh install so just reinstall ubuntu.