重庆思庄Oracle、Redhat认证学习论坛

标题: Ubuntu 18.04 ubuntu用户无法连接或连接异常fork rejected by pids controller [打印本页]

作者: mahan    时间: 2024-9-29 14:53
标题: Ubuntu 18.04 ubuntu用户无法连接或连接异常fork rejected by pids controller
vim /var/log/kern.log
Jun 17 15:58:39 xxx-test kernel: [18331086.218947] cgroup: fork rejected by pids controller in /user.slice/user-1
000.slice/session-32191.scope

vim /var/log/syslog
Jun 17 15:13:09 xxx-test systemd[1]: Started Session 32154 of user ubuntu.
Jun 17 15:13:09 xxx-test kernel: [18328355.716497] cgroup: fork rejected by pids controller in /user.slice/user-1
000.slice/session-32154.scope

user-1000对应的用户是ubuntu

查看ubuntu用户的状态
root@xxx-test:~# systemctl status user-1000.slice
● user-1000.slice - User Slice of ubuntu
   Loaded: loaded (/run/systemd/transient/user-1000.slice; transient)
Transient: yes
   Active: active since Fri 2022-06-17 17:04:36 CST; 1s ago
    Tasks: 2 (limit: 10813)
   CGroup: /user.slice/user-1000.slice
           └─user@1000.service
             └─init.scope
               ├─22238 /lib/systemd/systemd --user
               └─22240 (sd-pam)


查看所有用户的状态
systemctl status user.slice
user.slice - User and Session Slice
   Loaded: loaded (/lib/systemd/system/user.slice; static; vendor preset: enabled)
   Active: active since Wed 2021-11-17 12:03:15 CST; 6 months 29 days ago
     Docs: man:systemd.special(7)
   CGroup: /user.slice
           ├─user-0.slice
           │ ├─session-30921.scope
           │ │ └─5065 /usr/lib/jvm/java-8-oracle/bin/java -Dsun.misc.URLClassPath.disableJarChecking=true -Xmx256M -Dl
           │ ├─session-31234.scope
           │ │ ├─10608 /usr/lib/jvm/java-8-oracle/bin/java -Dsun.misc.URLClassPath.disableJarChecking=true -Xmx1024M -
           │ │ ├─10710 /bin/login -p --
           │ │ └─10898 -bash
           │ ├─session-31340.scope
           │ │ └─31850 /usr/lib/jvm/java-8-oracle/bin/java -Dsun.misc.URLClassPath.disableJarChecking=true -Xmx512M -D
           │ ├─session-32159.scope
           │ │ ├─28033 sshd: root@pts/0
           │ │ └─28225 -bash
           │ ├─session-32184.scope
           │ │ ├─30296 sshd: root@pts/4
           │ │ └─30406 -bash
           │ ├─session-32186.scope
           │ │ ├─ 377 /usr/lib/jvm/java-8-oracle/bin/java -Dsun.misc.URLClassPath.disableJarChecking=true -Xmx512M -Dl
           │ │ └─4722 /usr/lib/jvm/java-8-oracle/bin/java -Dsun.misc.URLClassPath.disableJarChecking=true -Xms512M -Xm
           │ ├─session-32215.scope
           │ │ ├─20911 sshd: root@pts/8
           │ │ └─21008 -bash
           │ ├─session-32216.scope
           │ │ ├─21219 sshd: root@pts/6
           │ │ ├─21335 -bash
           │ │ ├─26943 systemctl status user.slice
           │ │ └─26944 pager
           │ ├─session-32226.scope
           │ │ ├─23708 sshd: root@pts/7
           │ │ ├─23794 bash --rcfile /dev/fd/63
           │ │ └─24046 tail -1000f /data/smartops/log/cmp.log
           │ └─user@0.service
           │   └─init.scope
           │     ├─23113 /lib/systemd/systemd --user
           │     └─23115 (sd-pam)
           └─user-1000.slice
             ├─session-32232.scope
             │ ├─26181 sshd: ubuntu [priv]
             │ ├─26272 sshd: ubuntu@pts/1
             │ └─26273 -bash
             └─user@1000.service
               └─init.scope

修改ubuntu用户的Tasks limit
root@xxx-test:~# find / -name "user-1000.slice"            
/sys/fs/cgroup/pids/user.slice/user-1000.slice
/sys/fs/cgroup/cpu,cpuacct/user.slice/user-1000.slice
/sys/fs/cgroup/systemd/user.slice/user-1000.slice
/sys/fs/cgroup/unified/user.slice/user-1000.slice
/run/systemd/transient/user-1000.slice

修改ubuntu用户的TasksMax
root@xxx-test:~# cat /run/systemd/transient/user-1000.slice
# This is a transient unit file, created programmatically via the systemd API. Do not edit.
[Unit]
Description=User Slice of ubuntu
After=systemd-logind.service
After=systemd-user-sessions.service

[Slice]
TasksMax=10813 #修改为infinity

systemctl daemon-reload
systemctl restart user-1000.slice

修改后查看
root@xxx-test:~# systemctl status user-1000.slice         
● user-1000.slice - User Slice of ubuntu
   Loaded: loaded (/run/systemd/transient/user-1000.slice; transient)
Transient: yes
   Active: active since Fri 2022-06-17 17:34:31 CST; 34min ago
   CGroup: /user.slice/user-1000.slice
           ├─session-32232.scope
           │ ├─26181 sshd: ubuntu [priv]
           │ ├─26272 sshd: ubuntu@pts/1
           │ └─26273 -bash
           └─user@1000.service
             └─init.scope
               ├─26183 /lib/systemd/systemd --user
               └─26184 (sd-pam)






欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2