stop an apt-get upgrade

I was trying to upgrade just a single package, so I typed sudo apt-get upgrade packagename. (Now I know I'm supposed to use apt-get install for that.) Now apt-get is upgrading everything in my whole system. I stopped it with shutdown -h now (hey, it worked) as C-c doesn't seem to work very well.

However apt-get has a memory and now I can't do anything with apt-get such as install without it attempting to continue with a full system upgrade. How do I get apt-get to just abort the upgrade?


When I follow the instructions in the accepted answer as suggested by Itai Ganot, this is what happens:

$ sudo apt-get autoclean
[sudo] password for dsw: 
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 
dsw@dsw-VirtualBox:~$ cd /var/cache/apt/archives/partial
dsw@dsw-VirtualBox:/var/cache/apt/archives/partial$ ls
dsw@dsw-VirtualBox:/var/cache/apt/archives/partial$ ls -a
.  ..

Following the instructions in the message:

sudo dpkg --configure -a

eventually stops. So the above method does seem to stop the apt-get update eventually.


Solution 1:

There are two things you can do in order to cancel the upgrade:

  1. Try running the following command:

    # sudo apt-get autoclean
    
  2. Emptying /var/cache/apt/archives/partial To do that, open a file manager using the gksudo command, such as:

    # gksudo nautilus /var/cache/apt/archives/partial 
    

Delete the files within "partial" but not the folder itself.