Apt – Unmet Dependencies and Root at 99%

By | January 1, 2016

Symptom:

When attempting to install a new package using apt, an error message regarding unmet dependencies is displayed and suggests using apt-get -f install to fix the problem.

However, sudo apt-get -f install throws an error about no disk space.

Cause:

Updates have failed due to low disk space and resulted in dependency problems.

Solution:

Increase the size of the virtual machine’s disk

Troubleshooting Steps:

      1. sudo apt-get -f install throws an error about no disk space.
      2. df shows that the root file system is at or near 100%
      3. sudo apt-get clean clears some space, but not enough for apt-get -f install to fix the dependency problem.
      4. The best long term solution is to increase the size of the Virtual Machine’s disk (.vdi file). However a .vdi in fixed format cannot be resized. It must first be cloned to a dynamic (default) disk.
      5. Check to see what format the .vdi file is in
        • vboxmanage showhdinfo /path/to/servername.vdi
        • Format variant: fixed default
      6. Clone the .vdi file to create a copy that is in dynamic (resizable) format
        • vboxmanage clonehd /path/to/servername.vdi /path/to/newserver.vdi
      7. Verify that the disk is now in dynamic format
        • vboxmanage showhdinfo /path/to/newserver.vdi
        • Format variant: dynamic default
      8. Increase the size of the disk (For example, from ~5GB to ~20GB)
        • vboxmanage modifymedium /path/to/newserver.vdi –resize 20000
      9. Launch the virtual machine from a live Linux .iso and use GParted (or your favorite disk management application) to expand the disk
        1. Deactivate the main Ubuntu volume so that it can be modified. Right-click on it and select deactivate.
        2. Right-click on the parent extended partion and choose Resize/Move
        3. Click and drag the black arrow to the far right to use up the new space
        4. Select Edit -> Apply all operations
        5. Right-click on the main volume and select Resize/Move
        6. Repeat steps three and four
        7. Shutdown the VM, remove the live Linux .iso, and restart with the vdi

        GParted Resize Partition

      10. Issue the command df and note how the root file system is still at its original size
      11. Launch a root shell
        • sudo su
      12. List the physical volumes
        • pvs
        • Note the PSize shows the actual available space

        VirtualBox pvs

      13. List the logical volumes
        • lvdisplay
        • Note the logical volume path as it is required for the next couple of steps

        VirtualBox lvdisplay

      14. Extend it to take the full size available
        • lvextend -l+100%FREE /dev/UbuntuServer64-1-vg/root
      15. Extend the file system on the whole logical volume
        • resize2fs /dev/UbuntuServer64-1-vg/root
      16. Issue df
        • The root file system should now have the new free space

References

http://superuser.com/questions/716649/how-to-change-fixed-size-vdi-with-modifyhd-command-in-windows/717409?newreg=3e3b4a2a98644f42a27b9b8a92c12550

https://blog.vbonhomme.fr/extend-a-lvm-partition-after-increasing-its-virtual-disk-on-virtualbox/

0 thoughts on “Apt – Unmet Dependencies and Root at 99%

  1. Pingback: Drupal Installation | bhm.world

  2. Pingback: Drupal Installation |

Leave a Reply

Your email address will not be published. Required fields are marked *

*