自学内容网 自学内容网

设置cockpit自启动

设置cockpit自启动

cockpit

设置 cockpit 自启动 遇到如下报错:

The unit files have no installation config (WantedBy=, RequiredBy=, UpheldBy=,
Also=, or Alias= settings in the [Install] section, and DefaultInstance= for
template units). This means they are not meant to be enabled or disabled using systemctl.
 
Possible reasons for having these kinds of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/, .requires/, or .upholds/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

设置cockpit自启动

根据提示服务的unit文件中’[Install]‘单元部分找不到’WantedBy=, RequiredBy=, Also=, Alias=‘的相关设置,
所以不能使用systemctl来配置自启动,
修改文件 /usr/lib/systemd/system/cockpit.service
末尾添加内容如下:

[Install]
WantedBy=multi-user.target

完整内容如下:

[Unit]
Description=Cockpit Web Service
Documentation=man:cockpit-ws(8)
Requires=cockpit.socket
Requires=cockpit-wsinstance-http.socket cockpit-wsinstance-https-factory.socket
After=cockpit-wsinstance-http.socket cockpit-wsinstance-https-factory.socket

[Service]
RuntimeDirectory=cockpit/tls
# systemd ≥ 241 sets this automatically
Environment=RUNTIME_DIRECTORY=/run/cockpit/tls
ExecStartPre=+/usr/libexec/cockpit-certificate-ensure --for-cockpit-tls
ExecStart=/usr/libexec/cockpit-tls
User=cockpit-ws
Group=cockpit-ws
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
ProtectKernelTunables=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target

修改 /usr/lib/systemd/system/cockpit.service 文件后,设置cockpit自启动

systemctl enable cockpit

设置cockpit自启动


原文地址:https://blog.csdn.net/qq_24330181/article/details/140651776

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!