How to Delete Debug Files in /Sys/Kernel/Debug?

How to Delete Debug Files in /Sys/Kernel/Debug?
sudo find / -size +5G -ls

listed debug files with more than 8GB size at /sys/kernel/debug/dri/n/amdgpu_vram

(n is the number of GPUs)

These might be useless debug files. Cannot delete them (error "Operation not permited"). How to delete these files?

2

2 Answers

These are not files in the traditional sense.

The entire /sys filesystem is a virtual file system, which maps various system functions as files. They are not stored on disk; they're merely mechanisms to access various kernel functions. In this case, the file is the video RAM. The files can serve as a debugging interface, thus the naming.

Removing them does literally not make sense - as they're an representation of a physical feature of your computer system. That's why you're not allowed to remove them.

In short: Do not touch anything inside /sys or /proc unless you know what you are doing. You may crash your system. Reading them is generally safe - worst case will typically garble your terminal with random data.

There's lots of interesting stuff in /sys and /proc, that can tell you a whole lot about how your system operates, both the Linux kernel, and physical parts of your computer.

4

I have the same problem.

df -Th

command shows 100% Usage on / . Therefore, it is not imaginary problem. It is what did happen in my rig before, too. I solved it by using commands like

sudo apt autoremove
sudo apt autoclean
sudo apt clean
sudo apt autoremove --purge
sudo rm /var/log/kern.log
touch /forcefsck
sudo shutdown -rF now

If I find the full solution, I will post it here. ncdu is a better application for checking disk space usage in command line.

apt install ncdu

After several reboot and using commands like above and

sudo lsof +L1 | grep deleted

to detect processes which hold deleted files, the problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.