vote up 0 vote down star

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 nothing searching in google.

Thank you!

flag
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 at 23:51

migrated from stackoverflow.com

2 Answers

vote up 2 vote down

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|flag
vote up 0 vote down

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|flag

Your Answer

Get an OpenID
or
never shown

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