前言
环境:组装台式机Ubuntu20.04 TLS 64
位系统
系统登陆不进行,查看相关日志报错为:
vim /var/log/syslog
日志:
Feb 27 23:40:18 i75930 systemd[1]: Created slice User Slice of UID 125.
Feb 27 23:40:18 i75930 systemd[1]: Starting User Runtime Directory /run/user/125...
Feb 27 23:40:18 i75930 systemd-logind[1252]: New session c1 of user gdm.
Feb 27 23:40:18 i75930 systemd[1]: Finished User Runtime Directory /run/user/125.
Feb 27 23:40:18 i75930 systemd[1]: Starting User Manager for UID 125...
Feb 27 23:40:18 i75930 systemd[1488]: pam_limits(systemd-user:session): cannot read settings from /etc/security/limits.d/clickhouse.conf: No such file or directory
Feb 27 23:40:18 i75930 systemd[1488]: pam_limits(systemd-user:session): error parsing the configuration file: 'pam_limits(systemd-user:session):'
Feb 27 23:40:18 i75930 systemd[1488]: PAM failed: Error in service module
Feb 27 23:40:18 i75930 systemd[1488]: pam_unix(systemd-user:session): session opened for user gdm by (uid=0)
Feb 27 23:40:18 i75930 systemd[1488]: user@125.service: Failed to set up PAM session: Operation not permitted
Feb 27 23:40:18 i75930 systemd[1488]: user@125.service: Failed at step PAM spawning /lib/systemd/systemd: Operation not permitted
Feb 27 23:40:18 i75930 systemd[1]: user@125.service: Main process exited, code=exited, status=224/PAM
Feb 27 23:40:18 i75930 systemd[1]: user@125.service: Failed with result 'exit-code'.
Feb 27 23:40:18 i75930 systemd[1]: Failed to start User Manager for UID 125.
解决
linux下pam模块是进行用户认证管理的,系统开机后,用户登陆之前先配置好用户session
即能我多少个终端同时连接,密码强度怎样,是否过期,哪些用户可以登陆图片界面等等
看报错我们可以知道pam启动失败是由pam_limits下一个文件没有找到引起的:
pam_limits(systemd-user:session): cannot read settings from /etc/security/limits.d/clickhouse.conf: No such file or directory
进入这个目录,发现它是一个软链接,但是它所指向的软链接根本不存在
把这个软链接删了,然后重启服务器问题解决
i75930# cd /etc/security/limits.d/
i75930# ll
lrwxrwxrwx root root 55 Feb 16 10:55 clickhouse.conf -> /opt/workspace/github/myconf/clickhouse/clickhouse.conf
i75930# cat clickhouse.conf
cat: clickhouse.conf: No such file or directory
i75930# cd /opt/workspace/github/myconf
total 48
drwxr-xr-x 3 wedo wedo 4.0K Feb 21 21:09 emacs
drwxr-xr-x 2 wedo wedo 4.0K Feb 21 21:09 for_test
drwxr-xr-x 6 wedo wedo 4.0K Feb 21 21:09 IntelliJ
drwxr-xr-x 3 wedo wedo 4.0K Feb 28 18:54 linux
drwxr-xr-x 4 wedo wedo 4.0K Feb 21 21:09 maven
drwxr-xr-x 6 wedo wedo 4.0K Feb 21 21:09 Notepad++
-rw-r--r-- 1 wedo wedo 401 Feb 21 21:09 README.org
drwxr-xr-x 3 wedo wedo 4.0K Feb 21 21:09 shell
drwxr-xr-x 2 wedo wedo 4.0K Feb 21 21:09 spacemacs
drwxr-xr-x 4 wedo wedo 4.0K Feb 21 21:09 VanDyke
drwxr-xr-x 5 wedo wedo 4.0K Feb 21 21:09 vim
drwxr-xr-x 3 wedo wedo 4.0K Feb 21 21:09 yong
drwxr-xr-x 2 wedo wedo 4.0K Feb 21 21:09 zsh