/*******************************************************************************
* 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. 面试题:什么叫平衡二叉查找树--AVL树

    查找.插入和删除在平均和最坏情况下都是O(log n) 增加和删除可能需要通过一次或多次树旋转来重新平衡这个树 节点的平衡因子是它的左子树的高度减去它的右子树的高度.带有平衡因子 1.0 或 -1 的 ...

  2. 06-Vue路由

    什么是路由 对于普通的网站,所有的超链接都是URL地址,所有的URL地址都对应服务器上对应的资源: 对于单页面应用程序来说,主要通过URL中的hash(#号)来实现不同页面之间的切换,同时,hash有 ...

  3. OCR2:tesseract字库训练

    由于tesseract的中文语言包“chi_sim”对中文字体或者环境比较复杂的图片,识别正确率不高,因此需要针对特定情况用自己的样本进行训练,提高识别率,通过训练,也可以形成自己的语言库. 工具: ...

  4. Spark广播变量和累加器

    一.广播变量图解 二.代码 val conf = new SparkConf() conf.setMaster("local").setAppName("brocast& ...

  5. windows安装mysql8详解

    MySQL的安装过程还是比较繁琐,为了以后安装节约时间,将其详细安装过程总结如下: 1>下载对应版本 下载地址:https://dev.mysql.com/downloads/mysql/ 百度 ...

  6. Win10 Microsoft Store 微软商店 Error 0x00000193 解决方法

    0x00 前言 最近使用 CFW 过程中使用 Fiddle Web Debug 设置 Store 的回环代理的过程中发现无论是否使用代理,Store 都无法访问网络的问题,在最下面的提示中出现了 0x ...

  7. hive创建表

    一.为什么要创建分区表 1.select查询中会扫描整个表内容,会消耗大量时间.由于相当多的时候人们只关心表中的一部分数据, 故建表时引入了分区概念. 2.hive分区表:是指在创建表时指定的part ...

  8. 解决ie6下png背景不能透明bug

    /*第一种方法:通过滤镜 使用css解决的办法. 注意滤镜下的1像素透明gif的覆盖图片的路径是相对页面写的*/ /*注意:这个方法不适合处理img标签引入的png图片,代码太冗余了*/ .banne ...

  9. applyMiddleware 沉思录

    let newStore = applyMiddleware(mid1, mid2, mid3, ...)(createStore)(reducer, null); 给({ getState, dis ...

  10. swift是面向对象、面向协议、高阶类型、灵活扩展、函数式编程语言

    swift是面向对象.面向协议.高阶类型.灵活扩展.函数式编程语言