Upgrade Issue unmet dependencies

Asked by amit k

Hi,
Upgrade process failed due to broken package. Below is the error I am getting while trying to upgrade:

The following packages have unmet dependencies:

linux-generic-pae: Depends: linux-image-generic-pae (= 3.2.0.45.54) but 3.2.0.48.58 is installed
                   Depends: linux-headers-generic-pae (= 3.2.0.45.54) but 3.2.0.45.54 is installed
linux-headers-generic-pae: Depends: linux-headers-3.2.0-45-generic-pae but it is not installed

Alternatively, I tried running sudo apt-get install -f. but it didn't work, same error.

Please advice on the resolution here.

Thanks
Amit

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu apport Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Warren Hill (warren-hill) said :
#1

Follow the instructions here:
https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure

Except at step 6 do not use the link given it will create a new question and we want the results here.

Use this one instead

https://answers.launchpad.net/ubuntu/+source/apport/+question/231219

We will be able to advise further one we have the results.

Revision history for this message
amit k (onlineamitk) said :
#2

Hello Warren,
I couldn't execute all the steps mentioned at the package manager troubleshooting link as I ran out of space on the partition drive during the backup step.

However, to provide you some of the information here, i am running ubuntu 12.04 LTS version. And during one of the updates, I ran into previous error:

linux-generic-pae: Depends: linux-image-generic-pae (= 3.2.0.45.54) but 3.2.0.48.58 is installed
                   Depends: linux-headers-generic-pae (= 3.2.0.45.54) but 3.2.0.45.54 is installed
linux-headers-generic-pae: Depends: linux-headers-3.2.0-45-generic-pae but it is not installed

Please let me know if there is an alternative way to resolve this issue or what specifically should I look for and will accordingly mention here.

Thanks
Amit

Revision history for this message
amit k (onlineamitk) said :
#3

Also, now facing a new error:

E:Could not open file /var/lib/dpkg/status - open (2: No such file or directory), E:The package lists or status file could not be parsed or opened.

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

The following commands should provide some basic information that is needed for helping further.

Please open a terminal and issue the following commands:

uname -a
lsb_release -a
dpkg -l linux | grep linux
df -h
df -i
ls -l /var/lib/dpkg

Then select all output, copy it and paste into this question document.

Revision history for this message
amit k (onlineamitk) said :
#5

Hello Manfred,
Below are the details, pleas let me know if anything additional. Also, would like to recover some space which was consumed during backup.

Thanks,
Amit

Linux AmitS 3.2.0-45-generic-pae #70-Ubuntu SMP Wed May 29 20:31:05 UTC 2013 i686 i686 i386 GNU/Linux

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise

dpkg-query: error: failed to open package info file `/var/lib/dpkg/status' for reading: No such file or directory

Directory Info:
Filesystem Size Used Avail Use% Mounted on
/dev/sda9 5.7G 4.9G 517M 91% /
udev 487M 4.0K 487M 1% /dev
tmpfs 199M 828K 198M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 497M 160K 496M 1% /run/shm
/dev/sda7 16G 5.3G 9.4G 37% /home
/home/amit/.Private 16G 5.3G 9.4G 37% /home/amit

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda9 375360 375358 2 100% /
udev 124446 512 123934 1% /dev
tmpfs 126999 441 126558 1% /run
none 126999 3 126996 1% /run/lock
none 126999 8 126991 1% /run/shm
/dev/sda7 1024000 9301 1014699 1% /home
/home/amit/.Private 1024000 9301 1014699 1% /home/amit

total 6500
drwxr-xr-x 2 root root 4096 Jun 7 11:58 alternatives
-rw-r--r-- 1 root root 1538682 Jun 23 08:34 available
-rw-r--r-- 1 root root 1538682 Jun 23 08:30 available-old
-rw-r--r-- 1 root root 8 Aug 17 2012 cmethopt
-rw-r--r-- 1 root root 1160 Mar 22 18:26 diversions
-rw-r--r-- 1 root root 1206 Mar 22 18:22 diversions-old
drwxr-xr-x 2 root root 319488 Jun 23 08:30 info
-rw-r----- 1 root root 0 Jun 23 16:18 lock
drwxr-xr-x 2 root root 4096 Apr 12 2012 parts
-rw-r--r-- 1 root root 135 Aug 17 2012 statoverride
-rw-r--r-- 1 root root 1607921 Jun 23 08:34 status-bad
-rw-r--r-- 1 root root 1607921 Jun 23 08:30 status-old
drwxr-xr-x 2 root root 4096 Jun 7 11:58 triggers
drwxr-xr-x 2 root root 4096 Jun 23 08:34 updates

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

ok, the issue with 'no space available' is rather clearly shown in the output above: you have run out of free inodes on /dev/sda9

There are two limits for files on an ext file system: space, and number of inodes (that is the number of files that can be stored). You have hit the "maximum number of files" limit, even if there still would be free space of 500MB.
I guess you have kernel header files for old kernels installed (thousands of small files), that can be deleted.

To get your package management system back to work open a terminal and issue the commands:

sudo mv /var/lib/dpkg/status-bad /var/lib/dpkg/status
dpkg -l linux | grep linux

then copy/paste all output as done before.

Revision history for this message
amit k (onlineamitk) said :
#7

It created the status-bad file in dpkg folder. However, below command doesn't work. Please let me know what I need to do next.

amit@AmitS:~$ dpkg -l linux | grep linux
No packages found matching linux.

When I run

amit@AmitS:~$ dpkg -l | grep linux

It generates something like below. Please let me know what I need to do next.

 Linux kernel image for version 3.2.0 on 32 bit x86 SMP
ii linux-image-3.2.0-43-generic-pae 3.2.0-43.68 Linux kernel image for version 3.2.0 on 32 bit x86 SMP
ii linux-image-3.2.0-45-generic-pae 3.2.0-45.70 Linux kernel image for version 3.2.0 on 32 bit x86 SMP
iU linux-image-3.2.0-48-generic-pae 3.2.0-48.74 Linux kernel image for version 3.2.0 on 32 bit x86 SMP
iU linux-image-generic-pae 3.2.0.48.58 Generic Linux kernel image
ii linux-libc-dev 3.2.0-45.70 Linux Kernel Headers for development
ii linux-sound-base 1.0.25+dfsg-0ubuntu1.1 base package for ALSA and OSS sound systems
ii pptp-linux 1.7.2-6 Point-to-Point Tunneling Protocol (PPTP) Client
ii syslinux 2:4.05+dfsg-2 collection of boot loaders
ii syslinux-common 2:4.05+dfsg-2 collection of boot loaders (common files)
ii syslinux-legacy 2:3.63+dfsg-2ubuntu5 Bootloader for Linux/i386 using MS-DOS floppies
ii util-linux 2.20.1-1ubuntu3 Miscellaneous system utilities

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

By renaming status-bad back to status the package management system should be operable again (most probably still with the broken dependency from that was the starting point of this question).

The solution to your problem must be to delete files on your root file system (in your case that is all directories except the /home directory tree).

Execute the folowing commands:
sudo apt-get clean
sudo apt-get autoremove
sudo dpkg --configure -a
sudo apt-get install -f
df -h
df -i

and copy/paste the output as done before. Hopefully this will delete enough files that you have room to maneuver‎.

Revision history for this message
amit k (onlineamitk) said :
#9

Thanks, some of it worked great. I did manage to remove the status-old and available-old files, they were the copies of original. Here are the results:

amit@AmitS:~$ sudo apt-get clean
amit@AmitS:~$ sudo apt-get autoremove
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-generic-pae : Depends: linux-image-generic-pae (= 3.2.0.45.54) but 3.2.0.48.58 is installed
 linux-headers-generic-pae : Depends: linux-headers-3.2.0-45-generic-pae but it is not installable
E: Unmet dependencies. Try using -f.

amit@AmitS:~$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of linux-headers-generic-pae:
 linux-headers-generic-pae depends on linux-headers-3.2.0-45-generic-pae; however:
  Package linux-headers-3.2.0-45-generic-pae is not installed.
dpkg: error processing linux-headers-generic-pae (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-pae:
 linux-generic-pae depends on linux-image-generic-pae (= 3.2.0.45.54); however:
  Version of linux-image-generic-pae on system is 3.2.0.48.58.
 linux-generic-pae depends on linux-headers-generic-pae (= 3.2.0.45.54); however:
  Package linux-headers-generic-pae is not configured yet.
dpkg: error processing linux-generic-pae (--configure):
 dependency problems - leaving unconfigured
Setting up linux-image-3.2.0-48-generic-pae (3.2.0-48.74) ...
dpkg: unrecoverable fatal error, aborting:
 unable to create `/var/lib/dpkg/updates/tmp.i': No space left on device

Didn't go further, inodes are all utilized
amit@AmitS:~$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda9 375360 375360 0 100% /
udev 124446 512 123934 1% /dev
tmpfs 126999 440 126559 1% /run
none 126999 3 126996 1% /run/lock
none 126999 8 126991 1% /run/shm
/dev/sda7 1024000 9260 1014740 1% /home
/home/amit/.Private 1024000 9260 1014740 1% /home/amit

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

Try uninstalling one of the older kernels:

dpkg --purge linux-image-3.2.0-43-generic-pae
df -i
sudo dpkg --configure -a

You could also browse through /tmp and look if there are any files that look as if they are leftovers from the past, and in case you find some remove them (sudo rm...)

Revision history for this message
amit k (onlineamitk) said :
#11

Hello Manfred - my system has stalled to the extent that I won't allow me to login to the machine. And trying to run it in recovery mode or trying to clean the existing space isn't working either. I am trying to see if somehow I can boot the OS in terminal mode or shell mode, so as I can run above commands. Let me know if you have any thoughts.

Thanks,
Amit

Revision history for this message
Manfred Hampl (m-hampl) said :
#12

It seems that the fact that your disk is full (inode-wise) prevents the system from adequately booting.

try booting into "recovery mode - root shell prompt" - if that is possible, and issue the following commands:

mount -o rw,remount /
rm -rf /var/lib/dpkg/updates/*
rm -rf /var/lib/apt/lists
rm /var/cache/apt/archives/*
rm /var/cache/apt/*.bin
mkdir /var/lib/apt/lists
mkdir /var/lib/apt/lists/partial
dpkg --purge linux-image-3.2.0-43-generic-pae
df -i

If that fails, you have to use a DVD/USB to boot into a live system in "try Ubuntu" mode, mount your root file system to the live system, and execute the commands equivalent to the commands above, something like
sudo mkdir -p /media/disk
sudo mount -o rw,remount /dev/sda9 /media/disk
sudo rm -rf /media/disk/var/lib/dpkg/updates/*
sudo rm -rf /media/disk/var/lib/apt/lists
sudo rm /media/disk/var/cache/apt/archives/*
sudo /media/disk/var/cache/apt/*.bin
sudo mkdir /media/disk/var/lib/apt/lists
sudo mkdir /media/disk/var/lib/apt/lists/partial
df -i

Can you help with this problem?

Provide an answer of your own, or ask amit k for more information if necessary.

To post a message you must log in.