johnfanv2 / LenovoLegionLinux

Driver and tools for controlling Lenovo Legion laptops in Linux including fan control and power mode.
https://github.com/johnfanv2/LenovoLegionLinux
GNU General Public License v2.0
1.3k stars 49 forks source link

[BUG] Error: Missing .env and other files when toggle Fn+Q #171

Closed Flashwalker closed 3 months ago

Flashwalker commented 4 months ago

Problem Description I get error about the script can't find .env and other files when i toggle the performance profiles via Fn+Q.

...
/usr/bin/fancurve-set: line 21: /etc/legion_linux//.env: No such file or directory
...
FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//balanced-ac.yaml'
...
FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//performance-ac.yaml'
...
FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//quiet-ac.yaml'
...

Here is the syslog traceback:

``` # toggle to ballanced Mar 2 00:28:56 smarttop systemd[1]: Starting Apply Fan Curve to Lenovo Legion Laptop depending on Power State and Charger Mode (LenovoLegionLinux kernel Module)... Mar 2 00:28:56 smarttop systemd[1]: Started Apply Fan Curve to Lenovo Legion Laptop depending on Power State and Charger Mode (LenovoLegionLinux kernel Module). Mar 2 00:28:56 smarttop fancurve-set[280836]: /usr/bin/fancurve-set: line 21: /etc/legion_linux//.env: No such file or directory Mar 2 00:28:56 smarttop fancurve-set[280836]: Applying Balance Mode Profile  -> charger... Mar 2 00:28:56 smarttop fancurve-set[280845]: Traceback (most recent call last): Mar 2 00:28:56 smarttop fancurve-set[280845]: File "/usr/bin/legion_cli", line 33, in Mar 2 00:28:56 smarttop fancurve-set[280845]: sys.exit(load_entry_point('legion-linux==0.0.9', 'console_scripts', 'legion_cli')()) Mar 2 00:28:56 smarttop fancurve-set[280845]: File "/usr/lib/python3/dist-packages/legion_linux/legion_cli.py", line 471, in main Mar 2 00:28:56 smarttop fancurve-set[280845]: args.func(legion, **vars(args)) Mar 2 00:28:56 smarttop fancurve-set[280845]: File "/usr/lib/python3/dist-packages/legion_linux/legion_cli.py", line 312, in fancurve_write_preset_to_hw Mar 2 00:28:56 smarttop fancurve-set[280845]: legion.fancurve_write_preset_to_hw(presetname, write_minifancurve=True) Mar 2 00:28:56 smarttop fancurve-set[280845]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1481, in fancurve_write_preset_to_hw Mar 2 00:28:56 smarttop fancurve-set[280845]: self.load_fancurve_from_preset(name) Mar 2 00:28:56 smarttop fancurve-set[280845]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1475, in load_fancurve_from_preset Mar 2 00:28:56 smarttop fancurve-set[280845]: self.fan_curve = self.fancurve_repo.load_by_name(name) Mar 2 00:28:56 smarttop fancurve-set[280845]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1093, in load_by_name Mar 2 00:28:56 smarttop fancurve-set[280845]: return FanCurve.load_from_file(self._name_to_filename(name)) Mar 2 00:28:56 smarttop fancurve-set[280845]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 81, in load_from_file Mar 2 00:28:56 smarttop fancurve-set[280845]: with open(filename, 'r', encoding=DEFAULT_ENCODING) as filepointer: Mar 2 00:28:56 smarttop fancurve-set[280845]: FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//balanced-ac.yaml' Mar 2 00:28:56 smarttop systemd[1]: legion-linux.service: Main process exited, code=exited, status=1/FAILURE Mar 2 00:28:56 smarttop systemd[1]: legion-linux.service: Failed with result 'exit-code'. # toggle to performance Mar 2 00:29:36 smarttop kernel: [152546.665351] legion_laptop: Fan event: legion type: 2; acpi type: 3 (1=integer) Mar 2 00:29:37 smarttop systemd[1]: Starting Apply Fan Curve to Lenovo Legion Laptop depending on Power State and Charger Mode (LenovoLegionLinux kernel Module)... Mar 2 00:29:37 smarttop systemd[1]: Started Apply Fan Curve to Lenovo Legion Laptop depending on Power State and Charger Mode (LenovoLegionLinux kernel Module). Mar 2 00:29:37 smarttop fancurve-set[280959]: /usr/bin/fancurve-set: line 21: /etc/legion_linux//.env: No such file or directory Mar 2 00:29:37 smarttop fancurve-set[280959]: Applying Performance Mode Profile 龍 -> charger... Mar 2 00:29:37 smarttop fancurve-set[280968]: Traceback (most recent call last): Mar 2 00:29:37 smarttop fancurve-set[280968]: File "/usr/bin/legion_cli", line 33, in Mar 2 00:29:37 smarttop fancurve-set[280968]: sys.exit(load_entry_point('legion-linux==0.0.9', 'console_scripts', 'legion_cli')()) Mar 2 00:29:37 smarttop fancurve-set[280968]: File "/usr/lib/python3/dist-packages/legion_linux/legion_cli.py", line 471, in main Mar 2 00:29:37 smarttop fancurve-set[280968]: args.func(legion, **vars(args)) Mar 2 00:29:37 smarttop fancurve-set[280968]: File "/usr/lib/python3/dist-packages/legion_linux/legion_cli.py", line 312, in fancurve_write_preset_to_hw Mar 2 00:29:37 smarttop fancurve-set[280968]: legion.fancurve_write_preset_to_hw(presetname, write_minifancurve=True) Mar 2 00:29:37 smarttop fancurve-set[280968]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1481, in fancurve_write_preset_to_hw Mar 2 00:29:37 smarttop fancurve-set[280968]: self.load_fancurve_from_preset(name) Mar 2 00:29:37 smarttop fancurve-set[280968]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1475, in load_fancurve_from_preset Mar 2 00:29:37 smarttop fancurve-set[280968]: self.fan_curve = self.fancurve_repo.load_by_name(name) Mar 2 00:29:37 smarttop fancurve-set[280968]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1093, in load_by_name Mar 2 00:29:37 smarttop fancurve-set[280968]: return FanCurve.load_from_file(self._name_to_filename(name)) Mar 2 00:29:37 smarttop fancurve-set[280968]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 81, in load_from_file Mar 2 00:29:37 smarttop fancurve-set[280968]: with open(filename, 'r', encoding=DEFAULT_ENCODING) as filepointer: Mar 2 00:29:37 smarttop fancurve-set[280968]: FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//performance-ac.yaml' Mar 2 00:29:37 smarttop systemd[1]: legion-linux.service: Main process exited, code=exited, status=1/FAILURE Mar 2 00:29:37 smarttop systemd[1]: legion-linux.service: Failed with result 'exit-code'. # toggle to silent Mar 2 00:30:11 smarttop kernel: [152587.773329] legion_laptop: Fan event: legion type: 2; acpi type: 3 (1=integer) Mar 2 00:30:12 smarttop systemd[1]: Starting Apply Fan Curve to Lenovo Legion Laptop depending on Power State and Charger Mode (LenovoLegionLinux kernel Module)... Mar 2 00:30:12 smarttop systemd[1]: Started Apply Fan Curve to Lenovo Legion Laptop depending on Power State and Charger Mode (LenovoLegionLinux kernel Module). Mar 2 00:30:12 smarttop fancurve-set[281052]: /usr/bin/fancurve-set: line 21: /etc/legion_linux//.env: No such file or directory Mar 2 00:30:12 smarttop fancurve-set[281052]: Applying Quiet Mode Profile ﴛ -> charger... Mar 2 00:30:12 smarttop fancurve-set[281061]: Traceback (most recent call last): Mar 2 00:30:12 smarttop fancurve-set[281061]: File "/usr/bin/legion_cli", line 33, in Mar 2 00:30:12 smarttop fancurve-set[281061]: sys.exit(load_entry_point('legion-linux==0.0.9', 'console_scripts', 'legion_cli')()) Mar 2 00:30:12 smarttop fancurve-set[281061]: File "/usr/lib/python3/dist-packages/legion_linux/legion_cli.py", line 471, in main Mar 2 00:30:12 smarttop fancurve-set[281061]: args.func(legion, **vars(args)) Mar 2 00:30:12 smarttop fancurve-set[281061]: File "/usr/lib/python3/dist-packages/legion_linux/legion_cli.py", line 312, in fancurve_write_preset_to_hw Mar 2 00:30:12 smarttop fancurve-set[281061]: legion.fancurve_write_preset_to_hw(presetname, write_minifancurve=True) Mar 2 00:30:12 smarttop fancurve-set[281061]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1481, in fancurve_write_preset_to_hw Mar 2 00:30:12 smarttop fancurve-set[281061]: self.load_fancurve_from_preset(name) Mar 2 00:30:12 smarttop fancurve-set[281061]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1475, in load_fancurve_from_preset Mar 2 00:30:12 smarttop fancurve-set[281061]: self.fan_curve = self.fancurve_repo.load_by_name(name) Mar 2 00:30:12 smarttop fancurve-set[281061]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 1093, in load_by_name Mar 2 00:30:12 smarttop fancurve-set[281061]: return FanCurve.load_from_file(self._name_to_filename(name)) Mar 2 00:30:12 smarttop fancurve-set[281061]: File "/usr/lib/python3/dist-packages/legion_linux/legion.py", line 81, in load_from_file Mar 2 00:30:12 smarttop fancurve-set[281061]: with open(filename, 'r', encoding=DEFAULT_ENCODING) as filepointer: Mar 2 00:30:12 smarttop fancurve-set[281061]: FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//quiet-ac.yaml' Mar 2 00:30:12 smarttop systemd[1]: legion-linux.service: Main process exited, code=exited, status=1/FAILURE Mar 2 00:30:12 smarttop systemd[1]: legion-linux.service: Failed with result 'exit-code'. ```

  Model and Debug Info

   
