解决方法:
首先创建systemd的服务脚本
1、sudo vi /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
#sysVstart这行可以删掉,我看启动日志中貌似报忽略这个了。。
[Install]
WantedBy=multi-user.target
2、sudo systemctl enable rc-local.service
然后就按以前的格式编辑/etc/rc.local就好了。
最后记得chmod +x /etc/rc.local