(CentOS) Adding swap file failed

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.


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.