I am on Ubuntu 18.04
Trying to modify max number of processes (hard limit) via the following command, and getting the respective error:
$ ulimit -H -u 500
bash: ulimit: max user processes: cannot modify limit: Invalid argument
In the mean time ...
$ ulimit -Hu
46955
Any idea why?
You have to lower the soft limit before you can lower the hard limit.
You can see the differences between them using the relevant flags. For example:
Here, my hard limit and soft limit are the same. If I attempt to lower my soft limit, it succeeds:
But if I try to lower my hard limit below the soft limit, it fails:
So, I first need to lower my soft limit so that I can set the new hard limit: