Package managers in Linux allow you to control the installation and removal of packages. Furthermore, package managers assist you in locating and reinstalling broken packages on your system to resolve various issues related to Linux packages.
Your system’s package manager is in charge of the entire installation procedure when you install a new package under Linux. Exceptions and errors are handled by built-in methods in these package managers. However, if there are any unexpected issues, the installation will halt and the entire package will not be installed.
To fix broken packages you can use apt
Open your terminal and run these commands
sudo apt --fix-missing update
sudo apt update
sudo apt install -f
If the aforementioned steps do not work for you, then you can try to solve the issue using dpkg.
sudo dpkg --configure -a
sudo dpkg -l | grep ^..r
sudo dpkg --remove --force-remove-reinstreq
sudo apt clean
sudo apt update
Reference
http://www.iasptk.com/ubuntu-fix-broken-package-best-solution/
https://www.xmodulo.com/how-to-fix-apt-get-update-error-on-ubuntu.html#:~:text=This%20error%20can%20happen%20when,%22%20apt%2Dget%20update%20%22.