"Unmet Dependencies" problem when trying apt-get install

23,810

Solution 1

If, by any chance, you're using

sudo apt-get -f install python-package

try running

sudo apt-get -f install

(without any package name), and once this step is done with, try running the original command:

sudo apt-get install python-package

Solution 2

It's possible that the "No space left on device" error is related to the "unmet dependencies" problem. Either way, you have to fix both.

Check free space with any of these methods (such as df -h). If if you're low, free some up using these methods (removing old kernels; also applies when /boot is not a separate partition) and these methods (removing unused packages and cached package archives).

Especially if the "unmet dependencies" problem arose from software not being properly installed and configured after disk space ran out, you should be able to fix it simply:

sudo dpkg --configure -a
sudo apt-get update && sudo apt-get -f install

But if that doesn't work, don't fret--there are many other powerful (and easily applied) techniques for fixing "unmet dependencies":

Share:
23,810

Related videos on Youtube

GChorn
Author by

GChorn

Python, Django, HTML, CSS and JS novice.

Updated on September 18, 2022

Comments

  • GChorn
    GChorn over 1 year

    Anytime I try to install python packages using the command:

    sudo apt-get install python-package
    

    I get the following output:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet dependencies:
     linux-headers-generic : Depends: linux-headers-3.2.0-36-generic but it is not going to be installed
     linux-headers-generic-pae : Depends: linux-headers-3.2.0-36-generic-pae but it is not going to be installed
     linux-image-generic : Depends: linux-image-3.2.0-36-generic but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
    

    This seems to have started when these same three packages showed up in Ubuntu's Update Manager and kicked an error when I tried to install them there. Based on the suggestion in the output above, I tried running:

    sudo apt-get -f install
    

    But this only gave me several instances of the following error:

    dpkg: error processing /var/cache/apt/archives/linux-image-3.2.0-36-generic_3.2.0-36.57_i386.deb (--unpack):
     unable to create `/lib/modules/3.2.0-36-generic/kernel/drivers/net/wireless/ath/carl9170/carl9170.ko.dpkg-new' (while processing `./lib/modules/3.2.0-36-generic/kernel/drivers/net/wireless/ath/carl9170/carl9170.ko'): No space left on device
    

    Now maybe I'm way off-base here, but I'm wondering if the error could be coming from the "No space left on device" part? The thing is, I'm running Ubuntu as a VirtualBox VM but I've got it set to dynamically increase its virtual hard drive space as needed, so why am I still getting this error?

    Here's my output when I use dh -f:

    Filesystem        Size  Used Avail Use% Mounted on
    /dev/sda1         6.9G  5.7G  869M  88% /
    udev              494M  4.0K  494M   1% /dev
    tmpfs             201M  784K  200M   1% /run
    none              5.0M     0  5.0M   0% /run/lock
    none              501M   76K  501M   1% /run/shm
    VB_Shared_Folder  466G  271G  195G  59% /media/sf_VB_Shared_Folder
    

    When I perform sudo apt-get -f install and the system says,

    After this operation, 192 MB of additional disk space will be used.
    

    Does that mean 192 MB of my virtual machine's current memory, or 192 MB on top of the rest of my free space? As I said, my machine normally dynamically allocates additional memory from the host machine, so I don't see why there would be memory restrictions at all...

  • GChorn
    GChorn over 11 years
    Thank you for the answer. I've tried everything in your solution and on the page you linked me to, and I keep getting either E: Unmet dependencies. Try using -f. or E: Sub-process /usr/bin/dpkg returned an error code (1) or E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
  • Eliah Kagan
    Eliah Kagan over 11 years
    @GChorn So...what did you get from df -h?
  • GChorn
    GChorn over 11 years
    In /dev/sda1, I have 869MB of space left. That should be enough right?
  • Eliah Kagan
    Eliah Kagan over 11 years
    @GChorn That should be enough that low space on /dev/sda1 is not the cause of this problem, yes. There's other partitions though... can you edit your question to include the full output?
  • GChorn
    GChorn over 11 years
    Thanks for the answer. I tried this and got dpkg: error processing linux-headers-3.2.0-36_3.2.0-36.57_all.deb (--install): unable to create /usr/src/linux-headers-3.2.0-36/include/media/mt9p031.h.dpkg‌​-new' (while processing ./usr/src/linux-headers-3.2.0-36/include/media/mt9p031.h'): No space left on device which is basically the same error as when I tried apt-get -f install...