37

I've got a package installed that is broken (the package itself, not its dependencies). Reinstalling it with sudo dpkg-reconfigure <package> or sudo apt-get --reinstall install <package> did not do the trick. I'd like to try and reinstall the package, including all its currently installed dependencies. Is there a way to do this?

Forage
  • 1,650

1 Answers1

50

You can check all package dependencies with apt-cache:

apt-cache depends <package>

Using the results of that command, we get the following one, which re-installs <package> and its dependencies:

package=<package>
apt-cache depends "$package" |
  grep '[ |]Depends: [^<]' |
  cut -d: -f2 |
  tr -d ' ' |
  xargs sudo apt-get --reinstall install -y
Ole Tange
  • 1,742