Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HINT] systemd doesn't restore backlight brightness at boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Anton Gubarkov
n00b
n00b


Joined: 13 Mar 2008
Posts: 47

PostPosted: Fri Jul 14, 2017 5:57 am    Post subject: [HINT] systemd doesn't restore backlight brightness at boot Reply with quote

Hi

My laptop always configures backlight at 100% in firmware. It used to fall back to a stored value (40-50%) when systemd kicks in. It does no longer.
Ah-hoc brightness control works fine. There is a saved value in
Code:

anton@r9-008cln ~ $ cat /var/lib/systemd/backlight/pci-0000\:00\:02.0\:backlight\:intel_backlight
1786


Code:

anton@r9-008cln ~ $ sudo /usr/lib/systemd/systemd-backlight load backlight:intel_backlight
does restore brightness to a desired level.

I wonder why it doesn't happen at boot.
I use
Code:
 BOOT_IMAGE=/boot/vmlinuz-4.11.9-ck-zfs video.use_native_backlight=1 root=ZFS init=/usr/lib/systemd/systemd


intel_backlight is the only backlight control class available:
Code:
 ls -l /sys/class/backlight/
итого 0
lrwxrwxrwx 1 root root 0 июл 14 08:33 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight


Last edited by Anton Gubarkov on Tue Aug 22, 2017 7:15 am; edited 2 times in total
Back to top
View user's profile Send private message
sebB
l33t
l33t


Joined: 02 Mar 2011
Posts: 739
Location: S.O. France

PostPosted: Mon Jul 17, 2017 8:54 pm    Post subject: Reply with quote

Have you try replacing "video.use_native_backlight=1" by "acpi_backlight=......."?

According to the wiki
Quote:
On kernels >= 4.2, the video.use_native_backlight option is no longer available.[8] You should use one of the following instead (experiment to see which works on your system):
Back to top
View user's profile Send private message
Anton Gubarkov
n00b
n00b


Joined: 13 Mar 2008
Posts: 47

PostPosted: Wed Jul 19, 2017 7:03 am    Post subject: Reply with quote

It didn't help. :-(
I can control my brightness, it is saved at shutdown, but it is not restored at boot.
Back to top
View user's profile Send private message
sebB
l33t
l33t


Joined: 02 Mar 2011
Posts: 739
Location: S.O. France

PostPosted: Wed Jul 19, 2017 5:59 pm    Post subject: Reply with quote

Can you post

Code:
systemctl list-units | grep systemd-backlight

+
Code:
journalctl | grep backlight

+
Code:
systemctl status "the find before"
Back to top
View user's profile Send private message
Anton Gubarkov
n00b
n00b


Joined: 13 Mar 2008
Posts: 47

PostPosted: Thu Jul 20, 2017 6:39 am    Post subject: Reply with quote

Code:

systemd-backlight@leds:tpacpi::kbd_backlight.service                                     loaded active exited    Load/Save Screen Backlight Brightness of leds:tpacpi::kbd_backlight


Code:

r9-008cln ~ # journalctl -b0 | grep backlight
Jul 20 09:09:31 r9-008cln kernel: thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness control, supported by the ACPI video driver
Jul 20 09:09:31 r9-008cln systemd[1]: Starting Load/Save Screen Backlight Brightness of leds:tpacpi::kbd_backlight...
Jul 20 09:09:31 r9-008cln systemd[1]: Started Load/Save Screen Backlight Brightness of leds:tpacpi::kbd_backlight.
Jul 20 09:09:49 r9-008cln pkexec[6715]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 4217]
Jul 20 09:09:49 r9-008cln pkexec[6733]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 3996]
Jul 20 09:09:49 r9-008cln pkexec[6742]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 3775]
Jul 20 09:09:50 r9-008cln pkexec[6764]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 3554]
Jul 20 09:09:50 r9-008cln pkexec[6775]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 3333]
Jul 20 09:09:50 r9-008cln pkexec[6785]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 3112]
Jul 20 09:09:50 r9-008cln pkexec[6795]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 2891]
Jul 20 09:09:50 r9-008cln pkexec[6806]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 2670]
Jul 20 09:09:50 r9-008cln pkexec[6819]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 2449]
Jul 20 09:09:51 r9-008cln pkexec[6829]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 2228]
Jul 20 09:09:51 r9-008cln pkexec[6840]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 2007]
Jul 20 09:09:51 r9-008cln pkexec[6890]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 1786]
Jul 20 09:09:51 r9-008cln pkexec[6929]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 1565]
Jul 20 09:09:51 r9-008cln pkexec[6961]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 1344]
Jul 20 09:09:52 r9-008cln pkexec[6981]: anton: Executing command [USER=root] [TTY=unknown] [CWD=/home/anton] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 1123]
r9-008cln ~ #


