rc.local 和 xrandr 无法协同工作

rc.local 和 xrandr 无法协同工作

因此,我在启动时遇到了屏幕亮度问题。

这很不幸,因为我尝试了很多方法来将其设置为正确的设置,并且当我调用此命令时只有 xrandr 对我有用。

xrandr --output eDP --brightness 1

在我的 Ubuntu 上我没有/etc/rc.local文件 - 所以我创建了它并使其可执行。

~ » ls -laht /etc | grep rc.local
-rwxr-xr-x   1 root root    342 lis 29 19:26 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.

xrandr --output eDP --brightness 1

exit 0

当我重新启动系统时,我得到失败状态rc-local.service

~ » sudo systemctl status rc-local.service
● rc-local.service - /etc/rc.local Compatibility
     Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/rc-local.service.d
             └─debian.conf
     Active: failed (Result: exit-code) since Mon 2021-11-29 19:27:10 CET; 14min ago
       Docs: man:systemd-rc-local-generator(8)
    Process: 920 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)

lis 29 19:27:10 greenery systemd[1]: Starting /etc/rc.local Compatibility...
lis 29 19:27:10 greenery rc.local[924]: Can't open display
lis 29 19:27:10 greenery systemd[1]: rc-local.service: Control process exited, code=exited, status=1/FAILURE
lis 29 19:27:10 greenery systemd[1]: rc-local.service: Failed with result 'exit-code'.
lis 29 19:27:10 greenery systemd[1]: Failed to start /etc/rc.local Compatibility.

我做错了什么?

编辑 1:当我将其放入启动时它也不起作用。 启动配置

相关内容