ubuntu systemctl generated and enabled
来源:互联网 发布:安卓富文本编辑器源码 编辑:程序博客网 时间:2024/06/05 00:08
问题描述
不知道是否有同我一样作死(被逼无奈)的人,反复安装某一个软件,导致在systemctl enable service
的时候,无论如何都无法将服务设置成开机启动。
我只是单纯的在安装grafana
的过程中走了一些弯路,详见我的另外一篇博客 http://blog.csdn.net/hsdfz0201/article/details/77480810
不知道中间做了什么,这个服务无论如何设不成enabled
,反而告诉我他的状态是generated
问题表象
具体的表象是
(python2.7) xxx@ubuntu:/lib/systemd/system$ sudo systemctl status grafana-server grafana-server.service - Grafana instance Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; generated; vendor preset: enabled) Active: active (running) since Mon 2017-09-11 12:47:06 CST; 12h ago Docs: http://docs.grafana.org Main PID: 24093 (grafana-server) Tasks: 50 (limit: 4915) Memory: 108.0M CPU: 3min 11.328s CGroup: /system.slice/grafana-server.service └─24093 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile= cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfgSep 11 23:21:41 ubuntu grafana-server[24093]: t=2017-09-11T23:21:41+0800 lvl=info msg=uploaded logger=alerting.notifier url=
可以看到这时的service
状态是generated
尽管他声称vendor preset
也就是软件预设的是enabled
,这时尝试enable
的效果是
(python2.7) xxx@ubuntu:/usr/lib/systemd/system$ sudo systemctl enable grafana-server.serviceSynchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install.Executing: /lib/systemd/systemd-sysv-install enable grafana-serverFailed to enable unit: Unit /run/systemd/generator.late/grafana.service is transient or generated.
经过努力查询,发现generated
就是不能 enabled
, 但是为什么变成generated
?
问题解决
在另一台机器上,尝试重新安装,发现enable
成功。
(中间还有依赖问题,用sudo apt-get --fix-broken install/upgrade
搞定)
说明问题在于我改了什么,软件本身是不会generated
的。
查看/etc/systemd/system
,发现 grafana-server.service -> /lib/systemd/system/grafana.service
是红色的,意味着软连接的文件不存在。在/usr/lib/systemd/system/grafana.service
我找到了这一文件,将文件cp
到应有的位置, systemctl daemon-reload
重置一下状态,发现可以enable
问题解决。
总结
如果出现enable
不能进行,尤其是状态为generated
的时候,很大概率是.service
文件出了问题,修改文件或者重新软链接很可能可以解决问题。ubuntu
在比较新的版本使用systemd
,相关的内容值得我们学习。
- ubuntu systemctl generated and enabled
- Ubuntu 16.04 (systemctl)常用操作
- systemctl
- systemctl
- systemctl
- automated save and generated infopath file name
- Difference between enabled and userInteractionEnabled properties
- ubuntu piix4_smbus: Host SMBus controller not enabled!
- System-generated find() and exist() methods on tables
- MPLS-Enabled Applications : Emerging Developments and New Technologies
- XML Data Management: Native XML and XML-Enabled Database
- Flash Enabled: Flash Design and Development for Devices
- C warning“comparison between pointer and integer [enabled by default]”
- vmwaer虚拟机部署-ubuntu piix4_smbus: Host SMBus controller not enabled!
- Ubuntu出错笔记_Host SMBus controller not enabled!
- VMware部署ubuntu提示piix4_smbus: Host SMBus controller not enabled!
- vmware:ubuntu piix4_smbus: Host SMBus controller not enabled
- VmWare安装Ubuntu出现'SMBus Host Controller not enabled'
- spring第一天
- 数据库索引的实现原理
- OPENCV图像边缘查找与分割技术在android中使用汇总
- hdu4614 Vases and Flowers (线段树)
- How To Install Ruby with rbenv on Cent OS 7.2
- ubuntu systemctl generated and enabled
- [kaggle数据] 泰坦尼克号生存预测分析
- Oracle存储过程基本语法及基础教程
- 计算机系大学生、程序员怎么在空余时间赚钱
- LeetCode:595 Big Countions
- C#--抽象工厂设计模式原理
- 无穷小放飞互联网行动即将开始!
- vs---编写第一个JavaScript程序
- 搭建AngularJS开发Webapp的开发环境-安装batarang