I can't set the overcommit_memory from inside the shell:

root@ubuntu:~# /proc/sys/vm/overcommit_memory = 1
-bash: /proc/sys/vm/overcommit_memory: Permission denied

Also I tried putting that line in /etc/sysctl.conf and rebooting the vm but it's not working.

Someone have some clues? I couldn't find anything searching in google.

link|improve this question
What are you expecting to happen differently that is not? I suspect this setting is not what you think it is. – Jeff Snider Nov 8 '09 at 23:51
thank you for the edit Iain! lol – makevoid Nov 5 '11 at 3:09
feedback

migrated from stackoverflow.com Nov 8 '09 at 20:55

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 3 down vote accepted

Settings in /proc/sys are virtual files. To change them, you need to write to them like you would any other file, like so:

echo 1 >/proc/sys/vm/overcommit_memory

The command you tried is to run /proc/sys/vm/overcommit_memory as an executable, which of course is impossible. The "Permission denied" you're getting is because that file is not set as executable, not because you can't change it.

You can see the current setting by reading the file:

cat /proc/sys/vm/overcommit_memory
link|improve this answer
feedback

Thank you jeff, i tried:

echo 1 > /proc/sys/vm/overcommit_memory

but:

-bash: echo: write error: Operation not permitted

the problem was that the ability to write the file was 'locked' by the VM server so I had to ask the sysadmin to enable it

on an unix box at home where i installed VMWare server i tried it and it worked either mine and your solution.

link|improve this answer
feedback

firts you should use command: cat /proc/mounts. If mount point /proc mounted with read only mode then you must remount it. you try remount with command: mount -o remount,rw /proc. Affer remount, you try use echo command again.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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