[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. 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!

Also read:

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

Arunlal Ashok

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 let me know if you need any assistance. Thanks!!

You may also like...

9 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..

Leave a Reply

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