centos设置服务开机启动失败问题

1、安装某服务设置开机启动的时候报错

[root@node1 ~]# systemctl enable lvm2-lvmetad.service
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).

2、添加配置

vim /usr/lib/systemd/system/lvm2-lvmetad.service 

在最后添加如下内容:

[Install]
WantedBy=multi-user.target
重新设置开机启动
原文地址:https://www.cnblogs.com/jinyuanliu/p/10384802.html