Score:0

What can I do with the information I get from dpkg -C?

nc flag

I'm trying to fix a Ubuntu 20.04 installation where I have a number of packages that need to be reinstalled. I found this out (as one would) by doing dpkg --audit (or dpkg -C), which returned a list of packages that have to be reinstalled.

This returned a pretty long list of packages for some reason. One of the actions I can take is to do apt install --reinstall [package-name] but there are at least a couple hundred packages, so that would be tiresome and boring.

Is there a way to automate this process? Ideally I'm thinking about a way for dpkg -C to produce an array of package names that could be fed to apt, but I don't know if this is possible.

Is there any way to use the audit result or would I have to come up with a mechanism myself?

cn flag
If you want to make a list you probably will need to order the packages so that will be daunting. Most of the packages listed will be dependencies so why not re-install the desktop (`sudp apt reinstall ubuntu-desktop` if that is your desktop)? That will pull also all of the required packages related to your desktop.
Score:1
pl flag

Here's a one-liner that will (almost) do what you want.

for p in $(dpkg --audit | tail +4 | awk -F " " "{print $1}"); do echo sudo apt install $p --reinstall -y ; done

I say "almost" because it will print a bunch of lines like this:

sudo apt install zstd --reinstall -y
sudo apt install zsync --reinstall -y

Which you can either sort then do in whatever order you want. Or you could just remove the word "echo" in the one-liner and let it just fly through.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.