0

Recently I have been putting my machine to proper use. I have a dual-boot with Ubuntu 22.04 (Jammy Jellyfish) and Windows 11. Anyways, I have been installing a lot of libraries and without knowing it I ran out of space on my root partition.

fernando@fernando-Legion-5-15IAH7:/usr$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  2.9M  1.6G   1% /run
/dev/nvme0n1p3   38G   38G     0 100% /
tmpfs           7.7G  214M  7.5G   3% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
efivarfs        268K  127K  137K  49% /sys/firmware/efi/efivars
/dev/nvme0n1p4  412G   73G  318G  19% /home
/dev/nvme0n1p2  488M   11M  477M   3% /boot/efi
tmpfs           1.6G  164K  1.6G   1% /run/user/1000
/dev/sda2       458G  7.9G  427G   2% /mnt/netac_ssd

I have been trying to get around the issue by running sudo apt-get cleanand then finishing the mid-installed package configuration sudo dpkg --configure -a, but no matter what I run into:

Reading package lists... Error!
E: Write error - write (28: No space left on device)
E: IO Error saving source cache
E: The package lists or status file could not be parsed or opened.

What should I do so I can resolve these conflicts? I know that modifying the partition size is a headache of a process especially for such critical partitions :( Any advice please?

1 Answers1

0

I have two scripts for that case. They remove the data of already removed .deb files(1) and the second removes outdated snap files(2).

But, nevertheless, use them at your own risk:

  1. Remove data of already removed .deb files:

    #!/bin/bash -e
    # Run this script to remove the data of already removed .deb files
    # Inspired by https://askubuntu.com/questions/1522406/how-to-clean-all-junk-files-from-ubuntu
    

    sudo apt purge --dry-run ?config-files read -p "Remove the above files (yes/no) ?" yn if [ "$yn" == "yes" ]; then echo "Removing..." sudo apt purge ?config-files else echo "Aborted!" fi

  2. Remove outdated snap files:

    #!/bin/bash
    # This script will remove disabled snap revisions.
    set -eu
    

    LANG=C snap list --all | awk '/disabled/{print $1, $3}' | while read name rev; do snap remove "$name" --revision="$rev" done

zx485
  • 2,865