Skip to content

Instantly share code, notes, and snippets.

@anujonthemove
Created October 2, 2023 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anujonthemove/e4b029fadadee5f3730d8a62b26376bc to your computer and use it in GitHub Desktop.
Save anujonthemove/e4b029fadadee5f3730d8a62b26376bc to your computer and use it in GitHub Desktop.
An unresolvable problem occurred while calculating the upgrade.
# All thanks to a thread in this forum: https://askubuntu.com/questions/360293/could-not-calculate-the-upgrade-what-happened
#!/bin/bash
apt update
apt upgrade
cat /var/log/dist-upgrade/apt.log | egrep -o "^Broken\s[a-z:\.0-9-]*" | sed 's/Broken //' | sed 's/:amd64//' > packages.txt
sort -u packages.txt > packages_sorted.txt
while read line; do
apt remove -y $line
done < packages_sorted.txt
apt autoremove -y && sudo apt autoclean -y
echo "Done"
apt install -f
dpkg --configure -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment