ZhangZhihui's Blog  

 

  • To find if any broken packages are there:

     sudo dpkg -l | grep "^iU"
    
  • To remove broken packages any of two commands will help:

     sudo apt-get -f install
     sudo apt-get remove --purge $(dpkg -l | grep "^iU" | awk '{print $2}')
    
  • To find the residual packages following command will help:

     sudo dpkg -l | grep "^rc"
    

Note: if any package is installed without any error, the first column starts with ii but for residual package it starts with rc, and for broken it starts with iU. For more information about package state letters, see this answer.

  • To remove all residual packages:

     sudo apt-get remove --purge $(dpkg -l | awk '/^rc/{print $2}')
posted on 2024-09-27 14:54  ZhangZhihuiAAA  阅读(5)  评论(0编辑  收藏  举报