How can I fix dpkg after my system ran out of space?

7,916

I have face this out of space issues several times. This is how i solve it. Usually apt-get create some cache which holds some space on the computer. So I clean the cache, then I get some space back for the system to use to run other other process. This is the reason I don't regularly clean cache. So this is my trick

$ sudo apt-get clean; sudo apt-get autoclean

You can then purge libreoffice afterwards.

PS: When you are faced with space issue you can try clean out old kernels as well with sudo apt-get autoremove --purge -y

Share:
7,916

Related videos on Youtube

d3pd
Author by

d3pd

Updated on September 18, 2022

Comments

  • d3pd
    d3pd over 1 year

    I was installing LibreOffice on my Ubuntu phone when it ran out of space (sudo apt-get install libreoffice). When I attempt to purge what was installed of LibreOffice (sudo apt-get purge libreoffice), I am presented with the message

    E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
    

    When I run sudo dpkg --configure -a, I am presented with the following error:

    dpkg: error: failed to write status database record about 'iputils-ping' to '/var/lib/dpkg/status': No space left on device
    

    How should I proceed? I am trying to purge LibreOffice precisely to address this lack of space. Are there some LibreOffice package/system files I can remove manually to make enough space for the dpkg purge to actually run?

    • George Udosen
      George Udosen over 7 years
      Possible duplicate of How to uninstall LibreOffice?
    • d3pd
      d3pd over 7 years
      @George No, this is a question about getting dpkg working after it encounters low drive space, not specifically about LibreOffice.
    • George Udosen
      George Udosen over 7 years
      I offered that link so you could completely remove libreoffice based on the post as it seemed removing libreoffice would help create more space. Basically removing less important apps would be the best option,
    • d3pd
      d3pd over 7 years
      @George Thanks for the suggestion. The problem is that the action of removing applications cannot be done due to lack of space. So, it is not as simple as suggesting that other applications be removed because they cannot be removed. The best idea I've got currently is to try something like rm -rf /var/lib/libreoffice and to hope that dpkg can fix things afterwards.