Distribution: Pop!_OS (Ubuntu 24.04)
Model name: Legion Pro 5 16ARX8 - Type 82WM
CPU model: AMD Ryzen 9 7945HX
GPU model: NVIDIA GeForce RTX 4060
Keyboard backlight: single color with off/medium/bright
Light in lid or logo: yes
Light at IO-Ports at back: yes

 

Output of sudo dmidecode -t system. Please remove Serial Number and UUID for privacy:

```text # dmidecode 3.3 Getting SMBIOS data from sysfs. SMBIOS 3.4.0 present. Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: LENOVO Product Name: 82WM Version: Legion R9000P ARX8 Serial Number: ******** UUID: ********-****-****-****-************ Wake-up Type: Power Switch SKU Number: LENOVO_MT_82WM_BU_idea_FM_Legion R9000P ARX8 Family: Legion R9000P ARX8 Handle 0x0017, DMI type 12, 5 bytes System Configuration Options Option 1: String1 for Type12 Equipment Manufacturer Option 2: String2 for Type12 Equipment Manufacturer Option 3: String3 for Type12 Equipment Manufacturer Option 4: String4 for Type12 Equipment Manufacturer Handle 0x0026, DMI type 32, 20 bytes System Boot Information Status: No errors detected ```

Output of sudo dmidecode -t bios:

