/*******************************************************************************
* systemctl enable rc-local.service error
* 说明:
* 在YOCTO中使能rc.local发现无法enable;
*
* 2019-6-10 深圳 宝安西乡 曾剑锋
******************************************************************************/ 一、Error
root@zengjf:/etc/systemd/system# systemctl enable rc-local.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ 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. 二、错误原因
. 无Install字段;
. 添加Install字段:
root@zengjf:/lib/systemd/system# cat rc-local.service
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version. # This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator()
ConditionFileIsExecutable=/etc/rc.local
After=network.target [Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=
RemainAfterExit=yes
GuessMainPID=no [Install]
WantedBy=multi-user.target
. 重新enable:
root@zengjf:/etc/systemd/system# systemctl enable rc-local.service
Created symlink /etc/systemd/system/multi-user.target.wants/rc-local.service → /lib/systemd/system/rc-local.service.
. 查看生成文件:
root@zengjf:/etc/systemd/system/multi-user.target.wants# ls -al rc-local.service
lrwxrwxrwx root root Apr : rc-local.service -> /lib/systemd/system/rc-local.service
root@zengjf:/etc/systemd/system/multi-user.target.wants#
. 创建/etc/rc.local,并赋予执行权限;
root@zengjf:~# cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
# echo "-------------------------------" >> /etc/zengjf
echo rc.local >> /etc/zengjf
echo "-------------------------------" >> /etc/zengjf exit
. 重启查看输出;
root@zengjf:~# cat /etc/zengjf
-------------------------------
rc.local
-------------------------------

systemctl enable rc-local.service error的更多相关文章

  1. 曹工改bug:centos下,mongodb开机不能自启动,systemctl、rc.local都试了,还是不行,要不要放弃?

    问题背景 最近装个centos 7.6的环境,其中,基础环境包括,redis.nginx.mongodb.fastdfs.mysql等,其中,自启动使用的是systemctl,其他几个组件,都没啥问题 ...

  2. Ubuntu 18.04 设置开机启动脚本 rc.local systemd

    ubuntu18.04不再使用initd管理系统,改用systemd. ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.l ...

  3. debian9 开启rc.local服务

    由于某些软件并没有增加开启启动的服务,很多时候需要手工添加,一般我们都是推荐添加命令到 /etc/rc.local 文件,但是 Debian 9 默认不带 /etc/rc.local 文件,而 rc. ...

  4. Debian 9.x "stretch" 解决 /etc/rc.local 开机启动问题

    由于某些软件并没有增加开启启动的服务,很多时候需要手工添加,一般我们都是推荐添加命令到 /etc/rc.local 文件,但是 Debian 9 默认不带 /etc/rc.local 文件,而 rc. ...

  5. rc.local(ubuntu18.04)

    系统自带服务/lib/systemd/system/rc-local.service 软连接为 /lib/systemd/system/rc.local.service -> rc-local. ...

  6. Arch下systemd无法开机执行rc.local之解决方法

    早就发现了,Arch的systemd提供的那个 rc-local.service 貌似有问题,rc.local不会执行.因为没用rc.local,一直没管. 解决方法源自这里,需要稍加改动: http ...

  7. 没有rc.local的解决办法

    转载请注明来源https://www.cnblogs.com/sogeisetsu/p/11395098.html linux 开机自启动 我是小白,最近在想如何使用linux开机自启动,有一个办法是 ...

  8. centos7 /etc/rc.local需要chmod +x /etc/rc.d/rc.local

    Centos 7.0设置/etc/rc.local无效问题解决 安装centos7以后按照以往习惯修改rc.local添加开机启动命令,但重启后发现无效,再次重启发现依然如故 检查系统rc.local ...

  9. Centos 7.0设置/etc/rc.local无效问题解决

    安装centos7以后按照以往习惯修改rc.local添加开机启动命令,但重启后发现无效,再次重启发现依然如故 检查系统rc.local服务运行情况 systemctl | grep "rc ...

随机推荐

  1. 数据结构与算法—simhash

    引入 随着信息爆炸时代的来临,互联网上充斥着着大量的近重复信息,有效地识别它们是一个很有意义的课题. 例如,对于搜索引擎的爬虫系统来说,收录重复的网页是毫无意义的,只会造成存储和计算资源的浪费: 同时 ...

  2. nginx配置ssl证书流程及常见问题

    背景:         项目开发中用到了微信小程序,但是服务器配置URL必须是HTTPS,所以需要通过配置nginx的SSL模块来支持HTTPS访问,也就是说,要做一个网站域名为 dmsdbj.com ...

  3. GeoGebra 代数输入的提示和技巧

    GeoGebra是Mac平台上一款自由且跨平台的动态数学软件,提供各级教育使用,包含了几何.代数.表格.图形.统计和微积分,集中在一个容易使用的软件.   确认表达式 始终按  Enter  键确认您 ...

  4. Xshell 配置密钥

  5. ansible之yum模块

    > YUM (/usr/lib/python2.7/site-packages/ansible/modules/packaging/os/yum.py) Installs, upgrade, d ...

  6. C程序回顾

    1.字符串操作 C中,字符串以一维数组的方式存储.字符串结束标志\0,可用scanf("%s",c);输入,以空格作为输入字符串之间的分隔符. 字符串处理函数:puts(str); ...

  7. VC检测内存泄漏(Detected memory leaks!)

    Detected memory leaks!Dumping objects ->{98500} normal block at 0x05785AD0, 152 bytes long.Data: ...

  8. excel双击下拉制作(以及双击下拉字符超限处理)

    最近,在项目的开发过程中,遇到了一个问题,自己要修改代码中的excel模板,有些列要处理成双击下拉的形式. excel制作双击下拉: 当然,我想,这对于大家来说是不难的,好实现,但是,我在制作的过程中 ...

  9. 硬币游戏2&&Cutting Game——Grundy值

    Grundy值 当前状态的Grundy值就是除任意一步所能转移到的状态的Grundy值以外的最小非负整数, 以硬币问题一为例,可写成: int init_grundy() { sg[] = ; ;i ...

  10. docker 空间清理

    https://blog.csdn.net/qq_28001193/article/details/79555177 清理之后,重要的是找到原因,如上连接所示,其中一个占空间比较大的是日志文件,除了考 ...