linrunner / TLP

TLP - Optimize Linux Laptop Battery Life
https://linrunner.de/tlp
GNU General Public License v2.0
2.74k stars 130 forks source link

TLP will not start #749

Closed JayH1119 closed 4 months ago

JayH1119 commented 4 months ago

[x] I've read and accepted the Bug Reporting Howto [x] I've provided all required tlp-stat outputs via Gist (see below)

tlp.service does not start successfully.

Output from systemctl status: Jul 09 09:08:57 jLaptop systemd[1]: Starting tlp.service - TLP system startup/shutdown... Jul 09 09:08:57 jLaptop tlp[1712]: Applying power save settings...done. Jul 09 09:08:57 jLaptop tlp[1712]: Setting battery charge thresholds.../usr/sbin/tlp: 14: readonly: BATDRV_LG_BCL: is read only Jul 09 09:08:57 jLaptop systemd[1]: tlp.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Jul 09 09:08:57 jLaptop systemd[1]: tlp.service: Failed with result 'exit-code'. Jul 09 09:08:57 jLaptop systemd[1]: Failed to start tlp.service - TLP system startup/shutdown.

Occurs at startup on A/C or battery. Also occurs when attempting to manually start the service.

  1. Full output of tlp-stat via https://gist.github.com/ for all matching cases of 1 (not as file attachment, no screenshots)

--- TLP 1.5.0 --------------------------------------------

+++ Configured Settings: defaults.conf L0004: TLP_ENABLE="1" defaults.conf L0005: TLP_WARN_LEVEL="3" defaults.conf L0006: TLP_PERSISTENT_DEFAULT="0" defaults.conf L0007: DISK_IDLE_SECS_ON_AC="0" defaults.conf L0008: DISK_IDLE_SECS_ON_BAT="2" defaults.conf L0009: MAX_LOST_WORK_SECS_ON_AC="15" defaults.conf L0010: MAX_LOST_WORK_SECS_ON_BAT="60" defaults.conf L0011: CPU_ENERGY_PERF_POLICY_ON_AC="balance_performance" defaults.conf L0012: CPU_ENERGY_PERF_POLICY_ON_BAT="balance_power" defaults.conf L0013: SCHED_POWERSAVE_ON_AC="0" defaults.conf L0014: SCHED_POWERSAVE_ON_BAT="1" defaults.conf L0015: NMI_WATCHDOG="0" defaults.conf L0016: DISK_DEVICES="nvme0n1 sda" defaults.conf L0017: DISK_APM_LEVEL_ON_AC="254 254" defaults.conf L0018: DISK_APM_LEVEL_ON_BAT="128 128" defaults.conf L0019: DISK_APM_CLASS_DENYLIST="usb ieee1394" defaults.conf L0020: DISK_IOSCHED="keep keep" defaults.conf L0021: SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance" defaults.conf L0022: SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power" defaults.conf L0023: AHCI_RUNTIME_PM_ON_AC="on" defaults.conf L0024: AHCI_RUNTIME_PM_ON_BAT="auto" defaults.conf L0025: AHCI_RUNTIME_PM_TIMEOUT="15" defaults.conf L0026: PCIE_ASPM_ON_AC="default" defaults.conf L0027: PCIE_ASPM_ON_BAT="default" defaults.conf L0028: RADEON_DPM_PERF_LEVEL_ON_AC="auto" defaults.conf L0029: RADEON_DPM_PERF_LEVEL_ON_BAT="auto" defaults.conf L0030: RADEON_POWER_PROFILE_ON_AC="default" defaults.conf L0031: RADEON_POWER_PROFILE_ON_BAT="default" defaults.conf L0032: WIFI_PWR_ON_AC="off" defaults.conf L0033: WIFI_PWR_ON_BAT="on" defaults.conf L0034: WOL_DISABLE="Y" defaults.conf L0035: SOUND_POWER_SAVE_ON_AC="1" defaults.conf L0036: SOUND_POWER_SAVE_ON_BAT="1" defaults.conf L0037: SOUND_POWER_SAVE_CONTROLLER="Y" defaults.conf L0038: BAY_POWEROFF_ON_AC="0" defaults.conf L0039: BAY_POWEROFF_ON_BAT="0" defaults.conf L0040: BAY_DEVICE="sr0" defaults.conf L0041: RUNTIME_PM_ON_AC="on" defaults.conf L0042: RUNTIME_PM_ON_BAT="auto" defaults.conf L0043: RUNTIME_PM_DRIVER_DENYLIST="mei_me nouveau radeon" defaults.conf L0044: USB_AUTOSUSPEND="1" defaults.conf L0045: USB_EXCLUDE_AUDIO="1" defaults.conf L0046: USB_EXCLUDE_BTUSB="0" defaults.conf L0047: USB_EXCLUDE_PHONE="0" defaults.conf L0048: USB_EXCLUDE_PRINTER="1" defaults.conf L0049: USB_EXCLUDE_WWAN="0" defaults.conf L0050: USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN="0" defaults.conf L0051: RESTORE_DEVICE_STATE_ON_STARTUP="0" defaults.conf L0052: RESTORE_THRESHOLDS_ON_BAT="0" defaults.conf L0053: NATACPI_ENABLE="1" defaults.conf L0054: TPACPI_ENABLE="1" defaults.conf L0055: TPSMAPI_ENABLE="1"

+++ System Info System = HP Type1ProductConfigId HP ENVY x360 Convertible 15m-bp1xx BIOS = F.39 OS Release = Debian GNU/Linux 12 (bookworm) Kernel = 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 /proc/cmdline = root=UUID=dd366370-d146-45df-ae17-92d2b5ca54bf ro nosplash initrd=boot\initrd.img Init system = systemd v252 (252.26-1~deb12u2) Boot mode = UEFI

+++ TLP Status State = enabled RDW state = enabled Last run = 09:20:04, 1653 sec(s) ago Mode = battery Power source = battery

+++ Processor CPU model = Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 400000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 3400000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = balance_power [HWP.EPP] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power

/sys/devices/system/cpu/cpu1..cpu7: omitted for clarity, use -v to show all

/sys/devices/system/cpu/intel_pstate/status = active /sys/devices/system/cpu/intel_pstate/min_perf_pct = 11 [%] /sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%] /sys/devices/system/cpu/intel_pstate/no_turbo = 0 /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost = 0 /sys/devices/system/cpu/intel_pstate/turbo_pct = 59 [%] /sys/devices/system/cpu/intel_pstate/num_pstates = 31

/sys/module/workqueue/parameters/power_efficient = N /proc/sys/kernel/nmi_watchdog = 0

+++ Platform Profile /sys/firmware/acpi/platform_profile = (not available) /sys/firmware/acpi/platform_profile_choices = (not available)

+++ Temperatures CPU temp = 36 [°C] Fan speed = (not available)

+++ File System /proc/sys/vm/laptop_mode = 2 /proc/sys/vm/dirty_writeback_centisecs = 6000 /proc/sys/vm/dirty_expire_centisecs = 6000 /proc/sys/vm/dirty_ratio = 20 /proc/sys/vm/dirty_background_ratio = 10

+++ Disks Devices = nvme0n1 sda

/dev/nvme0n1: Type = NVMe Disk ID = nvme-CT1000P1SSD8_1920E2049624 Model = CT1000P1SSD8
Firmware = P3CR010 Temp = 33 °C Scheduler = [none] mq-deadline (multi queue)

Runtime PM: /sys/block/nvme0n1/device/power/control = auto, autosuspend_delay_ms = (not available)

SMART info: Critical Warning: 0x00 Temperature: 33 Celsius Available Spare: 100% Available Spare Threshold: 10% Percentage Used: 1% Data Units Written: 33,583,400 [17.1 TB] Power Cycles: 3,441 Power On Hours: 10,973 Unsafe Shutdowns: 97 Media and Data Integrity Errors: 838

/dev/sda: Type = SATA Disk ID = ata-ST1000LM049-2GH172_WGS0NSB9 Model = ST1000LM049-2GH172
Firmware = RXM3
APM Level = 128 Status = active/idle Host = host2 Scheduler = [mq-deadline] none (multi queue)

