服务器重启后1panel无法打开面板,尝试设置服务自启失败

服务器重启后1panel无法打开面板,排查后可能是1panel服务没成功启动,但是ssh终端命令排查1panel服务是正常启动的,但是面板无法打开,排查端口开放正常,ssh终端重启1panel服务后面板可登录,尝试排查1panel服务是否开机自启时,查找命令失败,尝试设置失败。以下是命令输出结果

Authentication is required to start ‘1Panel.service’.
Authenticating as: pyjiang
Password:
==== AUTHENTICATION COMPLETE ===
Failed to start 1Panel.service: Unit 1Panel.service not found.
pyjiang@ubuntu:~$ sudo ufw status
Status: active

To Action From


22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
37945/tcp ALLOW Anywhere
39000:40000/tcp ALLOW Anywhere
31508/tcp ALLOW Anywhere
20/tcp DENY Anywhere
21/tcp DENY Anywhere
888/tcp DENY Anywhere
8080/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
37945/tcp (v6) ALLOW Anywhere (v6)
39000:40000/tcp (v6) ALLOW Anywhere (v6)
31508/tcp (v6) ALLOW Anywhere (v6)
20/tcp (v6) DENY Anywhere (v6)
21/tcp (v6) DENY Anywhere (v6)
888/tcp (v6) DENY Anywhere (v6)
8080/tcp (v6) ALLOW Anywhere (v6)

