0

It says bash: cannot create temp file for here-document: No space left on device

Following the space distribution:

 Filesystem      Size  Used Avail Use% Mounted on
 udev            3.9G     0  3.9G   0% /dev
 tmpfs           787M  9.8M  777M   2% /run
 /dev/sda9        19G   18G  8.0K 100% /
 tmpfs           3.9G  172K  3.9G   1% /dev/shm
 tmpfs           5.0M  4.0K  5.0M   1% /run/lock
 tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
 cgmfs           100K     0  100K   0% /run/cgmanager/fs
 tmpfs           787M   36K  787M   1% /run/user/1000

How to resolve it ?

  • 1
    Remove some files. sudo apt autoclean; sudo apt autoremove may remove some (providing you have enough space for those commands to work), but removing files is the first step (Ubuntu recommends 25gb be allocated anyway - https://help.ubuntu.com/community/Installation/SystemRequirements so increasing the partition size would also be a solution) – guiverc Jul 26 '19 at 06:27
  • 2
    Imo, there is only one real solution: Get more space ! 19G is just enough for Ubuntu installation plus some small programs. There is nothing left for your personal data and/or more heavy programs. Other option: Use a more light-weight Linux, Ubuntu is not! Everything else is just temporary. – pLumo Jul 26 '19 at 06:59
  • 1
    Allocating at least 50GB for / partition is more like it. How to resize partitions? Or fresh install Ubuntu 18.04 and allocate at least 50GB to the / partition. – karel Jul 26 '19 at 08:13

1 Answers1

0


Here is the script i run to free space on root partition

function myclean {
    ## Show free space
    df -Th | grep -v fs
    # Will need English output for processing
    LANG=en_GB.UTF-8

    ## Clean apt cache
    apt-get update
    apt-get -f install
    apt-get -y autoremove
    apt-get clean

    ## Remove old versions of snap packages
    snap list --all | while read snapname ver rev trk pub notes; do
        if [[ $notes = *disabled* ]]; then
            snap remove "$snapname" --revision="$rev"
        fi
    done
    ## Set snap versions retain settings
    if [[ $(snap get system refresh.retain) -ne 2 ]]; then snap set system refresh.retain=2; fi
    rm -f /var/lib/snapd/cache/*

    ## Remove old versions of Linux Kernel
    dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs apt-get -y purge

    ## Rotate and delete old logs
    /etc/cron.daily/logrotate
    find /var/log -type f -iname *.gz -delete
    sudo journalctl --rotate
    sudo journalctl --vacuum-time=1s

    ## Show free space
    df -Th | grep -v fs
}
cmak.fr
  • 8,696