How to Fix 'rm: cannot remove '/etc/resolv.conf': Operation not permitted'

In Ubuntu, you may run into an issue when updating /etc/resolv.conf even tho you have root permissions.

Error:

rm: cannot remove '/etc/resolv.conf': Operation not permitted

Pre-requisites

Fix

lsattr /etc/resolv.conf

Example output:

[[email protected] ~]# lsattr /etc/resolv.conf
----i--------------- /etc/resolv.conf
sudo chattr -i /etc/resolv.conf
lsattr /etc/resolv.conf

Example output:

[[email protected] ~]# lsattr /etc/resolv.conf
-------------------- /etc/resolv.conf
comments powered by Disqus