pyjiang@ubuntu:~$ sudo ufw reload
Firewall reloaded
pyjiang@ubuntu:~$ sudo systemctl status 1Panel
Unit 1Panel.service could not be found.
pyjiang@ubuntu:~$ sudo systemctl start 1Panel
Failed to start 1Panel.service: Unit 1Panel.service not found.
pyjiang@ubuntu:~$ sudo journalctl -u 1Panel
– No entries –
pyjiang@ubuntu:~$ sudo ss -tuln | grep 31508
pyjiang@ubuntu:~$ ls -l /path/to/1Panel
ls: cannot access ‘/path/to/1Panel’: No such file or directory
pyjiang@ubuntu:~$ ls /etc/systemd/system/ | grep 1Panel
pyjiang@ubuntu:~$ sudo ls /etc/systemd/system/ | grep 1Panel
pyjiang@ubuntu:~$ sudo nano /etc/systemd/system/1Panel.service
pyjiang@ubuntu:~$ 1pctl status
● 1panel.service - 1Panel, a modern open source linux panel
Loaded: loaded (/etc/systemd/system/1panel.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2024-04-06 11:20:42 UTC; 3h 57min ago
Main PID: 891 (1panel)
Tasks: 20 (limit: 38170)
Memory: 106.9M
CPU: 2.179s
CGroup: /system.slice/1panel.service
└─891 /usr/bin/1panel

4月 06 11:20:42 ubuntu systemd[1]: Started 1Panel, a modern open source linux panel.
4月 06 11:20:42 ubuntu 1panel[891]: [2024-04-06 11:20:42] [INFO] init logger successfully
4月 06 11:20:42 ubuntu 1panel[891]: [2024-04-06 11:20:42] [INFO] init db successfully
4月 06 11:20:42 ubuntu 1panel[891]: [2024-04-06 11:20:42] [INFO] Migration run successfully
pyjiang@ubuntu:~$ 1pctl restart
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart ‘1panel.service’.
Authenticating as: pyjiang
Password:
==== AUTHENTICATION COMPLETE ===
● 1panel.service - 1Panel, a modern open source linux panel
Loaded: loaded (/etc/systemd/system/1panel.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2024-04-06 15:19:59 UTC; 9ms ago
Main PID: 19588 (1panel)
Tasks: 5 (limit: 38170)
Memory: 2.7M
CPU: 8ms
CGroup: /system.slice/1panel.service
└─19588 /usr/bin/1panel

4月 06 15:19:59 ubuntu systemd[1]: Started 1Panel, a modern open source linux panel.
pyjiang@ubuntu:~$ sudo systemctl is-enabled 1Panel.service
[sudo] password for pyjiang:
Failed to get unit file state for 1Panel.service: No such file or directory
pyjiang@ubuntu:~$ sudo ls /etc/systemd/system/ | grep 1Panel
pyjiang@ubuntu:~$ sudo systemctl enable 1Panel.service
Failed to enable unit: Unit file 1Panel.service does not exist.

1pctl status 命令查看 1Panel 状态已经是 running 状态。
还有,你是非 root 账号登录的服务器,执行命令需要 sudo 权限,比如:sudo 1pctl restart

你目前先自行排查一下 1Panel 端口是不是通的

上诉有一部分代码没看到,我有sudo代码查看了,端口全开放,最后排查的结果是1panel服务没启动,但是命令查看1panel服务又是开启的,然后还需要用1pctl start命令,然后才能访问,再次重启服务器,然后发现确实是去过问题,然后想排查1panel的开机自启状态,无法查询到这个服务的状态,也无法设置开机自启加sudo或者切换root用户也没用,请教大佬这是我1panel面板安装错误导致吗,还是什么问题,但是用命令查看1panel的状态,显示又是全OK的,另外一个就是halo也无法通过IP+端口访问面板,重装服务也一样,查看IP端口也是全通的,我的主机是在局域网下的,服务器也是

我也是这个问题,开机1panel服务是开启的,但是需要手动输入1pctl start 才能正常访问面板,请问这个问题你解决了吗?

我每次重启服务器都要手动启动一次1panel,你解决了没。

俺也一样,怎么办

还没解决吗

同。debian12 lxc
···shell
13 10:14:51 DEBIAN12 1panel[192]: [GIN-debug] POST /api/v1/alerts/logs/sync → github*com/1Panel-dev/1Panel/backend/xpack/app/api/v1.(XpackApi).SyncSmsInfo-fm (12 handlers)
13 10:14:51 DEBIAN12 1panel[192]: [GIN-debug] POST /api/v1/alerts/logs/clean → github
com/1Panel-dev/1Panel/backend/xpack/app/api/v1.(XpackApi).CleanAlertLogs-fm (12 handlers)
13 10:14:51 DEBIAN12 1panel[192]: [GIN-debug] POST /api/v1/alerts/logs/sync/all → github
com/1Panel-dev/1Panel/backend/xpack/app/api/v1.(XpackApi).SyncSmsAll-fm (12 handlers)
13 10:14:51 DEBIAN12 1panel[192]: [GIN-debug] GET /api/v1/alerts/clams/list → github
com/1Panel-dev/1Panel/backend/xpack/app/api/v1.(XpackApi).GetClams-fm (12 handlers)
13 10:14:51 DEBIAN12 1panel[192]: [GIN-debug] POST /api/v1/alerts/cronjob/list → github
com/1Panel-dev/1Panel/backend/xpack/app/api/v1.(XpackApi).GetCronJobs-fm (12 handlers)
13 10:14:51 DEBIAN12 1panel[192]: [GIN-debug] POST /api/v1/alerts/sms → github
com/1Panel-dev/1Panel/backend/xpack/app/api/v1.(*XpackApi).SyncSmsCount-fm (12 handlers)
13 10:14:52 DEBIAN12 1panel[192]: [2024-11-13 10:14:52] [INFO] listen at https://[::]:8080 [tcp]
13 10:14:52 DEBIAN12 1panel[192]: [2024-11-13 10:14:52] [INFO] Starting synchronization with App Store…
13 10:15:07 DEBIAN12 1panel[192]: [2024-11-13 10:15:07] [ERROR] load remote time with [pool.ntp.org] failed, err: failed to connect: dial udp: lookup pool.ntp.org on 8.8.8.8:53: read udp 192.168.100.100:60984->8.8.8.8:53: i/o>
13 10:15:12 DEBIAN12 1panel[192]: [2024-11-13 10:15:12] [ERROR] App Store synchronization failed


同样是经常在重新开机后无法访问,报错也就商店同步失败?手动敲命令后才正常。1panel是运行状态,docker也在运行。

尝试一下这种解决方案x

尝试下,这是官方给我的,但是我的机子已经拆了换设备了,希望新设备不会出现这种问题了吧,你可以试试能不能行的通
sudo vim /etc/systemd/system/1panel.service

修改

[Service]
ExecStartPre=/bin/sleep 10

你可以看一下其他的回复,有解决方案了,但是我机子拆了换设备了。

这个是1P专业版特有的问题,社区版的时候没出现过这个问题


我是给docker设置成了ExecStart=/usr/bin/dockerd 就会出现1panel 在运行但是外部无法访问的情况。

若修改为```
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

就可以正常开机自启。


我设置这个的原因是我要使用 Uptime Kuma 监控,使用/var/run/docker.sock 的方式无法连接
![image|565x500](upload://dyO04qDqm3qVmfVgpffD4xdfzUp.png)