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?
Asked
Active
Viewed 7.8k times
35
Forage
- 1,530
1 Answers
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:
apt-cache depends <package> | grep '[ |]Depends: [^<]' | cut -d: -f2 | tr -d ' ' | xargs sudo apt-get --reinstall install -y
BeastOfCaerbannog
- 14,585
Sebastian Potasiak
- 758
- 8
- 12
'Depends'to'[ |]Depends: [^<]'to exclude PreDepends and alternative package (Depends:--reinstall installto do the actual reinstalling I was after. – Forage Mar 30 '13 at 15:05-y. It's kind of nice to get a chance to confirm what packages are to be reinstalled. – user1202136 Aug 24 '20 at 07:52xargs ..........by justcat– Maarten Fokkinga Nov 01 '20 at 20:33