设置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自启动

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李昊哲小课

桃李不言下自成蹊

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值