[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 -
Password: 
su: cannot set user id: Resource temporarily unavailable

Solution

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)

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

12 thoughts on “[Solved] su: cannot set user id: Resource temporarily unavailable

  1. # su –
    Password:
    su: cannot set user id: Resource temporarily unavailable OR it continues to ask for password (even though I’m putting it in correctly)
    OR
    # 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.

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

Leave a Reply

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