Server Fault is a question and answer site for system and network administrators. 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

Im trying adding swap file by following this guide:

Everything is fine, but starting swapon /swapfile, I got this message:
swapon: /swapfile: Operation not permitted

Use sudo swapon /swapfile also not works, and I got this message:
audit_log_user_command(): Connection refused
swapon: /swapfile: Operation not permitted

After reboot, I use the same command.. also not works

share|improve this question

This sounds like you are on a virtualized host based on openvz.

The "audit_log_user_command" error is common from a few version of openvz/virtuozzo that didn't patch a kernel bug that echo'd that out to the screen.

In this case, you cannot create swap, you are only allocated a certain amount of system memory. After you exceed this, you will be unable to allocate memory and get OOM kills depending on how frequently you attempt to spawn new processes near the barrier.

share|improve this answer
Im in VPS hosting, but not sure if it was openvz. Is it impossible to use swap in virtualized host based on openvz? – Faris Jan 30 '10 at 2:38
That's right Faris, openvz doesn't let you use swap at all, it just gives you chunks of ram to use. You an think of an openvz VPS as a "super" chroot, you don't actually have a virtualized operating system, just most of the userspace processes you need to run pretty much the same thing. – epic9x Feb 1 '10 at 18:13
Also, if you want to be sure you're in openvz, you can always check for the existance of a file /proc/user_beancounters, if that's there you're very likely on openvz/virtuozzo. – epic9x Feb 1 '10 at 23:56

Wow. . .this had me stumped for awhile too.

I guess I found the answer is that you can't create swapfiles in a OpenVZ/Virtuozzo environment, since it uses swap inherently.

share|improve this answer

Your Answer


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