dpkg: dependency problems prevent configuration of initramfs-tools

67,703

Solution 1

Your system is in a state which I think should not happen: you have the new version of the dependency initramfs-tools-bin in the installed state, but the old version of the dependency initramfs-tools in a half-installed state. I'm not sure whether the problem is that APT is letting the system get into a state where it can't recover, dpkg is letting the system get into a state where it can't recover, the package maintainer used a combination of dependencies which isn't supported, or my limited understanding doesn't cover this case.

Try using dpkg directly:

dpkg --configure -a

If this still complains about dependencies, try

dpkg --configure -a --force-depends

If this works, you have the dpkg database in a consistent state. You need to get APT in a good state (which requires no broken dependencies):

apt-get -f install

After this you can resume normal upgrading.


If your purge of /boot was deleting old kernels that were in packages, you won't be able to remove the kernel packages anymore. You'll have to recreate the files. You can create empty files (touch `cat /var/lib/dpkg/info/linux-image-1.2.3-foo`) if you're removing the linux-image-1.2.3-foo package and you manually removed some of its files.

Solution 2

update-initramfs: Generating /boot/initrd.img-3.8.0-32-lowlatency

gzip: stdout: No space left on device

This means that you need to remove some kernels. Old, unused kernels are the best alternative.

sudo dpkg --purge linux-generic-someold-version

manually deleted older files and now some space is free

NO!

You should never manually remove anything. Ever. Only stuff from /home and /tmp that may be easily recoverable can me touched by hand, otherwise use the tools. That's the point of having DPKG/APT to your service. If you need to remove something use apt/dpkg instead and leave stuff done by hand as last alternative. I'm presuming your current problem is because of this.


To solve the dependency issue, you may downgrade, then upgrade:

sudo apt-get update
sudo apt-get -f install initramfs-tools=0.99ubuntu13 initramfs-tools-bin=0.99ubuntu13
sudo apt-get upgrade

By this point you should have told dpkg/apt to remove the old kernels too.

Share:
67,703

Related videos on Youtube

Jarek
Author by

Jarek

You may be interested in the story of SE moderator Monica Cellio and how she was unfairly treated by the corporate management of this site. More info here. An update is available. Let's hope we can cultivate a more fair environment for content creators and moderators going forward.

Updated on September 18, 2022