```text # dmidecode 3.3 Getting SMBIOS data from sysfs. SMBIOS 3.4.0 present. Handle 0x0000, DMI type 0, 26 bytes BIOS Information Vendor: LENOVO Version: LPCN49WW Release Date: 01/10/2024 Address: 0xE0000 Runtime Size: 128 kB ROM Size: 32 MB Characteristics: PCI is supported PNP is supported BIOS is upgradeable BIOS shadowing is allowed Boot from CD is supported Selectable boot is supported EDD is supported ACPI is supported USB legacy is supported BIOS boot specification is supported Function key-initiated network boot is supported Targeted content distribution is supported UEFI is supported BIOS Revision: 1.49 Firmware Revision: 1.49 Handle 0x0018, DMI type 13, 22 bytes BIOS Language Information Language Description Format: Long Installable Languages: 4 en|US|iso8859-1 fr|FR|iso8859-1 ja|JP|unicode zh|TW|unicode Currently Installed Language: en|US|iso8859-1 ```

Output of sudo cat /sys/kernel/debug/legion/fancurve:

```text EC Chip ID: 5507 EC Chip Version: 2a4 legion_laptop features: fancurve powermode platformprofile platformprofilenotify minifancurve legion_laptop ec_readonly: 0 ACPI CFG error: 0 ACPI CFG: 2081289482 temperature access method: 5 CPU temperature error: 0 CPU temperature: 45 CPU temperature EC error: 0 CPU temperature EC: 0 CPU temperature ACPI error: 0 CPU temperature ACPI: 45 CPU temperature WMI error: 0 CPU temperature WMI: 0 CPU temperature WMI2 error: 0 CPU temperature WMI2: 0 CPU temperature WMI3 error: 0 CPU temperature WMI3: 45 GPU temperature error: 0 GPU temperature: 0 GPU temperature EC error: 0 GPU temperature EC: 0 GPU temperature ACPI error: 0 GPU temperature ACPI: 0 GPU temperature WMI error: 0 GPU temperature WMI: 0 GPU temperature WMI2 error: 0 GPU temperature WMI2: 0 GPU temperature WMI3 error: 0 GPU temperature WMI3: 0 fan speed access method: 5 1 fanspeed error: 0 1 fanspeed: 1700 1 fanspeed EC error: 0 1 fanspeed EC: 48 1 fanspeed ACPI error: 0 1 fanspeed ACPI: 1700 1 fanspeed WMI error: 0 1 fanspeed WMI: 0 1 fanspeed WMI2 error: 0 1 fanspeed WMI2: 0 1 fanspeed WMI3 error: 0 1 fanspeed WMI3: 1700 2 fanspeed error: 0 2 fanspeed: 1600 2 fanspeed EC error: 0 2 fanspeed EC: 0 2 fanspeed ACPI error: 0 2 fanspeed ACPI: 1600 2 fanspeed WMI error: 0 2 fanspeed WMI: 0 2 fanspeed WMI2 error: 0 2 fanspeed WMI2: 0 2 fanspeed WMI3 error: 0 2 fanspeed WMI3: 1600 powermode access method: 3 powermode error: 0 powermode: 1 powermode EC error: 0 powermode EC: 2 powermode ACPI error: -5 powermode ACPI: 0 powermode WMI error: 0 powermode WMI: 1 has custom powermode: 1 ACPI rapidcharge error: 0 ACPI rapidcharge: 0 WMI backlight 2 state: 0 WMI backlight 3 state: 1 WMI light IO port: 0 WMI light Y logo/lid: 0 EC minifancurve feature enabled: 0 EC minifancurve on cool: error EC lockfancontroller error: 0 EC lockfancontroller: false fanfullspeed error: 0 fanfullspeed: 0 fanfullspeed EC error: 0 fanfullspeed EC: 0 EC fan curve current point id: 0 EC fan curve points size: 10 Current fan curve in hardware: rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ===================== Current fan curve in hardware (WMI; might be empty) rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ===================== ```
Flashwalker commented 4 months ago

