systemctl enable 报错问题

淩亂°似流年 2022-11-04 12:27 114阅读 0赞
  1. The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
  2. settings in the [Install] section, and DefaultInstance for template units).
  3. This means they are not meant to be enabled using systemctl.
  4. Possible reasons for having this kind of units are:
  5. 1) A unit may be statically enabled by being symlinked from another unit's
  6. .wants/ or .requires/ directory.
  7. 2) A unit's purpose may be to act as a helper for some other unit which has
  8. a requirement dependency on it.
  9. 3) A unit may be started when needed via activation (socket, path, timer,
  10. D-Bus, udev, scripted systemctl call, ...).
  11. 4) In case of template units, the unit is meant to be enabled with some
  12. instance name specified.

解决:
systemd 默认读取 /etc/systemd/system 下的配置文件,该目录下的文件会链接/lib/systemd/system/下的文件
打开脚本/lib/systemd/system/rc.local.service 添加末尾几行

  1. [Unit]
  2. Description=/etc/rc.local Compatibility
  3. Documentation=man:systemd-rc-local-generator(8)
  4. ConditionFileIsExecutable=/etc/rc.local
  5. After=network.target
  6. [Service]
  7. Type=forking
  8. ExecStart=/etc/rc.local start
  9. TimeoutSec=0
  10. RemainAfterExit=yes
  11. GuessMainPID=no
  12. #这里为需要添加的部分
  13. [Install]
  14. WantedBy=multi-user.target
  15. elias=rc-local.service

发表评论

表情:
评论列表 (有 0 条评论,114人围观)

还没有评论,来说两句吧...

相关阅读