How do I force apt-get to update the state of package versions?
Solution 1
Found an answer on a separate question:
dpkg does a regular backup of the complete package status of the system to /var/backups/dpkg.status.*.gz. If you think your package status if out of sync with the actual packages installed, you can replace the status file at /var/lib/dpkg/status
with the status file contained in the backup. Run the following commands with sudo
:
cp /var/lib/dpkg/status /var/lib/dpkg/status.bak
cp /var/backups/dpkg.status.*.gz /var/lib/dpkg/
gunzip -d /var/lib/dpkg/dpkg.status.*.gz
mv /var/lib/dpkg/dpkg.status.* /var/lib/dpkg/status
You should now be able to do an apt-get update && apt-get upgrade
to update to the most recent packages.
Solution 2
Copy and paste sudo dpkg --configure -a
into the Terminal.
Then paste sudo apt-get update && sudo apt-get upgrade -y
You can also try:
sudo apt-get install -f
to fix broken dependencies.
Related videos on Youtube
Charlie Halford
Updated on September 18, 2022Comments
-
Charlie Halford over 1 year
Is it possible to cast an enumerated-key dictionary to an integer-key dictionary? (Or a copy constructor would work fine for what I'm doing as well.) In other words, something that looks like:
Dictionary<int, string> NewDictionary = (Dictionary<int, string>)OldDictionary<MyEnum, string>;
(Yes, I know that syntax isn't quite correct, it's just to show what it is I'm coming from.)
-
Admin over 13 yearsYes, I am. Thanks for the various methods!
-
Johannes Rudolph over 13 years@Kikaimaru: Sure? I didn't actually check, just assumed it would be possibe. On the other hand, it would make sense not to allow this as it changes the semantics of the type significantly, for example you could get key collisions etc from casting and the hashing is differently, making the cast a ridiciously expensive operation.
-
Kikaimaru over 13 yearswell this would work if you could do that: ((Dictionary<object, string>)oldDictionary<string, string>).Add(7, "...");
-
Benoit Duffez over 8 yearsYou should explain what these commands do.