Low disk space on file system message on:

 - Elementary: `elementary OS Freya (64-bit)` Built on "Ubuntu 14.04
   LTS"
 - File manager: `Files 0.2.4`

I want to create more disk space and running the command `df-h` gives the following output:

    Filesystem  Size  Used Avail Use% Mounted on
    udev            1.9G  4.0K  1.9G   1% /dev
    tmpfs           390M  1.2M  389M   1% /run
    /dev/sda1        19G   18G  637M  97% /
    none            4.0K     0  4.0K   0% /sys/fs/cgroup
    none            5.0M     0  5.0M   0% /run/lock
    none            2.0G   78M  1.9G   4% /run/shm
    none            100M   44K  100M   1% /run/user
    /dev/sdb1       823G   31G  751G   4% /home

I can't install any programs as there is no space on `/dev/sda1`, so I cannot install a program with a user interface to view files.

Therefore we took the following route:

So, the first disk is very small, and **Plan A** is just to free up enough stuff on it to stop it moaning. **Plan B** would he to move some stuff over to the spacious disk, and link it in. But hopefully A will work!

I reckon there's a lot of unused kernel images in `/boot`, it seeks to get a known weakness with elementary that it doesn't tidy old ones up. I had a web page up that described how to remove them and then update the grub menu so it didn't offer them anymore. But the first command was giving a funny error. I'm following the suggestions on this page:

https://elementaryos.stackexchange.com/questions/95/how-to-remove-old-kernel-versions


----------


So, we ran this command:

    dpkg -l | fgrep linux-image-

It will list a lot of kernel images, most of which you aren't actively using. They're all similarly named, differentiated by a numerical suffix e.g. "`.151`" To find out which one you are using when you boot up, run this:

    uname -r

The result was an old kernel image: `3.13.0-44-generic`

We are assuming that any other kernel images newer than this can go:

So starting with `3.13.0-45-generic`

    $ sudo su 
    # apt-get purge linux-image-3.13.0-45-generic
    # exit

 

Running this command produced the following:  

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet de pendencies:
     linux-headers-generic : Depends: linux-headers-3.13.0-151-generic but it is not going to be installed
     linux-image-extra-3.13.0-45-generic : Depends: linux-image-3.13.0-45-generic but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
    # 

I ran `apt-get -f install` but not sure if I should now run `apt-get autoremove` - I guess there will be a net gain of disk space that will accommodate the 13.5MB need for the new installations? 

    # apt-get -f install
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Correcting dependencies... Done
    The following packages were automatically installed and are no longer required:
      libbonobo2-0 libbonobo2-common libgconf2-4 libgnome2-0 libgnome2-bin
      libgnome2-common libgnomevfs2-0 libgnomevfs2-common libidl-common libidl0
      libntdb1 liborbit-2-0 liborbit2 libqpdf13 linux-headers-3.13.0-105
      linux-headers-3.13.0-105-generic linux-headers-3.13.0-116
      linux-headers-3.13.0-116-generic linux-image-3.13.0-105-generic
      linux-image-3.13.0-116-generic linux-image-extra-3.13.0-105-generic
      linux-image-extra-3.13.0-116-generic python-ntdb
    Use 'apt-get autoremove' to remove them.
    The following extra packages will be installed:
      linux-headers-3.13.0-151-generic
    The following NEW packages will be installed:
      linux-headers-3.13.0-151-generic
    0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
    2 not fully installed or removed.
    Need to get 0 B/706 kB of archives.
    After this operation, 13.5 MB of additional disk space will be used.
    Do you want to continue? [Y/n] apt-get -f install

Then running this command:

    # apt-get autoremove
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt-get -f install' to correct these.
    The following packages have unmet dependencies:
     linux-headers-generic : Depends: linux-headers-3.13.0-151-generic but it is not installed
    E: Unmet dependencies. Try using -f.

