Loading... # 問題(一) 有时候安装宝塔时,会出现提示: ``` E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 4064 (apt-get) N: Be aware that removing the lock file is not a solution and may break your system. E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? ``` 然后进入宝塔发现防火墙根本无法使用 ## 最佳解决方案 经过本博主的几天研究,找到了最佳解决方案 再用安装脚本安装一次便可!!! 不是修复、也不是更新脚本!!! 也就是安装两遍,第二遍将不会有报错现象!!! 同时相比于下方的解决方案来说,目前没有发现隐性问题,同时也能解决 **描述(二)**中的问题 ## 解决方案 一 首先,用如下命令来检查下系统上是否已经安装了 **UFW** 。 ``` $ sudo dpkg --get-selections | grep ufw ``` 如还没有安装,可以使用 **apt** 命令来安装,如下所示: ``` $ sudo apt-get install ufw ``` 在使用前,你应该检查下 **UFW** 是否已经在运行。用下面的命令来检查。 ``` $ sudo ufw status ``` 如果你发现状态是: **inactive** , 意思是没有被激活或不起作用。 此时进入系统防火墙,会发现防火墙已处于关闭状态,重新将其打开即可,同时也会自动添加部分规则进去 之后防火墙就可以正常使用了 如果在启用防火墙时提示 `指定模块不存在`,则在面板首页点击 `修复`,在重新启用即可! # 問題(二) 通过解决方案一导致的问题:点击查看端口描述是空白的... ## 解决方案一 ToDoList...... 至于有没有其他功能异常,等我找到再说吧...... # 問題(三) debian12安裝宝塔 fail2ban 后无法启动,也没有任何报错 ## 解决方案(一) 控制台输入`systemctl status fail2ban`: ``` × fail2ban.service - Fail2Ban Service Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Tue 2024-09-03 01:49:44 EDT; 11s ago Duration: 176ms Docs: man:fail2ban(1) Process: 315952 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS) Process: 315953 ExecStart=/www/server/panel/pyenv/bin/fail2ban-server -xf start (code=exited, status=255/EXCEPTION) Main PID: 315953 (code=exited, status=255/EXCEPTION) CPU: 171ms Sep 03 01:49:44 cloud systemd[1]: Starting fail2ban.service - Fail2Ban Service... Sep 03 01:49:44 cloud systemd[1]: Started fail2ban.service - Fail2Ban Service. Sep 03 01:49:44 cloud fail2ban-server[315953]: 2024-09-03 01:49:44,791 fail2ban.configreader [315953]: WARNING 'allowipv6' not defined in 'Definition'. Using default one: 'auto' Sep 03 01:49:44 cloud fail2ban-server[315953]: 2024-09-03 01:49:44,822 fail2ban [315953]: ERROR Failed during configuration: Have not found any log file for sshd jail Sep 03 01:49:44 cloud fail2ban-server[315953]: 2024-09-03 01:49:44,829 fail2ban [315953]: ERROR Async configuration of server failed Sep 03 01:49:44 cloud systemd[1]: fail2ban.service: Main process exited, code=exited, status=255/EXCEPTION Sep 03 01:49:44 cloud systemd[1]: fail2ban.service: Failed with result 'exit-code'. ``` 如果出现上述的报错内容,请继续下方的修复步骤,如果不是,请另寻高就: 修改`jail.local`文件,如果没有这个文件的话,请另寻高就: ``` nano /etc/fail2ban/jail.local ``` 在`enabled=true`上方添加`backend=systemd`并保存文件: ``` [sshd] backend=systemd enabled = true port = ssh filter = sshd logpath = /var/log/auth.log maxretry = 3 ``` 返回终端输入: ``` apt install python3-systemd ``` 最后重启`fail2ban` ``` systemctl restart fail2ban ``` 前往宝塔查看fail2ban插件的运行状态,此时应该是 **开启** 状态 最后修改:2024 年 09 月 03 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