====== GNU/Linux on the Lenovo ThinkPad L380 ======
Notes about installing **Debian GNU/Linux 13 Trixie** on the **Lenovo ThinkPad L380** notebook.
^ CPU | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz, 4 cores |
^ RAM | 16 Gb (option) |
^ Storage | M.2 solid-state drive SSD 256 Gb (option) |
^ Display | 13.3 inch (1920 x 1080) IPS |
^ Battery | 45 Wh |
^ Dimensions | 32.18 cm x 22.42 cm x 1.88 cm |
^ Weight | 1.420 kg |
^ Bootstrap special keys ^^
^ F1 | BIOS Setup |
^ F12 | Boot Menu |
===== Upgrading the SSD =====
The notebook has an **[[wp>M.2|M.2 slot]]** that can accomodte **2280** modules (22 mm wide and 80 mm long). The interface supports both the legacy **SATA** and newer **NVMe** protocol. I successfully installed a Crucial P310 SSD 1TB NVMe rated up to 7.100 MB/s.
Replacing the SSD requires to **disassemble tha back** of the notebook, unscrewing the **9 screws** and gently separating the back cover with a plastic blade.
===== Installing Debian 13 =====
=== Supported devices ===
^ Device ^ Works ^ Note |
^ Wi-Fi card | Yes | Intel Corporation Dual Band Wireless-AC 8265 |
^ Sound card | Yes | Intel Corporation HD Audio |
^ Video controller | Yes | Intel Corporation HD Graphics 620 |
^ Display | Yes | eDP 1920x1080@60 |
^ Keyboard backlight | Yes | Press Fn+SPACE |
^ Touchpad | Yes | Single and double tap, two finger scroll, two finger tap, etc. |
^ Camera | Yes | USB ID 5986:2113 Bison Electronics Inc. SunplusIT Integrated Camera |
===== BIOS =====
^ UEFI BIOS Verion | R0RET29W (1.12) |
^ UEFI BIOS Date | 2018-05-24 |
^ Embedded Controller Version | R0RHT24W (1.07) |
^ ME Firmware Version | 11.8.50.3460 |
^ Machine Type Model | 20M6S1NA00 |
* BIOS
* Config
* Fn and Ctrl Key swap [Enabled]
* F1-F12 as Primary Function [Enabled]
===== Battery =====
This notebook has a smart battery management automatically enabled. This means that sometimes, when the AC power is connected, the battery starts to discharge and overall charge goes below 100%. This should ensure less stress on the battery, which is not kept unnecessarily charged at 100% for prolonged periods.
To manage power saving settings manually and control battery care features, install the Debian package **tlp**.
**Debian 13 Trixie** provides **tlp v1.8.0** which supports two profiles: **AC** and **BAT**. The profiles are automatically selected on AC power and on battery, or manually by the user.
To view system information and TLP status:
tlp-stat --system
To view battery data and voltage:
tlp-stat --battery --verbose
The Thinkpad driver supports two important features: **charge thresholds** and **recalibration**:
Plugin: thinkpad
Supported features: charge thresholds, recalibration
The main configuration file is **/etc/tlp.conf**, where you can change the default **TLP_ENABLE=1**. If you change the configuration you have to restart the service:
systemctl restart tlp.service
Actually there is not a running daemon, the program just write the configuration to the appropriate kernel pseudo files and terminates.
Two options control the battery care, which aims to extend the lifespan of the battery by reducing wear and capacity loss resulting from ongoing operation; you can configure them e.g. into **/etc/tlp.d/00-local.conf**:
# Battery charge level below which charging will begin when connecting the charger.
START_CHARGE_THRESH_BAT0=80
# Battery charge level above which charging will stop while the charger is connected.
STOP_CHARGE_THRESH_BAT0=85
:!: **NOTICE**: Once configured and restarted the service, the output of ''%%tlp-stat --battery%%'' **may not reflect the configured values**. As reported in **[[https://linrunner.de/tlp/faq/battery.html|this page]]** it is common on the Thinkpad that one of the two threshold values is always displayed incorrectly. Another common pitfall is that you have to discharge the battery below the old start threshold after writing the new threshold. I can confirm that the **charge_control_end_threshold** reported by the pseudofile does not reflect the set value but it show the same value of **charge_control_start_threshold**, neverthless the charge logic is working correctly.
=== Setcharge: start and stop (end) thresholds ===
To change the battery charge thresholds temporarily you can issue the command:
tlp setcharge 0 90
this will e.g. raise the **stop threshold** to 90%. You can restore the defaults executing the command without the threshold arguments:
tlp setcharge
:!: **NOTICE**: As noted above, after you set the **charge_control_end_threshold**, its value is reported incorrectly by ''tlp-stat --battery'' (it shows a value equal to the charge_control_start_threshold) despite it is working as expected. So also the **Recommendations** shown by the tlp-stat command are misleading. Notice also that setting the **charge_control_start_threshold** to zero will automatically set the **charge_control_end_threshold** to 100.
You can also trigger a battery charge to the full capacity (according to the vendor presets) issuing the command (FIXME check if this is actually working):
tlp fullcharge
=== Recalibrate ===
While on AC power you can force a recalibration cycle, i.e. completely discharge the battery and recharge to 100%, by issuing the command:
tlp recalibrate
The **recalibrate** procedure is actually an interactive multistep process. The program will set the start and stop thresholds to 96 and switches the **charge_behaviour** to **force-discharge**. Then it waits for the battery to go below 10% before switching back the **charge_behaviour** to **auto**. You should then allow the battery to reach a 100% charge, to let the firmware to update the **energy_full** parameter, which along with the energy_full_design determines the battery actual capacity.
=== charge_behaviour ===
The following command will force the battery status to **Discharging**, even if AC adapter is attached. Sometimes the system returns the error message ''write error: Input/output error'', and you need to issue the command a second time to let the charge_behaviour actually change:
# Sometime need to be issued two times to work.
echo "force-discharge" > /sys/class/power_supply/BAT0/charge_behaviour
This command instead does not work, the ''write error'' message is reported and **charge_behaviour** does not change:
# Does not work!
echo "inhibit-charge" > /sys/class/power_supply/BAT0/charge_behaviour
The default behavior is **auto** where the BIOS should take care of the best setting:
echo "auto" > /sys/class/power_supply/BAT0/charge_behaviour
According to this **[[https://forums.lenovo.com/t5/Other-Linux-Discussions/ThinkPad-P14s-Gen-4-AMD-charge-behaviour-doesn-t-work/m-p/5287155|post]]**, it seems that there are some incompatibilities between Linux kernel and battery firmware.
===== Boot on lid opening =====
FIXME Sometimes the notebook **power-up itself automatically** when the **lid is opened**. It seems that there is not BIOS option to disable this behaviour.
===== Kernel error messages =====
kernel: [ 2680.959153] Uhhuh. NMI received for unknown reason 2c on CPU 0.
kernel: [ 2680.959171] Dazed and confised, but trying to continue
Something related to power management?
===== Web Resources =====
* **[[https://linrunner.de/tlp/settings/battery.html|Battery Care - TLP 1.8.0 documentation]]**
* **[[https://linrunner.de/tlp/settings/bc-vendors.html|Battery Care Vendor Specifics - TLP 1.8.0 documentation]]**