Cannot change hostname ?!?!?!?!?

OK, I am a newbie but not to the point the I can’t change the hostname on a Centos server!
Despite this however I am faced with a situation that yes in fact I cannot change it!
The error (if using webmin) is:

Failed to save DNS configuration : Failed to replace /etc/resolv.conf with /etc/resolv.conf.webmintmp.17474 : Operation not permitted

I then attempted to change the file /etc/sysconfig/network however the system will not allow me (logged in as root):
Inside VI I see this >> “network” E212: Can’t open file for writing
I then have to quit vi as it will not allow me to save.

Permissions of file:
-rw-r–r-- 1 root root 61 Mar 3 2010 network

It appears as if something is blocking every write attempt to the file but I don’t know what!

Your help is much appreciated!!!


That’s an unusual one!

If I had to guess, I would guess that one or more of those files are marked as “immutable” (which prevents even root from changing them). Or, if you’re using a VPS, it’s possible your provider somehow made them read-only.

What is the output of these 3 commands:

mount lsattr /etc/resolv.conf lsattr /etc/sysconfig/network

hi there,

It’s a dedicated server so I should be able to do everything when logged in root.


/dev/hda3 on / type ext3 (rw,usrquota,grpquota)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/hdc1 on /backup type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

lsattr /etc/resolv.conf
----i-------- /etc/resolv.conf

lsattr /etc/sysconfig/network
----i-------- /etc/sysconfig/network

Unsure what the i is…

The “i” means it’s a file that’s been given the immutable attribute, meaning no one, not even root, can edit that file.

That’s not something that occurs by default, so something, or someone, had set that after the server was setup :slight_smile:

You can unset that by running this command:

chattr -i /path/to/file

Once you do that, you should be able to edit those files.