file /proc/kcore took up all free space in the system and and it won't let you install programs

I have Kali linux OS. When I try install dkms I have got this:

└─# sudo apt install dkms
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  dctrl-tools
Suggested packages:
  menu
The following NEW packages will be installed:
  dctrl-tools dkms
0 upgraded, 2 newly installed, 0 to remove and 565 not upgraded.
Need to get 161 kB of archives.
After this operation, 632 kB of additional disk space will be used.
E: You don't have enough free space in /var/cache/apt/archives/.

All this cause of all free space was taken by this file.
When I query the properties of my system and I get: Usage:0 bytes of 24.6 GiB free (100% used).
du -shx * run from the root directory shows:

└─# du -shx *
0       0
0       bin
0       boot
0       dev
364K    etc
3.1M    home
0       initrd.img
0       initrd.img.old
0       lib
0       lib32
0       lib64
0       libx32
8.0K    media
0       mnt
0       opt
du: cannot access 'proc/339706/task/339706/fd/4': No such file or directory
du: cannot access 'proc/339706/task/339706/fdinfo/4': No such file or directory
du: cannot access 'proc/339706/fd/3': No such file or directory
du: cannot access 'proc/339706/fdinfo/3': No such file or directory
0       proc
324K    root
1.5M    run
0       sbin
0       srv
0       sys
276K    tmp
8.5M    usr
1.2M    var
0       vmlinuz
0       vmlinuz.old

Size of kcore file equals 128.0 TiB (140,737,471,590,400 bytes).

When I measure size of all directories except proc dir I get :69024 items, totalling 1.2 GiB (1,280,074,564 bytes) (some contents unreadable).

What can I do ?

/proc/kcore isn’t at fault here. All the contents of /proc are virtual files which don’t take any space on your disk; they provide access to various pieces of information made available by the kernel. /proc/kcore in particular represents the entire address space, which is why it’s 128TiB in size.

Your disk space is occupied by something else. You might be able to clean some unnecessary files by running

apt autoclean

or even

apt clean

(the latter may result in files being re-downloaded for a later apt install).

Failing that, Find largest files recursively should help you find large files which you might be able to delete (e.g. log files under /var/log). Take care not to delete files belonging to packages or containing important data.

Answered By: Stephen Kitt
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.