How Do You Fix Broken Packages on Debian Linux to Be Able to Use The apt Command as Normal?

Problem scenario
This command is not working for you:  sudo apt --fix-broken install

You get a message like this:

dpkg: error processing archive /var/cache/apt/archives/puppet_4.8.2-5_all.deb (--unpack):
 trying to overwrite '/lib/systemd/system/puppet.service', which is also in package puppet-agent 5.4.0.522.g6baf971-1xenial
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/puppet_4.8.2-5_all.deb

You try this command:
sudo apt-get purge -s puppet*

You cannot remove a package.  You get a series of errors.  The errors seem to be circularly related and interdependent. What should you do?

Solution
Run these commands:

sudo apt-get update --fix-missing

sudo apt-get -y remove puppet-agent puppet-master puppet
  # try to remove the package and related packages.  Replace "puppet-agent puppet-master puppet" with the packages you want to be removed.

sudo apt --fix-broken install

sudo apt autoremove

sudo apt clean

sudo rm -rf /tmp/*

Leave a comment

Your email address will not be published. Required fields are marked *