Code:
r9-008cln ~ # systemctl status "the find before"
Unit the\x20find\x20before.service could not be found.
r9-008cln ~ #
Back to top
View user's profile Send private message
tberger2
n00b
n00b


Joined: 05 Feb 2013
Posts: 69

PostPosted: Thu Jul 20, 2017 7:58 am    Post subject: Reply with quote

Got a similar issue (dark backlight) since a kernel upgrade long time ago. Nothing helped (I'm using openrc).

"Solved" it by executing
Code:
echo 4882 > /sys/class/backlight/intel_backlight/brightness

in the initramfs.
Back to top
View user's profile Send private message
Anton Gubarkov
n00b
n00b


Joined: 13 Mar 2008
Posts: 47

PostPosted: Fri Aug 18, 2017 8:58 am    Post subject: Reply with quote

I digged more....

All backlight related services are not 'enableable'. The unit file has no WantedBy. it means that one can't 'systemctl enable' them. They are auto-activated by udev rules in /etc/udev/rules.d/99-systemd.rules
Code:

...
# Pull in backlight save/restore for all backlight devices and
# keyboard backlights
SUBSYSTEM=="backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@backlight:$name.service"
SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@leds:$name.service"
...


When my laptop boots normally, only the keyboard backlight is detected:
Code:

systemd-backlight@leds:tpacpi::kbd_backlight.service                                        loaded active exited    Load/Save Screen Backlight Brightness of leds:tpacpi::kbd_backlight


When I issued udevadm test /sys/class/backlight/intel_backlight, all of a sudden:

Code:

r9-008cln ~ # systemctl list-units | grep -i backlight
sys-devices-pci0000:00-0000:00:02.0-drm-card0-card0\x2deDP\x2d1-intel_backlight.device      loaded active plugged   /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
sys-devices-platform-thinkpad_acpi-leds-tpacpi::kbd_backlight.device                        loaded active plugged   /sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight
systemd-backlight@leds:tpacpi::kbd_backlight.service                                        loaded active exited    Load/Save Screen Backlight Brightness of leds:tpacpi::kbd_backlight
system-systemd\x2dbacklight.slice                                                           loaded active active    system-systemd\x2dbacklight.slice
r9-008cln ~ #


I do have intel driver compiled in the kernel. (as I had since don't remember when). The last modification time for the saved value for intel-backlight is June 20th 2017. My emerge history stops at Jul the 1st. I can't check if I upgraded systemd at that time. It clearly seems a systemd bug, that it misses this udev event for the backlight driver compiled in.
Back to top
View user's profile Send private message
Anton Gubarkov
n00b
n00b


Joined: 13 Mar 2008
Posts: 47

PostPosted: Fri Aug 18, 2017 10:22 am    Post subject: Reply with quote

Code:

r9-008cln rules.d # udevadm test /sys/class/backlight/intel_backlight
calling: test
version 234
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          234
file size:         7539227 bytes
header size             80 bytes
strings            1905923 bytes
nodes              5633224 bytes
Load module index
Found container virtualization none.
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Parsed configuration file /lib64/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
timestamp of '/lib/udev/rules.d' changed
Skipping overridden file: /lib64/udev/rules.d/80-hasp.rules.
Reading rules file: /lib64/udev/rules.d/10-dm.rules
Reading rules file: /lib64/udev/rules.d/11-dm-lvm.rules
Reading rules file: /lib64/udev/rules.d/13-dm-disk.rules
Reading rules file: /lib64/udev/rules.d/40-gentoo.rules
Reading rules file: /lib64/udev/rules.d/41-libsane.rules
Reading rules file: /lib64/udev/rules.d/50-udev-default.rules
Reading rules file: /etc/udev/rules.d/59-ffado.rules
Reading rules file: /lib64/udev/rules.d/60-HTC-Vive-perms.rules
Reading rules file: /lib64/udev/rules.d/60-block.rules
Reading rules file: /lib64/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib64/udev/rules.d/60-drm.rules
Reading rules file: /lib64/udev/rules.d/60-evdev.rules
Reading rules file: /lib64/udev/rules.d/60-fprint-autosuspend.rules
Reading rules file: /lib64/udev/rules.d/60-heimdall.rules
Reading rules file: /lib64/udev/rules.d/60-input-id.rules
Reading rules file: /lib64/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib64/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib64/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib64/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib64/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib64/udev/rules.d/60-sensor.rules
Reading rules file: /lib64/udev/rules.d/60-serial.rules
Reading rules file: /lib64/udev/rules.d/60-zvol.rules
Reading rules file: /lib64/udev/rules.d/61-gnome-bluetooth.rules
Reading rules file: /lib64/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
Reading rules file: /lib64/udev/rules.d/61-kde-bluetooth-rfkill.rules
Reading rules file: /lib64/udev/rules.d/64-btrfs-dm.rules
Reading rules file: /lib64/udev/rules.d/64-btrfs.rules
Reading rules file: /lib64/udev/rules.d/65-kvm.rules
Reading rules file: /lib64/udev/rules.d/69-bcache.rules
Reading rules file: /lib64/udev/rules.d/69-cd-sensors.rules
Reading rules file: /lib64/udev/rules.d/69-dm-lvm-metad.rules
Reading rules file: /lib64/udev/rules.d/69-libmtp.rules
Reading rules file: /lib64/udev/rules.d/69-vdev.rules
Reading rules file: /lib64/udev/rules.d/70-libgphoto2.rules
Reading rules file: /lib64/udev/rules.d/70-mouse.rules
Reading rules file: /lib64/udev/rules.d/70-power-switch.rules
Reading rules file: /lib64/udev/rules.d/70-printers.rules
Reading rules file: /lib64/udev/rules.d/70-touchpad.rules
Reading rules file: /lib64/udev/rules.d/70-uaccess.rules
Reading rules file: /lib64/udev/rules.d/71-seat.rules
Reading rules file: /lib64/udev/rules.d/73-seat-late.rules
Reading rules file: /lib64/udev/rules.d/75-net-description.rules
Reading rules file: /lib64/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib64/udev/rules.d/77-mm-cinterion-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-dell-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-ericsson-mbm.rules
Reading rules file: /lib64/udev/rules.d/77-mm-haier-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-huawei-net-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-longcheer-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-mtk-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-nokia-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
Reading rules file: /lib64/udev/rules.d/77-mm-platform-serial-whitelist.rules
Reading rules file: /lib64/udev/rules.d/77-mm-simtech-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-telit-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-usb-device-blacklist.rules
Reading rules file: /lib64/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
Reading rules file: /lib64/udev/rules.d/77-mm-x22x-port-types.rules
Reading rules file: /lib64/udev/rules.d/77-mm-zte-port-types.rules
Reading rules file: /lib64/udev/rules.d/78-sound-card.rules
Reading rules file: /lib64/udev/rules.d/80-docker.rules
Reading rules file: /lib64/udev/rules.d/80-drivers.rules
Reading rules file: /etc/udev/rules.d/80-hasp.rules
Reading rules file: /lib64/udev/rules.d/80-libinput-device-groups.rules
Reading rules file: /lib64/udev/rules.d/80-mm-candidate.rules
Reading rules file: /lib64/udev/rules.d/80-net-setup-link.rules
Reading rules file: /lib64/udev/rules.d/80-udisks2.rules
Reading rules file: /etc/udev/rules.d/81-Jmicron-usb-no-SMART.rules
Reading rules file: /lib64/udev/rules.d/84-nm-drivers.rules
Reading rules file: /lib64/udev/rules.d/85-nm-unmanaged.rules
Reading rules file: /lib64/udev/rules.d/85-regulatory.rules
Reading rules file: /lib64/udev/rules.d/85-tlp.rules
Reading rules file: /lib64/udev/rules.d/90-alsa-restore.rules
Reading rules file: /lib64/udev/rules.d/90-libinput-model-quirks.rules
Reading rules file: /lib64/udev/rules.d/90-network.rules
Reading rules file: /lib64/udev/rules.d/90-pulseaudio.rules
Reading rules file: /lib64/udev/rules.d/90-vconsole.rules
Reading rules file: /lib64/udev/rules.d/90-zfs.rules
Reading rules file: /lib64/udev/rules.d/91-fingerprint-gui-upek.rules
Reading rules file: /lib64/udev/rules.d/92-fingerprint-gui-uinput.rules
Reading rules file: /lib64/udev/rules.d/95-cd-devices.rules
Reading rules file: /lib64/udev/rules.d/95-dm-notify.rules
Reading rules file: /lib64/udev/rules.d/95-upower-csr.rules
Reading rules file: /lib64/udev/rules.d/95-upower-hid.rules
Reading rules file: /lib64/udev/rules.d/95-upower-wup.rules
Reading rules file: /lib64/udev/rules.d/97-hid2hci.rules
Reading rules file: /lib64/udev/rules.d/99-bumblebee-nvidia-dev.rules
Reading rules file: /lib64/udev/rules.d/99-fuse.rules
Reading rules file: /lib64/udev/rules.d/99-ntfs3g.rules
Reading rules file: /lib64/udev/rules.d/99-nvidia.rules
Reading rules file: /lib64/udev/rules.d/99-steam-controller-perms.rules
Reading rules file: /lib64/udev/rules.d/99-systemd.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 34918 bytes strings
25372 strings (206579 bytes), 21925 de-duplicated (175109 bytes), 3448 trie nodes used
IMPORT builtin 'path_id' /lib64/udev/rules.d/99-systemd.rules:62
created db file '/run/udev/data/+backlight:intel_backlight' for '/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight'
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
ID_PATH=pci-0000:00:02.0
ID_PATH_TAG=pci-0000_00_02_0
SUBSYSTEM=backlight
SYSTEMD_WANTS=systemd-backlight@backlight:intel_backlight.service
TAGS=:systemd:
USEC_INITIALIZED=2787191
Unload module index
Unloaded link configuration context.


It shows that the rule works as expeceted in test mode. It doesn't when the system boots.

Any hints anyone?
Back to top
View user's profile Send private message
Anton Gubarkov
n00b
n00b


Joined: 13 Mar 2008
Posts: 47

PostPosted: Tue Aug 22, 2017 7:14 am    Post subject: systemd doesn't restore backlight brightness at boot [HINT] Reply with quote

After trying different options, I could restore working of my brightness save/restore functionality.
All it took was to compile the intel graphics driver as a module (i915). It immediately caused the correct service to appear. (Asterisk marking below is mine)

Code:

r9-008cln ~ # systemctl list-units|grep backlight
  sys-devices-pci0000:00-0000:00:02.0-drm-card0-card0\x2deDP\x2d1-intel_backlight.device      loaded active plugged   /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
  sys-devices-platform-thinkpad_acpi-leds-tpacpi::kbd_backlight.device                        loaded active plugged   /sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight
* systemd-backlight@backlight:intel_backlight.service                                         loaded active exited    Load/Save Screen Backlight Brightness of backlight:intel_backlight
  systemd-backlight@leds:tpacpi::kbd_backlight.service                                        loaded active exited    Load/Save Screen Backlight Brightness of leds:tpacpi::kbd_backlight
  system-systemd\x2dbacklight.slice                                                           loaded active active    system-systemd\x2dbacklight.slice
r9-008cln ~ #

Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum