[Solved] su: cannot set user id: Resource temporarily unavailable

OpenVZ is a container based virtualization technique for Linux. OpenVZ creates multiple secure, isolated Linux containers (otherwise known as VEs or VPSs) on a single physical server. Each container performs and executes exactly like a stand-alone server; a container can be rebooted independently and have root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files.

We already discussed about the basic command line operation for an OpenVZ node. Please see the documentation >> 15+ Commonly using OpenVZ commands and its usages << for more details. Here I am listing some useful OpenVz commands with example.

Here I explain a fix for the error “Resource temporarily unavailable” while switching user in OpenVZ based servers.

Error details

# su -
su: cannot set user id: Resource temporarily unavailable


Edit (add) or change the following values in /etc/security/limits.conf

# vi /etc/security/limits.conf
*          soft     nproc          2047
*          hard     nproc          16384
*          soft     nofile         1024
*          hard     nofile         65536

It should be okay now!

Please try to switch now and let me know if you have any questions.

Also read:

1, 10+ Commonly using OpenVZ commands and its usages
2, How to Enable/Check TUN/TAP module in VPS(OpenVZ)

Arunlal Ashok

Sr. Linux Server Administrator. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Check My Profile in uPwork (oDesk) and create a job, if you need any administration help. Thanks!!

You may also like...

11 Responses

  1. Joe says:

    Nice and to the point…

    Thank you.

  2. Dean says:

    # su –
    su: cannot set user id: Resource temporarily unavailable OR it continues to ask for password (even though I’m putting it in correctly)
    # sudo su –
    RESPONSE: sudo: PERM_ROOT: setresuid(0, -1, -1): too many processes

    The issue was resolved by editing the /etc/security/limits.d/90-nproc.conf file to allow root more open files. After that, sysctl -p /etc/sysctl.conf was used to make it take effect.

  3. Ahmed says:

    Thanks, this worked and solved my problem

  4. Tushar Tarkas says:

    I’m facing the same problem. Since I cant sudo into the system, I cant open the files mentioned in the solution above in write mode and hence cant save the changes. Anything that I’m missing.

  5. Jiju George says:

    Great, working fine..

  6. Jorge says:

    What exactly are you doing when you add those lines?

    Is it safe? Im reseller.

Leave a Reply

Your email address will not be published. Required fields are marked *