Backlight error + boot error: Mint 21, Lenovo Legion 5 pro; RTX3070

Slow boot is caused by GPU process hanging, which is related to: systemd-backlight@backlight:nvidia_0.service.

$ systemd-analyze blame
1min 30.342s plymouth-quit-wait.service
1min 30.274s gpu-manager.service
      6.340s NetworkManager-wait-online.service
      2.116s systemd-udev-settle.service
       681ms docker.service
       275ms dev-nvme0n1p2.device
       178ms systemd-udev-trigger.service
       137ms zfs-load-module.service
       114ms lightdm.service
       110ms lm-sensors.service
       102ms systemd-resolved.service
        ...

Hanging:

cat /var/log/boot.log
------------ Wed Nov 30 10:27:24 EST 2022 ------------
/dev/nvme0n1p2: clean, 1098804/62480384 files, 21914040/249919744 blocks

[*     ] (1 of 3) A start job is running for Detect the available GPUs and deal [**    ] (1 of 3) A start job is running for Detect the available GPUs and deal [***   ] (1 of 3) A start job is running for Detect the available GPUs and deal [ ***  ] (2 of 3) A start job is running for Hold until boot process finishes up[  *** ] (2 of 3) A start job is running for Hold until boot process finishes up[   ***] (2 of 3) A start job is running for Hold until boot process finishes up[    **] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[     *] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[    **] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[   ***] (1 of 3) A start job is running for Detect the available GPUs and deal [  *** ] (1 of 3) A start job is running for Detect the available GPUs and deal [ ***  ] (1 of 3) A start job is running for Detect the available GPUs and deal [***   ] (2 of 3) A start job is running for Hold until boot process finishes up[**    ] (2 of 3) A start job is running for Hold until boot process finishes up[*     ] (2 of 3) A start job is running for Hold until boot process finishes up[**    ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[***   ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[ ***  ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[  *** ] (1 of 3) A start job is running for Detect the available GPUs and deal [   ***] (1 of 3) A start job is running for Detect the available GPUs and deal [    **] (1 of 3) A start job is running for Detect the available GPUs and deal [     *] (2 of 3) A start job is running for Hold until boot process finishes up[    **] (2 of 3) A start job is running for Hold until boot process finishes up[   ***] (2 of 3) A start job is running for Hold until boot process finishes up[  *** ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[ ***  ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[***   ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[**    ] (1 of 3) A start job is running for Detect the available GPUs and deal [*     ] (1 of 3) A start job is running for Detect the available GPUs and deal [**    ] (1 of 3) A start job is running for Detect the available GPUs and deal [***   ] (2 of 3) A start job is running for Hold until boot process finishes up[ ***  ] (2 of 3) A start job is running for Hold until boot process finishes up[  *** ] (2 of 3) A start job is running for Hold until boot process finishes up[   ***] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[    **] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[     *] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[    **] (1 of 3) A start job is running for Detect the available GPUs and deal [   ***] (1 of 3) A start job is running for Detect the available GPUs and deal [  *** ] (1 of 3) A start job is running for Detect the available GPUs and deal [ ***  ] (2 of 3) A start job is running for Hold until boot process finishes up[***   ] (2 of 3) A start job is running for Hold until boot process finishes up[**    ] (2 of 3) A start job is running for Hold until boot process finishes up[*     ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[**    ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[***   ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[ ***  ] (1 of 3) A start job is running for Detect the available GPUs and deal [  *** ] (1 of 3) A start job is running for Detect the available GPUs and deal [   ***] (1 of 3) A start job is running for Detect the available GPUs and deal [    **] (2 of 3) A start job is running for Hold until boot process finishes up[     *] (2 of 3) A start job is running for Hold until boot process finishes up[    **] (2 of 3) A start job is running for Hold until boot process finishes up[   ***] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[  *** ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[ ***  ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[***   ] (1 of 3) A start job is running for Detect the available GPUs and deal [**    ] (1 of 3) A start job is running for Detect the available GPUs and deal [*     ] (1 of 3) A start job is running for Detect the available GPUs and deal [**    ] (2 of 3) A start job is running for Hold until boot process finishes up[***   ] (2 of 3) A start job is running for Hold until boot process finishes up[ ***  ] (2 of 3) A start job is running for Hold until boot process finishes up[  *** ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[   ***] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[    **] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[     *] (1 of 3) A start job is running for Detect the available GPUs and deal [    **] (1 of 3) A start job is running for Detect the available GPUs and deal [   ***] (1 of 3) A start job is running for Detect the available GPUs and deal [  *** ] (2 of 3) A start job is running for Hold until boot process finishes up[ ***  ] (2 of 3) A start job is running for Hold until boot process finishes up[***   ] (2 of 3) A start job is running for Hold until boot process finishes up[**    ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[*     ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[**    ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[***   ] (1 of 3) A start job is running for Detect the available GPUs and deal [ ***  ] (1 of 3) A start job is running for Detect the available GPUs and deal [  *** ] (1 of 3) A start job is running for Detect the available GPUs and deal [   ***] (2 of 3) A start job is running for Hold until boot process finishes up[    **] (2 of 3) A start job is running for Hold until boot process finishes up[     *] (2 of 3) A start job is running for Hold until boot process finishes up[    **] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[   ***] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[  *** ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[ ***  ] (1 of 3) A start job is running for Detect the available GPUs and deal [***   ] (1 of 3) A start job is running for Detect the available GPUs and deal [**    ] (1 of 3) A start job is running for Detect the available GPUs and deal [*     ] (2 of 3) A start job is running for Hold until boot process finishes up[**    ] (2 of 3) A start job is running for Hold until boot process finishes up[***   ] (2 of 3) A start job is running for Hold until boot process finishes up[ ***  ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[  *** ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[   ***] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[    **] (1 of 3) A start job is running for Detect the available GPUs and deal [     *] (1 of 3) A start job is running for Detect the available GPUs and deal [    **] (1 of 3) A start job is running for Detect the available GPUs and deal [   ***] (2 of 3) A start job is running for Hold until boot process finishes up[  *** ] (2 of 3) A start job is running for Hold until boot process finishes up[ ***  ] (2 of 3) A start job is running for Hold until boot process finishes up[***   ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[**    ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[*     ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[**    ] (1 of 3) A start job is running for Detect the available GPUs and deal [***   ] (1 of 3) A start job is running for Detect the available GPUs and deal [ ***  ] (1 of 3) A start job is running for Detect the available GPUs and deal [  *** ] (2 of 3) A start job is running for Hold until boot process finishes up[   ***] (2 of 3) A start job is running for Hold until boot process finishes up[    **] (2 of 3) A start job is running for Hold until boot process finishes up[     *] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[    **] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[   ***] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[  *** ] (1 of 3) A start job is running for Detect the available GPUs and deal [ ***  ] (1 of 3) A start job is running for Detect the available GPUs and deal [***   ] (1 of 3) A start job is running for Detect the available GPUs and deal [**    ] (2 of 3) A start job is running for Hold until boot process finishes up[*     ] (2 of 3) A start job is running for Hold until boot process finishes up[**    ] (2 of 3) A start job is running for Hold until boot process finishes up[***   ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[ ***  ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne[  *** ] (3 of 3) A start job is running for Load/Save Screen Backlight Brightne
[FAILED] Failed to start Load/Save Screen Backlight Brightness of backlight:nvidia_0.
See 'systemctl status systemd-backlight@backlight:nvidia_0.service' for details.
         Starting Load/Save Screen Backlight Brightness of backlight:nvidia_0...
[  OK  ] Finished Detect the available GPUs and deal with any system changes.
[  OK  ] Finished Load/Save Screen Backlight Brightness of backlight:nvidia_0.
         Starting Light Display Manager...
...

systemd-backlight@backlight:nvidia_0.service says it is running when the system eventually boots, but there is no ability to control the backlight.

The workarounds for me are:

  1. Add:
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=linux acpi_backlight=video"

to bypass NVIDIA control of the backlight.

  1. systemctl mask systemd-backlight@backlight:nvidia_0.service to keep the service from hanging during boot.

I know there have been a lot of bugs with Lenovo + Linux + NVIDIA when it comes to the backlight. Hopefully this gets addressed. I also had to set the GRUB resolution to 800x600 to prevent the “out of memory” error on boot.

System Info:
Dynamic Mode (LENOVO)
Booting into On Demand Mode

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 520.56.06    Driver Version: 520.56.06    CUDA Version: 11.8     |

inxi -Fxxxrz
System:
  Kernel: 5.15.0-53-generic x86_64 bits: 64 compiler: gcc v: 11.2.0
    Desktop: Cinnamon 5.4.12 tk: GTK 3.24.33 wm: Mutter vt: 7
    dm: LightDM 1.30.0 Distro: Linux Mint 21 Vanessa base: Ubuntu 22.04 jammy
Machine:
  Type: Laptop System: LENOVO product: 82RF v: Legion 5 Pro 16IAH7H
    serial: <superuser required> Chassis: type: 10 v: Legion 5 Pro 16IAH7H
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0T76461 WIN
    serial: <superuser required> UEFI: LENOVO v: J2CN45WW date: 08/26/2022
Battery:
  ID-1: BAT0 charge: 82.1 Wh (98.9%) condition: 83.0/80.0 Wh (103.7%)
    volts: 17.4 min: 15.4 model: Sunwoda L21D4PC1 type: Li-poly
    serial: <filter> status: Full cycles: 4
  Device-1: hid-f4:73:35:58:42:71-battery
    model: Bluetooth Mouse M336/M337/M535 serial: N/A charge: N/A
    status: Discharging
CPU:
  Info: 14-core (6-mt/8-st) model: 12th Gen Intel Core i7-12700H bits: 64
    type: MST AMCP smt: enabled arch: Alder Lake rev: 3 cache: L1: 1.2 MiB
    L2: 11.5 MiB L3: 24 MiB
  Speed (MHz): avg: 697 high: 908 min/max: 400/4679:4700:3500 cores: 1: 838
    2: 908 3: 672 4: 901 5: 503 6: 723 7: 399 8: 587 9: 731 10: 692 11: 708
    12: 634 13: 893 14: 861 15: 755 16: 755 17: 436 18: 637 19: 671 20: 636
    bogomips: 107520
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel Alder Lake-P Integrated Graphics vendor: Lenovo
    driver: i915 v: kernel ports: active: eDP-1 empty: DP-1,DP-2
    bus-ID: 00:02.0 chip-ID: 8086:46a6 class-ID: 0300
  Device-2: NVIDIA GA104M [GeForce RTX 3070 Mobile / Max-Q] vendor: Lenovo
    driver: nvidia v: 520.56.06 pcie: speed: 2.5 GT/s lanes: 8 ports:
    active: none empty: DP-3, DP-4, HDMI-A-1, eDP-2 bus-ID: 01:00.0
    chip-ID: 10de:24dd class-ID: 0300
  Device-3: IMC Networks Integrated Camera type: USB driver: uvcvideo
    bus-ID: 3-6:5 chip-ID: 13d3:56bb class-ID: 0e02
  Display: x11 server: X.Org v: 1.21.1.3 driver: X:
    loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa gpu: i915
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 4096x2560 s-dpi: 120 s-size: 867x542mm (34.1x21.3")
    s-diag: 1022mm (40.3")
  Monitor-1: eDP-1 model: BOE Display res: 4096x2560 hz: 165 dpi: 302
    size: 344x215mm (13.5x8.5") diag: 406mm (16") modes: 2560x1600
  OpenGL: renderer: Mesa Intel Graphics (ADL GT2) v: 4.6 Mesa 22.0.5
    direct render: Yes
Audio:
  Device-1: Intel Alder Lake PCH-P High Definition Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 chip-ID: 8086:51c8
    class-ID: 0403
  Device-2: NVIDIA GA104 High Definition Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel pcie: speed: 2.5 GT/s lanes: 8
    bus-ID: 01:00.1 chip-ID: 10de:228b class-ID: 0403
  Sound Server-1: ALSA v: k5.15.0-53-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Intel Alder Lake-P PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:51f0 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Lenovo driver: r8169 v: kernel pcie: speed: 2.5 GT/s lanes: 1
    port: 3000 bus-ID: 34:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp52s0 state: down mac: <filter>
  IF-ID-1: docker0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel type: USB driver: btusb v: 0.8 bus-ID: 3-10:7
    chip-ID: 8087:0033 class-ID: e001
  Report: hciconfig ID: hci0 rfk-id: 2 state: up address: <filter>
Drives:
  Local Storage: total: 953.87 GiB used: 67.46 GiB (7.1%)
  ID-1: /dev/nvme0n1 vendor: Samsung model: MZVL21T0HCLR-00BL2
    size: 953.87 GiB speed: 63.2 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: CL1QGXA7 temp: 33.9 C scheme: GPT
Partition:
  ID-1: / size: 937.33 GiB used: 67.45 GiB (7.2%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-2: /boot/efi size: 511 MiB used: 9.4 MiB (1.8%) fs: vfat
    dev: /dev/nvme0n1p1
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 0 KiB (0.0%) priority: -2
    file: /swapfile
Sensors:
  System Temperatures: cpu: 34.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Repos:
  Packages: apt: 2281
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/google-chrome.list
    1: deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/nvidia-container-toolkit.list
    1: deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/$(ARCH) /
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb http://packages.linuxmint.com vanessa main upstream import backport
    2: deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
    3: deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
    4: deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
    5: deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
Info:
  Processes: 404 Uptime: 10m wakeups: 3 Memory: 15.36 GiB
  used: 2.46 GiB (16.0%) Init: systemd v: 249 runlevel: 5 Compilers:
  gcc: 11.3.0 alt: 11 Shell: Bash v: 5.1.16 running-in: gnome-terminal
  inxi: 3.3.13