解决a start job is running for /etc/rc.d/rc.local Compatibility导致系统无法进入登录界面(串口命令行)

文章目录

    • 1 问题
    • 2 分析
      • (1)作用
      • (2)形式
      • (3)内容
      • (4)运行
        • 查看状态
        • 修改下重启启动
    • 结果
    • 参考


1 问题

为了系统启动后,可以运行自定义的应用,在/etc/rc.local文件中,加入了应用的路径,

/home/root/weston-test -platform linuxfb:fb=/dev/fb0 

结果启动后,停留在
解决a start job is running for /etc/rc.d/rc.local Compatibility导致系统无法进入登录界面(串口命令行)_第1张图片
不能登录,故不能进行其他操作

2 分析

(1)作用

这个配置文件会在用户登陆之前读取,这个文件中写入了什么命令,在每次系统启动时都会执行一次

(2)形式

在有些系统中,会存在rc.local和rc.d/rc.local,其实他们是一个东西
/etc/rc.local是/etc/rc.d/rc.local的软连接

(3)内容

一般的rc.local文件有如下注释,有几点注意:

  • 此脚本在登录时执行
  • 确保此脚本返回
  • 可以通过改变其执行权限位,决定是否运行
  • 默认这个脚本什么也不做,留着它是为了向后兼容
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

(4)运行

现在rc.local通过systmed的service进行管理,默认会自动启动

查看状态
root@xboard:~# systemctl status rc-local.service
鈼[0m rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
   Active: active (exited) since Mon 2021-12-13 03:27:08 UTC; 25s ago
     Docs: man:systemd-rc-local-generator(8)
  Process: 4093 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

Dec 13 03:27:08 imx8mqrom5720a1 systemd[1]: Starting /etc/rc.local Compatibility...
Dec 13 03:27:08 imx8mqrom5720a1 rc.local[4093]: getLinuxBase: Yocto 2.5
Dec 13 03:27:08 imx8mqrom5720a1 rc.local[4093]: key_event: Can't get gpio-keys event
Dec 13 03:27:08 imx8mqrom5720a1 systemd[1]: Started /etc/rc.local Compatibility.
Dec 13 03:27:09 imx8mqrom5720a1 rc.local[4093]: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Dec 13 03:27:09 imx8mqrom5720a1 rc.local[4093]: qt.qpa.screen: QXcbConnection: Could not connect to display
Dec 13 03:27:09 imx8mqrom5720a1 rc.local[4093]: Could not connect to any X display.
修改下重启启动
root@xboard:~# systemctl daemon-reload          
root@xboard:~# systemctl restart rc-local       
root@xboard:~# systemctl status rc-local.service
鈼[0m rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
   Active: active (exited) since Mon 2021-12-13 03:29:53 UTC; 1s ago
     Docs: man:systemd-rc-local-generator(8)
  Process: 4245 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

Dec 13 03:29:53 imx8mqrom5720a1 systemd[1]: Starting /etc/rc.local Compatibility...
Dec 13 03:29:53 imx8mqrom5720a1 systemd[1]: Started /etc/rc.local Compatibility.
Dec 13 03:29:53 imx8mqrom5720a1 rc.local[4245]: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Dec 13 03:29:53 imx8mqrom5720a1 rc.local[4245]: qt.qpa.screen: QXcbConnection: Could not connect to display
Dec 13 03:29:53 imx8mqrom5720a1 rc.local[4245]: Could not connect to any X display.
Dec 13 03:29:53 imx8mqrom5720a1 rc.local[4245]: getLinuxBase: Yocto 2.5
Dec 13 03:29:53 imx8mqrom5720a1 rc.local[4245]: key_event: Can't get gpio-keys event

结果

故将命令修改为

/home/root/weston-test -platform linuxfb:fb=/dev/fb0 &

重启
解决a start job is running for /etc/rc.d/rc.local Compatibility导致系统无法进入登录界面(串口命令行)_第2张图片

参考

【1】类Ubuntu解决方法

你可能感兴趣的:(服务器,linux,网络)