19

In case there were some problems during the last apt-get operation, is there a command that checks if something has to be continued in apt-get?

4
  • 2
    If you get a dpkg lock error, see here.
    – Wilf
    Feb 24, 2014 at 11:23
  • apt-get doesen't suggest anything here, but aptitude does, but a very strange suggestion on my laptop: askubuntu.com/questions/425516/…
    – rubo77
    Feb 24, 2014 at 11:59
  • Depends where it was interrupted. Sometimes you interrupt dpkg sometimes you interrupt apt-get. apt-get itself can be interrupted any time since it's just an frontend for dpkg, dpkg otherwise is not for some operations.
    – Braiam
    Feb 24, 2014 at 16:04
  • If you're going down the rabbit hole through sudo dpkg --configure some-package and you encounter that SOME process is using SOME file sudo lsof /path/to/file can give you PIDs of the processes to kill PID
    – jave.web
    May 16, 2023 at 18:55

3 Answers 3

28

Use the command:

sudo apt-get -f install

If that doesn't work, you can direct dpkg to finish setting up any packages that were only partially set up:

sudo dpkg --configure -a

If it doesn't work than you can reconfigure all the packages with:

sudo dpkg-reconfigure -a
7
  • 4
    I think reconfiguring all packages is not such a good idea and takes hours of manual work
    – rubo77
    Feb 24, 2014 at 11:51
  • is it the same with sudo aptitude -f install?
    – rubo77
    Feb 24, 2014 at 11:52
  • @rubo77: no, it is not the same but something similar.
    – Frantique
    Feb 24, 2014 at 12:02
  • On my problem the -f doesent make any difference, woth or without, I get no errors with apt-get but with atṕtitude, see: askubuntu.com/questions/425516/…
    – rubo77
    Feb 24, 2014 at 12:04
  • 2
    Is it possible that you meant dpkg --configure -a? That's a subset of what apt-get -f … does if there are unconfigured packages. dpkg-reconfigure is an entirely different operation. May 26, 2018 at 16:22
8

In addition to the response by @Frantique, I would like to add:

sudo dpkg --configure -a

That solved my issue when the upgrade was interrupted during the process.

2

I had the same issue and in my case a Deb package was corrupted. I had to

  1. delete the cached packages from /var/cache/apt/archives with

    sudo apt-get clean
    
  2. before running

    sudo apt-get -f install
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .