Linux – Debian: cannot remove symlink in /sys/: operation not permitted


I ran some commands without completely understanding them while trying to get screen brightness working and now I'm stuck with a nasty symlink in '/sys/class/backlight/asus_laptop' that I am trying to get rid of.

I have tried

sudo rm /sys/class/backlight/asus_laptop
sudo rm '/sys/class/backlight/asus_laptop'

su root
rm /sys/class/backlight/asus_laptop
sudo rm /sys/class/backlight/asus_laptop

Going right into directory and typing rm asus_laptop, changing ownership and using Thunar to try to remove it.

I get

rm: cannot remove '/sys/class/backlight/asus_laptop': Operation not permitted

Same goes for unlink, rmdir doesn't work, and Thunar fails.

The permissions on it are lrwxrwxrwx

How can I remove it?

Best Answer

The sysfs file system, typically mounted on /sys, just like the /proc file system, isn’t a typical file system, it’s a so called pseudo file system. It’s actually populated by the kernel and you can’t delete files directly.

So, if the ASUS laptop support isn’t appropriate for you, then you have to ask the kernel to remove it. To do so, remove the corresponding module:

sudo rmmod asus-laptop

That will remove the relevant /sys entry.

Related Question