Comments

  • Jarek
    Jarek over 1 year

    I started an upgrade of my Kubuntu 12.04 system with this command, as usual:

    sudo apt-get --show-upgraded dist-upgrade
    

    I came back later and it had failed:

    Preconfiguring packages ...
    (Reading database ... 478306 files and directories currently installed.)
    Preparing to replace  ...
    Unpacking replacement base-files ...
    Processing triggers for man-db ...
    Processing triggers for install-info ...
    ...
    Processing triggers for initramfs-tools ...
    update-initramfs: Generating /boot/initrd.img-3.8.0-32-lowlatency
    
    gzip: stdout: No space left on device
    E: mkinitramfs failure cpio 141 gzip 1
    update-initramfs: failed for /boot/initrd.img-3.8.0-32-lowlatency with 1.
    dpkg: error processing initramfs-tools (--unpack):
     subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
     initramfs-tools
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    here's the problem: $ df -h output:

    Filesystem                    Size  Used Avail Use% Mounted on
    /dev/sda1                     894M  879M     0 100% /boot
    

    manually deleted older files and now some space is free

    Filesystem                    Size  Used Avail Use% Mounted on
    /dev/sda1                     894M  129M  717M  16% /boot
    

    I ran this next:

    sudo apt-get autoremove
    

    Next:

    sudo apt-get -f install output:

    The following extra packages will be installed:
      initramfs-tools
    The following packages will be upgraded:
      initramfs-tools
    
    dpkg: dependency problems prevent configuration of initramfs-tools:
     initramfs-tools depends on initramfs-tools-bin (<< 0.99ubuntu13.3.1~); however:
      Version of initramfs-tools-bin on system is 0.99ubuntu13.4.
    dpkg: error processing initramfs-tools (--configure):
     dependency problems - leaving unconfigured
    No apport report written because the error message indicates its a followup error from a previous failure.
                             Errors were encountered while processing:
     initramfs-tools
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    sudo apt-get install initramfs-tools
    the above fails

    dpkg -l initramfs-tools output:

    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name           Version        Description
    +++-==============-==============-============================================
    iF  initramfs-tool 0.99ubuntu13.3 tools for generating an initramfs
    

    sudo apt-get install --reinstall initramfs-tools output:

    The following packages will be upgraded:
      initramfs-tools
    1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    1 not fully installed or removed.
    Need to get 0 B/49.2 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    dpkg: dependency problems prevent configuration of initramfs-tools:
     initramfs-tools depends on initramfs-tools-bin (<< 0.99ubuntu13.3.1~); however:
      Version of initramfs-tools-bin on system is 0.99ubuntu13.4.
    dpkg: error processing initramfs-tools (--configure):
     dependency problems - leaving unconfigured
    No apport report written because the error message indicates its a followup error from a previous failure.
                             Errors were encountered while processing:
     initramfs-tools
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    Here is the output of apt-cache policy initramfs-tools-bin initramfs-tools:

    initramfs-tools-bin:
      Installed: 0.99ubuntu13.4
      Candidate: 0.99ubuntu13.4
      Version table:
     *** 0.99ubuntu13.4 0
            500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
            100 /var/lib/dpkg/status
         0.99ubuntu13 0
            500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
    initramfs-tools:
      Installed: 0.99ubuntu13.3
      Candidate: 0.99ubuntu13.4
      Version table:
         0.99ubuntu13.4 0
            500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
     *** 0.99ubuntu13.3 0
            100 /var/lib/dpkg/status
         0.99ubuntu13 0
            500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
    

    As suggested below, here are my next steps:

    $ sudo apt-get update
    $ sudo apt-get -f install initramfs-tools=0.99ubuntu13 initramfs-tools-bin=0.99ubuntu13
    
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      ...
    Use 'apt-get autoremove' to remove them.
    The following packages will be DOWNGRADED:
      initramfs-tools initramfs-tools-bin
    0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 4 not upgraded.
    1 not fully installed or removed.
    Need to get 59.2 kB of archives.
    After this operation, 2,048 B disk space will be freed.
    Do you want to continue [Y/n]? 
    Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main initramfs-tools all 0.99ubuntu13 [49.2 kB]
    Get:2 http://us.archive.ubuntu.com/ubuntu/ precise/main initramfs-tools-bin amd64 0.99ubuntu13 [9,988 B]
    Fetched 59.2 kB in 0s (124 kB/s)            
    dpkg: warning: downgrading initramfs-tools-bin from 0.99ubuntu13.4 to 0.99ubuntu13.
    (Reading database ... 478624 files and directories currently installed.)
    Preparing to replace initramfs-tools-bin 0.99ubuntu13.4 (using .../initramfs-tools-bin_0.99ubuntu13_amd64.deb) ...
    Unpacking replacement initramfs-tools-bin ...
    Setting up initramfs-tools-bin (0.99ubuntu13) ...
    dpkg: dependency problems prevent configuration of initramfs-tools:
     initramfs-tools depends on initramfs-tools-bin (>= 0.99ubuntu13.3); however:
      Version of initramfs-tools-bin on system is 0.99ubuntu13.
    dpkg: error processing initramfs-tools (--configure):
     dependency problems - leaving unconfigured
    No apport report written because the error message indicates its a followup error from a previous failure.
                             Errors were encountered while processing:
     initramfs-tools
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    Next I tried Giles's suggestion:

    sudo dpkg --configure -a --force-depends
    sudo apt-get install -f
    sudo apt-get dist-upgrade
    
    • Admin
      Admin over 10 years
      I'm a bit confused. Please post the output of apt-cache policy initramfs-tools-bin initramfs-tools
    • Admin
      Admin over 10 years
      @Gilles - thanks for looking at it. I updated the question with this info.
    • Admin
      Admin over 10 years
      Try manually specifying the version: apt-get install initramfs-tools=0.99ubuntu13.4
    • Admin
      Admin over 10 years
      Hmmm, this looks like a bug in either the dependencies of the initramfs-tools package or in how dpkg manages them. I think your system isn't supposed to get in this state where the new initramfs-tools-bin is marked as installed but the old initramfs-tools is still there. Does dpkg --configure -a --force-depends help?
    • Admin
      Admin over 10 years
      What is the output of sudo apt-get check and dpkg --audit?
    • Admin
      Admin over 10 years
      dpkg --configure -a --force-depend solved it!!! Thanks Giles!
    • Admin
      Admin over 10 years
      @MountainX I recommend you to do dpkg --audit before announcing victory. His suggestion only force dpkg to install the stuff, it may cause problems in the long term.
    • Admin
      Admin over 10 years
      @Braiam Isn't apt-get -f install sufficient? What more does dpkg -C do here?
    • Admin
      Admin over 10 years
      @Braiam I ran sudo dpkg --audit. It returns to the command prompt with no output. And I did a dist-upgrade after doing what Giles suggested and it worked fine.
    • Admin
      Admin over 10 years
      @Gilles dpkg was the one trowing dependencies issues rather than APT, to APT everything was a-ok (actually I can't put my finger on what wicked behavior is this as debian doesn't use the -bin package). I checked out the package page and that added more confusion. initramfs-tools version 0.99ubuntu13.3 depends of any initramfs-toos-bin between 0.99ubuntu13.3 and 0.99ubuntu13.3.1~ but doesn't allow installing when both packages are the same version.
    • Admin
      Admin over 10 years
      searching around a little it seems that if dpkg --audit simply returns to the command line, everything is good.
  • Jarek
    Jarek over 10 years
    I tried your suggestion. It also fails. I updated my question with the output.