You are not logged in.

#1 2020-06-06 18:23:57

DAMO238
Member
Registered: 2020-02-25
Posts: 51

[SOLVED] Unable to raise process limit for i3

I have set process limits to 1000(soft) and 2000(hard) for every user to avoid someone forkbombing my system. The problem arises when I need more than 1000 processes, which happens more often than you might think. Now, I have read the relevant section on the security page on the wiki, and it says that I need to use prlimit to raise my soft limit for a session. After reading the man page, I run

prlimit --nproc=1500

, and then it returns without errors, but the soft limit has not been raised. I then tried searching around, and found that

ulimit -u 1500

does the trick. So I tried it and it did work, but only within the terminal, which means nothing because the terminal is a child of my login session, so I only have 1000-<other active processes> left to use. How can I raise this limit for my login session?

Last edited by DAMO238 (2020-06-07 13:12:59)

Offline

#2 2020-06-06 18:30:32

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] Unable to raise process limit for i3

prlimit --nproc=1500

You did not specify a process to adjust the limit on so it applied to the current process.  That would be the prlimit command itself not its parent process the shell or the session leader?

Last edited by loqs (2020-06-06 18:32:37)

Offline

#3 2020-06-06 18:51:46

DAMO238
Member
Registered: 2020-02-25
Posts: 51

Re: [SOLVED] Unable to raise process limit for i3

I have just found out that prlimit requires the pid of the process to set limits on. So I get the PID of i3 and use that, but the limit is still not set, as I cannot go over it. I then listed every single process that is running under my user and tried to set some limits on them. I found that I needed to use the pid of "/usr/lib/systemd/systemd --user". I will edit the wiki page to aid people that need to raise this limit.

Offline

#4 2020-06-06 19:00:26

DAMO238
Member
Registered: 2020-02-25
Posts: 51

Re: [SOLVED] Unable to raise process limit for i3

Ok, I thought I had solved it, but after logging in and out, I don't know which processes need their limits increased.

Offline

#5 2020-06-06 19:17:39

DAMO238
Member
Registered: 2020-02-25
Posts: 51

Re: [SOLVED] Unable to raise process limit for i3

I have a temporary solution, set all my processes to have that limit. It works for now, but it is ugly as hell:

ps --no-headers -u damien -O user | sed '/ps --no-headers -u damien -O user/d' | awk '{ system("prlimit --pid=" $1 " --nproc=2000") }'

Offline

#6 2020-06-06 19:18:47

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [SOLVED] Unable to raise process limit for i3

DAMO238, please stop serial posting (posting several times in a row if no one has replied) -- instead, edit your post to include more information as necessary.

Offline

#7 2020-06-06 19:35:10

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,796

Re: [SOLVED] Unable to raise process limit for i3

pgrep -U damien systemd # that's gonna be the systemd --user process
pgrep -U damien # all your processes

No idea whether systemd/loginctl exposes the PID of the session process somewhere.

Though I'm not sure what the point of all of this is: you're setting a limit to prevent fork bombs and then raise it because it's too restricting. Just raise the initial soft limit to 2000…?

Offline

#8 2020-06-07 13:11:35

DAMO238
Member
Registered: 2020-02-25
Posts: 51

Re: [SOLVED] Unable to raise process limit for i3

2ManyDogs wrote:

DAMO238, please stop serial posting (posting several times in a row if no one has replied) -- instead, edit your post to include more information as necessary.

Apologies for that, I will keep that in mind for the future.

seth wrote:
pgrep -U damien systemd # that's gonna be the systemd --user process
pgrep -U damien # all your processes

No idea whether systemd/loginctl exposes the PID of the session process somewhere.

Though I'm not sure what the point of all of this is: you're setting a limit to prevent fork bombs and then raise it because it's too restricting. Just raise the initial soft limit to 2000…?

pgrep looks like what I need, thank you.

Offline

Board footer

Powered by FluxBB