5

I know similar issues have been resolved, but I'm kind of stuck. I ran out of space on / partition and needed to remove some packages since apt-get remove, autoremove and clean were not able to do anything. I then apt-get update and apt-get upgrade-ed, but something went wrong in the process. Now, the situtation is:

apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-headers-server linux-server
The following packages will be upgraded:
  linux-headers-server linux-server
2 upgraded, 0 newly installed, 0 to remove and 56 not upgraded.
2 not fully installed or removed.
Need to get 0 B/3,996 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
dpkg: dependency problems prevent configuration of linux-headers-server:
 linux-headers-server depends on linux-headers-3.2.0-55-generic; however:
  Package linux-headers-3.2.0-55-generic is not installed.
dpkg: error processing linux-headers-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of linux-server:
 linux-server depends on linux-image-server (= 3.2.0.55.65); however:
  Version of linux-image-server on system is 3.2.0.56.66.
 linux-server depends on linux-headers-server (= 3.2.0.55.65); however:
  Package linux-headers-server is not configured yet.
dpkg: error processing linux-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-headers-server
 linux-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

So the system wants to install linux-image-server=3.2.0.56.66 though other components depend on version 3.2.0.55.65. I tried to dpgk --remove the package and then reinstall, but I'm stuck. From what I understand, I would need to downgrade linux-image-server, then fix dependencies, than optionally upgrade, if it is needed?

miha
  • 291

3 Answers3

10

So, I force removed all of the related packages, rebooted and then apt-get -f install was happy. What I did was:

dpkg --remove --force-remove-reinstreq linux-headers-server
dpkg --remove --force-remove-reinstreq linux-image-server
dpkg --remove --force-remove-reinstreq linux-headers-3.2.0-56-generic
dpkg --remove --force-remove-reinstreq linux-headers-3.2.0-56
dpkg --remove --force-remove-reinstreq linux-server

and then

apt-get -f install

And that fixed it. To get a list of all packages I used dpkg --get-selections. There is a very useful post for cleaning previous versions here.

miha
  • 291
4

This post was such a blessing for me thanks. Can't tell you how many hours were wasted but this was the best post to deal with my issue. Likewise my boot drive was at 100% capacity and there was a similar dependency issue that had to be resolved otherwise apt-get upgrade would fail. In short below are the commands that I did replacing the headers version number with xx as mine were slightly different. Anyone else getting a similar error will need to read it clearly to find out what version number they need to add.

dpkg --remove --force-remove-reinstreq linux-headers-server
dpkg --remove --force-remove-reinstreq linux-image-server
dpkg --remove --force-remove-reinstreq linux-headers-3.2.0-xx-generic
dpkg --remove --force-remove-reinstreq linux-headers-3.2.0-xx
dpkg --remove --force-remove-reinstreq linux-server

Now Reboot server

shutdown -r now

apt-get autoremove
apt-get -f install
apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')

The final command reduced the usage of my boot drive down to 16% See following URL for more info on command How do I remove old kernel versions to clean up the boot menu?.

Thank you so much miha for posting your solution.

0

I wonder if just removing the linux-server would hurt.

After all, linux-server is the reason that linux-headers-server is installed and if the headers are not necessary, the whole system should work nicely if only linux-image-server is installed.

I had a space problem on a small virtual host and I removed linux-server and the header packages. The server is running fine but has around 700MB more harddisk free which is a lot on a 5 gigabyte virtual host.

peschü
  • 1,526