...

    # apt-get -f install
        Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        Correcting dependencies... Done
        The following packages were automatically installed and are no longer required:
          libbonobo2-0 libbonobo2-common libgconf2-4 libgnome2-0 libgnome2-bin
          libgnome2-common libgnomevfs2-0 libgnomevfs2-common libidl-common libidl0
          libntdb1 liborbit-2-0 liborbit2 libqpdf13 linux-headers-3.13.0-105
          linux-headers-3.13.0-105-generic linux-headers-3.13.0-116
          linux-headers-3.13.0-116-generic linux-image-3.13.0-105-generic
          linux-image-3.13.0-116-generic linux-image-extra-3.13.0-105-generic
          linux-image-extra-3.13.0-116-generic python-ntdb
        Use 'apt-get autoremove' to remove them.
        The following extra packages will be installed:
          linux-headers-3.13.0-151-generic
        The following NEW packages will be installed:
          linux-headers-3.13.0-151-generic
        0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
        2 not fully installed or removed.
        Need to get 0 B/706 kB of archives.
        After this operation, 13.5 MB of additional disk space will be used.
        Do you want to continue? [Y/n] n
        Abort.


----------


    After this operation, 13.5 MB of additional disk space will be used.
    Do you want to continue? [Y/n] yes

    (Reading database ... 1223843 files and directories currently installed.)
    Preparing to unpack .../linux-headers-3.13.0-151 generic_3.13.0-151.201_amd64.deb ...
    Unpacking linux-headers-3.13.0-151-generic (3.13.0-151.201) ...
    dpkg: error processing archive /var/cache/apt/archives/linux-headers-3.13.0-151-generic_3.13.0-151.201_amd64.deb (--unpack):
    error creating symbolic link `./usr/src/linux-headers-3.13.0-151-generic/include/linux/if_arp.h': No space left on device
    No apport report written because the error message indicates a disk full error
          
    Errors were encountered while processing:
    /var/cache/apt/archives/linux-headers-3.13.0-151-generic_3.13.0-151.201_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    $ 



----------

    

----------

    $ dpkg --list | grep linux-image

<1> dpkg --list | grep linux-image 
   
https://pastebin.com/NQChqwir
----------

$ sudo du -h / -d 1 --exclude=/home
    [sudo] password: 
    8.0K	/media
    0	/sys
    15M	/sbin
    4.0K	/cdrom
    16K	/lost+found
    du: cannot access ‘/proc/3069/task/3069/fd/3’: No such file or directory
    du: cannot access ‘/proc/3069/task/3069/fdinfo/3’: No such file or directory
    du: cannot access ‘/proc/3069/fd/3’: No such file or directory
    du: cannot access ‘/proc/3069/fdinfo/3’: No such file or directory
    0	/proc
    1.3G	/var
    300K	/tmp
    68K	/root
    4.0K	/mnt
    31M	/etc
    7.1G	/lib
    4.0K	/lib64
    4.0K	/opt
    4.0K	/dev
    1.4G	/boot
    4.0K	/srv
    du: cannot access ‘/run/user/1000/gvfs’: Permission denied
    1.4M	/run
    9.7M	/bin

----------

    Filesystem     Inodes IUsed IFree IUse% Mounted on
    udev             484K   539  483K    1% /dev
    tmpfs            488K   550  487K    1% /run
    /dev/sda1        1.2M  1.2M  8.9K  100% /
    none             488K     2  488K    1% /sys/fs/cgroup
    none             488K     3  488K    1% /run/lock
    none             488K    45  488K    1% /run/shm
    none             488K    24  488K    1% /run/user
    /dev/sdb1         53M   42K   53M    1% /home

----------

    # for i in /*; do echo $i; find $i |wc -l; done
    /bin
    154
    /boot
    504
    /cdrom
    1
    /dev
    546
    /etc
    2911
    /home
    42341
    /initrd.img
    1
    /initrd.img.old
    1
    /lib
    175661
    /lib32
    44
    /lib64
    2
    /lost+found
    1
    /media
    2
    /mnt
    1
    /opt
    1
    /proc
    109901
    /root
    17
    /run
    571
    /sbin
    211
    /srv
    1
    /sys
    29272
    /tmp
    20
    /usr
    1051276
    /var
    10966
    /vmlinuz
    1
    /vmlinuz.old
    1
    # exit

----------
I am uncertain but I may have missed a step.  First line in step 4 (after you ran du on /) has this already been completed?

    $ sudo du -h /lib/ -d 1 --exclude=/home
    [sudo] password for gary: 
    52K	/lib/recovery-mode
    220K	/lib/plymouth
    17M	/lib/x86_64-linux-gnu
    8.0K	/lib/ifupdown
    12K	/lib/apparmor
    16K	/lib/hdparm
    8.0K	/lib/modules-load.d
    6.9G	/lib/modules
    12K	/lib/linux-sound-base
    175M	/lib/firmware
    8.0K	/lib/nvidia-340
    1.3M	/lib/xtables
    140K	/lib/modprobe.d
    32K	/lib/lsb
    880K	/lib/systemd
    768K	/lib/brltty
    16K	/lib/resolvconf
    208K	/lib/terminfo
    36K	/lib/ufw
    11M	/lib/udev
    20K	/lib/init
    28K	/lib/crda
    7.1G	/lib/
    :~$ 

----------

$ sudo du -h /lib/modules/* -d 1
    [sudo] password: 

2> $ sudo du -h /lib/modules/* -d 1
   
https://pastebin.com/U65EfV7P

----------
<3> $ ls -la /lib/modules/

https://pastebin.com/u8m3WctC

total 152

-----------
    
    
    
    $ uname -r
    3.13.0-44-generic

----------

    :~$ awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg
    elementary OS
    elementary OS, with Linux 3.13.0-151-generic
    elementary OS, with Linux 3.13.0-151-generic (recovery mode)
    elementary OS, with Linux 3.13.0-149-generic
    elementary OS, with Linux 3.13.0-149-generic (recovery mode)
    elementary OS, with Linux 3.13.0-147-generic
    elementary OS, with Linux 3.13.0-147-generic (recovery mode)
    elementary OS, with Linux 3.13.0-145-generic
    elementary OS, with Linux 3.13.0-145-generic (recovery mode)
    elementary OS, with Linux 3.13.0-144-generic
    elementary OS, with Linux 3.13.0-144-generic (recovery mode)
    elementary OS, with Linux 3.13.0-143-generic
    elementary OS, with Linux 3.13.0-143-generic (recovery mode)
    elementary OS, with Linux 3.13.0-142-generic
    elementary OS, with Linux 3.13.0-142-generic (recovery mode)
    elementary OS, with Linux 3.13.0-141-generic
    elementary OS, with Linux 3.13.0-141-generic (recovery mode)
    elementary OS, with Linux 3.13.0-139-generic
    elementary OS, with Linux 3.13.0-139-generic (recovery mode)
    elementary OS, with Linux 3.13.0-137-generic
    elementary OS, with Linux 3.13.0-137-generic (recovery mode)
    elementary OS, with Linux 3.13.0-135-generic
    elementary OS, with Linux 3.13.0-135-generic (recovery mode)
    elementary OS, with Linux 3.13.0-133-generic
    elementary OS, with Linux 3.13.0-133-generic (recovery mode)
    elementary OS, with Linux 3.13.0-132-generic
    elementary OS, with Linux 3.13.0-132-generic (recovery mode)
    elementary OS, with Linux 3.13.0-129-generic
    elementary OS, with Linux 3.13.0-129-generic (recovery mode)
    elementary OS, with Linux 3.13.0-128-generic
    elementary OS, with Linux 3.13.0-128-generic (recovery mode)
    elementary OS, with Linux 3.13.0-126-generic
    elementary OS, with Linux 3.13.0-126-generic (recovery mode)
    elementary OS, with Linux 3.13.0-125-generic
    elementary OS, with Linux 3.13.0-125-generic (recovery mode)
    elementary OS, with Linux 3.13.0-123-generic
    elementary OS, with Linux 3.13.0-123-generic (recovery mode)
    elementary OS, with Linux 3.13.0-121-generic
    elementary OS, with Linux 3.13.0-121-generic (recovery mode)
    elementary OS, with Linux 3.13.0-119-generic
    elementary OS, with Linux 3.13.0-119-generic (recovery mode)
    elementary OS, with Linux 3.13.0-117-generic
    elementary OS, with Linux 3.13.0-117-generic (recovery mode)
    elementary OS, with Linux 3.13.0-116-generic
    elementary OS, with Linux 3.13.0-116-generic (recovery mode)
    elementary OS, with Linux 3.13.0-115-generic
    elementary OS, with Linux 3.13.0-115-generic (recovery mode)
    elementary OS, with Linux 3.13.0-113-generic
    elementary OS, with Linux 3.13.0-113-generic (recovery mode)
    elementary OS, with Linux 3.13.0-112-generic
    elementary OS, with Linux 3.13.0-112-generic (recovery mode)
    elementary OS, with Linux 3.13.0-110-generic
    elementary OS, with Linux 3.13.0-110-generic (recovery mode)
    elementary OS, with Linux 3.13.0-108-generic        
    elementary OS, with Linux 3.13.0-108-generic (recovery mode)
    elementary OS, with Linux 3.13.0-107-generic
    elementary OS, with Linux 3.13.0-107-generic (recovery mode)
    elementary OS, with Linux 3.13.0-106-generic
    elementary OS, with Linux 3.13.0-106-generic (recovery mode)
    elementary OS, with Linux 3.13.0-105-generic
    elementary OS, with Linux 3.13.0-105-generic (recovery mode)
    elementary OS, with Linux 3.13.0-101-generic
    elementary OS, with Linux 3.13.0-101-generic (recovery mode)
    elementary OS, with Linux 3.13.0-85-generic
    elementary OS, with Linux 3.13.0-85-generic (recovery mode)
    elementary OS, with Linux 3.13.0-74-generic
    elementary OS, with Linux 3.13.0-74-generic (recovery mode)
    elementary OS, with Linux 3.13.0-57-generic
    elementary OS, with Linux 3.13.0-57-generic (recovery mode)
    elementary OS, with Linux 3.13.0-45-generic
    elementary OS, with Linux 3.13.0-45-generic (recovery mode)
    elementary OS, with Linux 3.13.0-44-generic
    elementary OS, with Linux 3.13.0-44-generic (recovery mode)
    Memory test (memtest86+)
    Memory test (memtest86+, serial console 115200)

----------

    :~$ sudo su
    : 
    # for i in /usr/*; do echo $i; find $i |wc -l; done
    /usr/bin
    1369
    /usr/games
    8
    /usr/include
    1334
    /usr/lib
    18577
    /usr/lib32
    308
    /usr/local
    29
    /usr/sbin
    201
    /usr/share
    144962
    /usr/src
    884487
    
    exit
    :~$
  
----------
  
    ~$ sudo dpkg --purge --force-depends,remove-reinstreq linux-    image-3.13.0-101-generic
    dpkg: linux-image-3.13.0-101-generic: dependency problems, but removing   anyway as you requested:
    linux-image-extra-3.13.0-101-generic depends on linux-image-3.13.0-101-generic.

    (Reading database ... 1223842 files and directories currently installed.)
    Removing linux-image-3.13.0-101-generic (3.13.0-101.148) ...
    Examining /etc/kernel/prerm.d.
    run-parts: executing /etc/kernel/prerm.d/dkms 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
    dkms: removing: bbswitch 0.7 (3.13.0-101-generic) (x86_64)


-------- 
Uninstall Beginning

--------
    Module:  bbswitch
    Version: 0.7
    Kernel:  3.13.0-101-generic (x86_64)

-------------------------------------

    Status: Before uninstall, this module version was ACTIVE on this kernel.

    bbswitch.ko:
     - Uninstallation
       - Deleting from: /lib/modules/3.13.0-101-generic/extra/
     - Original module
       - No original module was found for this module on this kernel.
       - Use the dkms install command to reinstall any previous module version.

    depmod....

    DKMS: uninstall completed.
    Examining /etc/kernel/postrm.d .
    run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
    update-initramfs: Deleting /boot/initrd.img-3.13.0-101-generic
    run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
    Generating grub configuration file ...
    Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT  is set is no longer supported.
    Found linux image: /boot/vmlinuz-3.13.0-151-generic
    Found initrd image: /boot/initrd.img-3.13.0-151-generic
    Found linux image: /boot/vmlinuz-3.13.0-149-generic
    Found initrd image: /boot/initrd.img-3.13.0-149-generic
    Found linux image: /boot/vmlinuz-3.13.0-147-generic
    Found initrd image: /boot/initrd.img-3.13.0-147-generic
    Found linux image: /boot/vmlinuz-3.13.0-145-generic
    Found initrd image: /boot/initrd.img-3.13.0-145-generic
    Found linux image: /boot/vmlinuz-3.13.0-144-generic
    Found initrd image: /boot/initrd.img-3.13.0-144-generic
    Found linux image: /boot/vmlinuz-3.13.0-143-generic
    Found initrd image: /boot/initrd.img-3.13.0-143-generic
    Found linux image: /boot/vmlinuz-3.13.0-142-generic
    Found initrd image: /boot/initrd.img-3.13.0-142-generic
    Found linux image: /boot/vmlinuz-3.13.0-141-generic
    Found initrd image: /boot/initrd.img-3.13.0-141-generic
    Found linux image: /boot/vmlinuz-3.13.0-139-generic
    Found initrd image: /boot/initrd.img-3.13.0-139-generic
    Found linux image: /boot/vmlinuz-3.13.0-137-generic
    Found initrd image: /boot/initrd.img-3.13.0-137-generic
    Found linux image: /boot/vmlinuz-3.13.0-135-generic
    Found initrd image: /boot/initrd.img-3.13.0-135-generic
    Found linux image: /boot/vmlinuz-3.13.0-133-generic
    Found initrd image: /boot/initrd.img-3.13.0-133-generic
    Found linux image: /boot/vmlinuz-3.13.0-132-generic
    Found initrd image: /boot/initrd.img-3.13.0-132-generic
    Found linux image: /boot/vmlinuz-3.13.0-129-generic
    Found initrd image: /boot/initrd.img-3.13.0-129-generic
    Found linux image: /boot/vmlinuz-3.13.0-128-generic
    Found initrd image: /boot/initrd.img-3.13.0-128-generic
    Found linux image: /boot/vmlinuz-3.13.0-126-generic
    Found initrd image: /boot/initrd.img-3.13.0-126-generic
    Found linux image: /boot/vmlinuz-3.13.0-125-generic
    Found initrd image: /boot/initrd.img-3.13.0-125-generic
    Found linux image: /boot/vmlinuz-3.13.0-123-generic
    Found initrd image: /boot/initrd.img-3.13.0-123-generic
    Found linux image: /boot/vmlinuz-3.13.0-121-generic
    Found initrd image: /boot/initrd.img-3.13.0-121-generic
    Found linux image: /boot/vmlinuz-3.13.0-119-generic
    Found initrd image: /boot/initrd.img-3.13.0-119-generic
    Found linux image: /boot/vmlinuz-3.13.0-117-generic
    Found initrd image: /boot/initrd.img-3.13.0-117-generic
    Found linux image: /boot/vmlinuz-3.13.0-116-generic
    Found initrd image: /boot/initrd.img-3.13.0-116-generic
    Found linux image: /boot/vmlinuz-3.13.0-115-generic
    Found initrd image: /boot/initrd.img-3.13.0-115-generic
    Found linux image: /boot/vmlinuz-3.13.0-113-generic
    Found initrd image: /boot/initrd.img-3.13.0-113-generic
    Found linux image: /boot/vmlinuz-3.13.0-112-generic
    Found initrd image: /boot/initrd.img-3.13.0-112-generic
    Found linux image: /boot/vmlinuz-3.13.0-110-generic
    Found initrd image: /boot/initrd.img-3.13.0-110-generic
    Found linux image: /boot/vmlinuz-3.13.0-108-generic
    Found initrd image: /boot/initrd.img-3.13.0-108-generic
    Found linux image: /boot/vmlinuz-3.13.0-107-generic
    Found initrd image: /boot/initrd.img-3.13.0-107-generic
    Found linux image: /boot/vmlinuz-3.13.0-106-generic
    Found initrd image: /boot/initrd.img-3.13.0-106-generic
    Found linux image: /boot/vmlinuz-3.13.0-105-generic
    Found initrd image: /boot/initrd.img-3.13.0-105-generic
    Found linux image: /boot/vmlinuz-3.13.0-85-generic
    Found initrd image: /boot/initrd.img-3.13.0-85-generic
    Found linux image: /boot/vmlinuz-3.13.0-74-generic
    Found initrd image: /boot/initrd.img-3.13.0-74-generic
    Found linux image: /boot/vmlinuz-3.13.0-57-generic
    Found initrd image: /boot/initrd.img-3.13.0-57-generic
    Found linux image: /boot/vmlinuz-3.13.0-45-generic
    Found initrd image: /boot/initrd.img-3.13.0-45-generic
    Found linux image: /boot/vmlinuz-3.13.0-44-generic
    Found initrd image: /boot/initrd.img-3.13.0-44-generic
    Found memtest86+ image: /boot/memtest86+.elf
    Found memtest86+ image: /boot/memtest86+.bin
    done
    Purging configuration files for linux-image-3.13.0-101-generic    (3.13.0-101.148) ...
    Examining /etc/kernel/postrm.d .
    run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-101- generic /boot/vmlinuz-3.13.0-101-generic
    run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-101-generic  /boot/vmlinuz-3.13.0-101-generic

-------------------------------------
sudo dpkg --purge --force-depends,remove-reinstreq linux-image

https://pastebin.com/TBFb9He9

-------------------------------------


```df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G   12K  1.9G   1% /dev
tmpfs           390M  1.2M  389M   1% /run
/dev/sda1        19G   15G  3.7G  80% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            2.0G   51M  1.9G   3% /run/shm
none            100M   60K  100M   1% /run/user
/dev/sdb1       823G   30G  752G   4% /home```


------------------------------------------

<05/12/18> I ran 6 with the full command and it returned over 142,000 so impossible to fully paste 

I then tried to ran 7 but when I paste in Terminal and click on return Terminal crashes  

Running ```df -ih``` gives ouput:

```bash: cannot create temp file for here-document: No space left on device
Filesystem     Inodes IUsed IFree IUse% Mounted on
udev             484K   545  483K    1% /dev
tmpfs            488K   554  487K    1% /run
/dev/sda1        1.2M  1.2M     0  100% /
none             488K     2  488K    1% /sys/fs/cgroup
none             488K     3  488K    1% /run/lock
none             488K    56  488K    1% /run/shm
none             488K    29  488K    1% /run/user
/dev/sdb1         53M   40K   53M    1% /home```


When I logged on this morning updates on software ran - this has not happened since the low disk problem

<06/12/18> I can no longer log on.  PC starts and then gets to login page as normal. I enter login and 'return.' Instead of starting up it goes to a blank screen and then back to login page.