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:當我將其放入啟動時它也不起作用。 啟動配置

相關內容