11月0110:56:36ubuntusystemd[1]:Starting/etc/rc.localCompatibility... 11月0110:56:36ubuntusystemd[1961]:rc-local.service: Failed to execute command:Execformaterror 11月0110:56:36ubuntusystemd[1961]:rc-local.service: Failed at step EXEC spawning /etc/rc.local:Execformate 11月0110:56:36ubuntusystemd[1]:rc-local.service:Controlprocessexited,code=exitedstatus=203 11月0110:56:36ubuntusystemd[1]:rc-local.service:Failedwithresult'exit-code'. 11月0110:56:36ubuntusystemd[1]:Failedtostart/etc/rc.localCompatibility.
告诉我,不该给/etc/rc.local可执行权限,因为执行时报错了
尝试启用,会报错
1
sudo systemctl enable rc-local
输出错误信息
1 2 3 4 5 6 7 8 9 10 11 12 13
xugaoxiang@ubuntu:~$sudosystemctlenablerc-local Theunitfileshavenoinstallationconfig(WantedBy,RequiredBy,Also,Alias settingsinthe [Install] section,andDefaultInstancefortemplateunits). Thismeanstheyarenotmeanttobeenabledusingsystemctl. Possible reasons for having this kind of units are: 1)Aunitmaybestaticallyenabledbybeingsymlinkedfromanotherunit's .wants/or.requires/directory. 2)Aunit'spurposemaybetoactasahelperforsomeotherunitwhichhas arequirementdependencyonit. 3)Aunitmaybestartedwhenneededviaactivation(socket,path,timer, D-Bus,udev,scriptedsystemctlcall,...). 4)Incaseoftemplateunits,theunitismeanttobeenabledwithsome instancenamespecified.
# 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(8) ConditionFileIsExecutable=/etc/rc.local After=network.target