Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A few hours earlier I bought a beaglebone and now I am trying to add nameserver to /etc/resolv.conf. However when I open it with vim and try to add my nameserver, it gives me E21: cannot make changes, 'modifiable' is off. I changed permissions via chmod. chmod u+rx /etc/resolv.conf But nothing changed. I am still unable to write into resolv.conf file. What should I do?

share|improve this question
Also just to confirm are you using 12.04 because it doesn't support resolv.conf any more. The changes just get overwritten. – LinuxBill Jun 12 '12 at 8:33
I am sorry I forgot to add something and now edited my question: I am trying to edit resolv.conf existing on my beaglebone which is operating angstrom. – Amadeus Bachmann Jun 12 '12 at 8:41
up vote 2 down vote accepted

From vim documentation:

If you make changes to a file and forgot that it was read-only, you can still write it. Add the ! to the write command to force writing.

If you really want to forbid making changes in a file, do this:

vim -M file

Now every attempt to change the text will fail. The help files are like this, for example. If you try to make a change you get this error message:

E21: Cannot make changes, 'modifiable' is off 

You could use the -M argument to setup Vim to work in a viewer mode. This is only voluntary though, since these commands will remove the protection:

:set modifiable
:set write
share|improve this answer
This will only work if vim is actually capable of writing the file. If vim opens a file as a regular user that can only be changed as root, then vim will not be able to save the changes to the file. – Eliah Kagan Jun 12 '12 at 8:32
Try with chmod 777 /etc/resolv.conf but don't forget to set it back! – jasmines Jun 12 '12 at 8:43
It's preferable to run vim as root (sudo vim ...)--that way, the file is never changeable by any unauthorized user or process, and you don't have to change permissions. – Eliah Kagan Jun 12 '12 at 8:44

/etc/resolv.conf is owned by root, so you must edit it as root (using sudo):

sudo vim /etc/resolv.conf

You might want to back it up first though:

sudo cp /etc/resolv.conf /etc/resolv.conf.old

If you prefer to edit it graphically, then instead of using vim, you can use:

gksu gedit /etc/resolv.conf

Or on Kubuntu:

kdesudo kate /etc/resolv.conf

If you changed /etc/resolv.conf's permissions, you should change them back, as the default permissions prevent unauthorized access while allowing authorized access as explained above.

However, it's likely you didn't really change any permissions, since by default (at least on Ubuntu 12.04 LTS) /etc/resolv.conf is actually a symbolic link to /run/resolvconf/resolv.conf.

share|improve this answer
Thank you for your help. But I caused a misunderstanding because of the reason that I forgot to add that I am trying to edit resolv.conf file on my beaglebone which is operating angstrom. Again, sorry for the inconvenience. If you still have an idea and share with me, I will be appreciate to you. – Amadeus Bachmann Jun 12 '12 at 8:45
@Zxy You can run vim /etc/resolv.conf. So you should be able to run sudo vim /etc/resolv.conf. That is, if you're using Ubuntu. If you're using another distro, like the Ångström distribution, then your questions is off-topic for AskUbuntu and you should ask it at Unix.SE instead. – Eliah Kagan Jun 12 '12 at 8:47
thank you for your help! – Amadeus Bachmann Jun 12 '12 at 8:52

(Disclaimer: this is based on Internet research, not on actual hands-on experience with the board.)

According to this article,

Ångström Linux distribution [...] is included in the microSD card packaged with each Beaglebone.

Without citing the whole article (it seems to be very well written, btw.) you need to:

  1. SSH into your Beagleboard as root.
  2. Edit /etc/network/interfaces.
  3. Add dns-nameservers
  4. Run /etc/init.d/networking restart

If your settings seem to work, but go away after a reboot, read this article on setting up Connman.

You'll need to install the connman-tests package to enable command-line configuration of Connman, and set the nameservers by following the instructions.


./set-nameservers ethernet_405fc276b749_cable
share|improve this answer

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

gksudo gedit /etc/resolv.conf

That will let you modify the file and save it.

You can try:

opkg update
opkg install gedit 
share|improve this answer
currently I am not able to connect to net because of my dns options. therefore I cannot use opkg install gedit. however thanks for your advice! – Amadeus Bachmann Jun 12 '12 at 9:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.