Runtime PM: /sys/block/sda/device/power/control = auto, autosuspend_delay_ms = 15000

SMART info: 4 Start_Stop_Count = 20950 5 Reallocated_Sector_Ct = 0 9 Power_On_Hours = 16672 [h] 12 Power_Cycle_Count = 3589 190 Airflow_Temperature_Cel = 30 [°C] 191 G-Sense_Error_Rate = 4 193 Load_Cycle_Count = 81091 194 Temperature_Celsius = 30 (0 3 0 [°C]

+++ AHCI Link Power Management (ALPM) :: SATA Links /sys/bus/pci/devices/0000:00:17.0/ata1/host0/scsi_host/host0/link_power_management_policy = med_power_with_dipm /sys/bus/pci/devices/0000:00:17.0/ata2/host1/scsi_host/host1/link_power_management_policy = med_power_with_dipm /sys/bus/pci/devices/0000:00:17.0/ata3/host2/scsi_host/host2/link_power_management_policy = med_power_with_dipm -- sda

+++ AHCI Port Runtime Power Management :: SATA/ATA Ports /sys/bus/pci/devices/0000:00:17.0/ata1/power/control = auto /sys/bus/pci/devices/0000:00:17.0/ata2/power/control = auto /sys/bus/pci/devices/0000:00:17.0/ata3/power/control = auto -- sda

+++ Docks and Device Bays /sys/devices/platform/dock.0: dock_station = undocked

+++ Intel Graphics /sys/class/drm/card0/device/driver = i915

/sys/class/drm/card0/power/rc6_enable = 1 (enabled) /sys/kernel/debug/dri/0/i915_fbc_status = FBC enabled /sys/module/i915/parameters/enable_psr = -1 (use per-chip default)

/sys/class/drm/card0/gt_min_freq_mhz = 300 [MHz] /sys/class/drm/card0/gt_max_freq_mhz = 1100 [MHz] /sys/class/drm/card0/gt_boost_freq_mhz = 1100 [MHz] /sys/class/drm/card0/gt_RPn_freq_mhz = 300 [MHz] (GPU min) /sys/class/drm/card0/gt_RP0_freq_mhz = 1100 [MHz] (GPU max)

+++ Wireless bluetooth = on nfc = none (no device) wifi = on wwan = none (no device)

hci0(btusb) : bluetooth, not connected wlo1(iwlwifi) : wifi, connected, power management = on

+++ Audio /sys/module/snd_hda_intel/parameters/power_save = 1 /sys/module/snd_hda_intel/parameters/power_save_controller = Y

+++ PCIe Active State Power Management /sys/module/pcie_aspm/parameters/policy = [default] performance powersave powersupersave (using BIOS preferences)

+++ PCIe Runtime Power Management Enable devices = (disabled) Disable devices = (disabled) Device denylist = (disabled) Driver denylist = mei_me nouveau radeon

/sys/bus/pci/devices/0000:00:00.0/power/control = auto (0x060000, Host bridge, skl_uncore) /sys/bus/pci/devices/0000:00:02.0/power/control = auto (0x030000, VGA compatible controller, i915) /sys/bus/pci/devices/0000:00:04.0/power/control = auto (0x118000, Signal processing controller, proc_thermal) /sys/bus/pci/devices/0000:00:13.0/power/control = auto (0x000000, Non-VGA unclassified device, intel_ish_ipc) /sys/bus/pci/devices/0000:00:14.0/power/control = auto (0x0c0330, USB controller, xhci_hcd) /sys/bus/pci/devices/0000:00:14.2/power/control = auto (0x118000, Signal processing controller, intel_pch_thermal) /sys/bus/pci/devices/0000:00:15.0/power/control = auto (0x118000, Signal processing controller, intel-lpss) /sys/bus/pci/devices/0000:00:15.1/power/control = auto (0x118000, Signal processing controller, intel-lpss) /sys/bus/pci/devices/0000:00:16.0/power/control = auto (0x078000, Communication controller, mei_me) /sys/bus/pci/devices/0000:00:17.0/power/control = auto (0x010601, SATA controller, ahci) /sys/bus/pci/devices/0000:00:1c.0/power/control = auto (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:00:1d.0/power/control = auto (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:00:1f.0/power/control = auto (0x060100, ISA bridge, no driver) /sys/bus/pci/devices/0000:00:1f.2/power/control = auto (0x058000, Memory controller, no driver) /sys/bus/pci/devices/0000:00:1f.3/power/control = auto (0x040380, Audio device, snd_hda_intel) /sys/bus/pci/devices/0000:00:1f.4/power/control = auto (0x0c0500, SMBus, i801_smbus) /sys/bus/pci/devices/0000:01:00.0/power/control = auto (0x010802, Non-Volatile memory controller, nvme) /sys/bus/pci/devices/0000:02:00.0/power/control = auto (0x028000, Network controller, iwlwifi)

+++ USB Autosuspend = enabled Device allowlist = (not configured) Device denylist = (not configured) Exclude audio = enabled Exclude bluetooth = disabled Exclude phones = disabled Exclude printers = enabled Exclude WWAN = disabled

Bus 002 Device 001 ID 1d6b:0003 control = auto, autosuspend_delay_ms = 0 -- Linux Foundation 3.0 root hub (hub) Bus 001 Device 003 ID 8087:0a2a control = auto, autosuspend_delay_ms = 2000 -- Intel Corp. Bluetooth wireless interface (btusb) Bus 001 Device 002 ID 04f2:b593 control = auto, autosuspend_delay_ms = 2000 -- Chicony Electronics Co., Ltd HP Wide Vision FHD Camera (uvcvideo) Bus 001 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms = 0 -- Linux Foundation 2.0 root hub (hub)

Additional context

The battery in this laptop has been replaced with an aftermarket unit. Occasionally the laptop does not fully power down and I am forced to hold down the power key to achieve shut-off.

linrunner commented 4 months ago

At this point, the service start is aborted:

Jul 09 09:08:57 jLaptop tlp[1712]: Setting battery charge thresholds.../usr/sbin/tlp: 14: readonly: BATDRV_LG_BCL: is read only

However, the error that the shell thinks it recognizes in the script does not exist. I cannot reproduce it here under Bookworm either.

I need to know which shell is running the scripts on your system. Please show the output of

ls -l /bin/sh
cat /etc/shells

Does the problem also occur with this command (show the output)?

sudo tlp noop

Then please reinstall TLP and check if the error still occurs (show the output):

sudo apt install --reinstall tlp
JayH1119 commented 4 months ago

After reboot:

jay@jLaptop:~$ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Jan 5 2023 /bin/sh -> dash

jay@jLaptop:~$ cat /etc/shells /bin/sh /bin/bash /usr/bin/bash /bin/rbash /usr/bin/rbash /bin/dash /usr/bin/dash /bin/zsh /usr/bin/zsh /usr/bin/sh

jay@jLaptop:~$ echo $SHELL /bin/zsh

jay@jLaptop:~$ sudo tlp noop
/usr/sbin/tlp: 14: readonly: BATDRV_LG_BCL: is read only

linrunner commented 4 months ago

Have you done the reinstallation?

JayH1119 commented 4 months ago

Apologies, yes. After reinstall and reboot...

linrunner commented 4 months ago

Then let's take a look what the shell actually does:

sudo sh -x /usr/sbin/tlp noop 2>&1 > tlp-noop.out

Please attach the output file tlp-noop.out.

JayH1119 commented 4 months ago

jay@jLaptop:~$ sudo sh -x /usr/sbin/tlp noop > tlp-noop.out

linrunner commented 4 months ago

/usr/share/tlp/bat.d/36-lg-legacy

This file is the cause. It is not included in the Debian Bookworm package tlp 1.5.0-2. It is only available in later TLP versions.

How does it get on your disk?

JayH1119 commented 4 months ago

Well, that's embarrassing. I had previously installed and removed tlp, apparently from source rather than from the distro, and that was leftover.

Thank you kindly for your time.

linrunner commented 4 months ago

That's what I suspected. You should uninstall the package once more, delete the directory /usr/share/tlp and install the package again.