I manually downloaded presets files from here https://github.com/johnfanv2/LenovoLegionLinux/tree/main/extra/service/profiles and now error gone. But looks like applying the preset to HW doesn't really works properly.

Load from Preset looks like this: Снимок экрана_2024-03-02_14-48-02

And after Apply to HW it looks different, like not all of the curve settings are applied: Снимок экрана_2024-03-02_14-49-23

And judging by the sensor readings, the preset was not appliedЖ

Fan 1:           1700 RPM
Fan 2:           1600 RPM
CPU Temperature:  +46.0°C
GPU Temperature:  +32.0°C

Fan 1:           1700 RPM
Fan 2:           1600 RPM
CPU Temperature:  +48.0°C
GPU Temperature:  +33.0°C

Fan 1:           1700 RPM
Fan 2:           1600 RPM
CPU Temperature:  +46.0°C
GPU Temperature:  +32.0°C
Flashwalker commented 4 months ago

Is there a way i can reset to defaults?

MrDuartePT commented 3 months ago

If you don’t have the systemd service enable on the Automation tab just change to the same power profile again.

The custom fancurve by the profiles only apply if the system service is enable

MrDuartePT commented 3 months ago

Problem Description I get error about the script can't find .env and other files when i toggle the performance profiles via Fn+Q.

...
/usr/bin/fancurve-set: line 21: /etc/legion_linux//.env: No such file or directory
...
FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//balanced-ac.yaml'
...
FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//performance-ac.yaml'
...
FileNotFoundError: [Errno 2] No such file or directory: '/etc/legion_linux//quiet-ac.yaml'
...

Also this error occur since your didn’t copy /usr/share/legion_linux to /etc/legion_linux and enable the systemd service

Flashwalker commented 3 months ago

Also this error occur since your didn’t copy /usr/share/legion_linux to /etc/legion_linux and enable the systemd service

Thanks