Увеличение времени работы linux от батареи
Купила себе новый лаптоп ThinkPad T-430. Обещали 16ч работы от батареи, но держал он только 4 и то, если яркость на минимум. При этом ос была Ubuntu 12.04. Батарейка в нем на 7700 мАч, и она явно должна держать больше чем 4 часа…
Погуглив была обнаружена tlp. Вкратце, это такая штука, которая рулит железом и можно удобно и главное быстро настроить, увеличив время работы от батареи.
После время работы от батарейки стало как минимум 9 часов, на максимальной яркости. В ноль разрядить не успела. После 3 часов работы на максимальной яркости, с запущенной виртуалкой и wifi осталось ~70% и вангамод вещал, что еще 6.5 часов можем жить ни о чем не беспокоясь. На минимальной не тестировала.
Запускать sudo tlp start
Можно еще посмотреть tlp —help и man tlp
Вот мой конфиг
root@irenica-ThinkPad-T430:/home/irenica# cat /etc/default/tlp
# ------------------------------------------------------------------------------
# tlp - Parameters for power save
# Hint: some features are disabled by default, remove the leading # to enable them
# Set to 0 to disable/1 to enable TLP
TLP_ENABLE=1
# Seconds laptop mode has to to wait after the disk goes idle before doing a sync.
# Non-zero value enables, zero disables laptop mode.
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
# Dirty page values (timeouts in secs).
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
# Select a cpu frequency scaling governor: ondemand/powersave/performance/conservative
# Important:
# - You *must* disable your distribution's governor settings or conflicts will occur
# - ondemand is sufficient for *almost all* workloads, you should know what you're doing!
CPU_SCALING_GOVERNOR_ON_AC=ondemand
CPU_SCALING_GOVERNOR_ON_BAT=powersave
# Set the min/max frequency available for the scaling governor.
# Possible values strongly depend on your cpu. For available frequencies see
# tlp-stat output, Section "+++ Processor".
# Hint: Parameters are disabled by default, remove the leading # to enable them,
# otherwise kernel default values are used.
#CPU_SCALING_MIN_FREQ_ON_AC=0
#CPU_SCALING_MAX_FREQ_ON_AC=0
#CPU_SCALING_MIN_FREQ_ON_BAT=0
#CPU_SCALING_MAX_FREQ_ON_BAT=0
# Set the cpu "turbo boost" feature: 0=disable / 1=allow
# Requires an Intel Core i processor and kernel 3.7 or later.
# Important:
# - This may conflict with your distribution's governor settings
# - A value of 1 does *not* activate boosting, it just allows it
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
# Minimize number of used cpu cores/hyper-threads under light load conditions
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1
# Kernel NMI Watchdog
# 0=disable (default, saves power) / 1=enable (for kernel debugging only)
NMI_WATCHDOG=0
# Change CPU voltages aka "undervolting" - Kernel with PHC patch required
# Freq:voltage pairs are written to /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
# CAUTION: only use this, if you thoroughly understand what you are doing!
#PHC_CONTROLS="F:V F:V F:V F:V"
# Hard disk devices, separate multiple devices with spaces (default: sda).
# Devices can be specified by disk id too (lookup with: tlp diskid).
DISK_DEVICES="sda sdb"
# Hard disk advanced power management level: 1(max saving)..254(off)
# Levels 1..127 may spin down the disk.
# Separate values for multiple devices with spaces.
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"
# Hard disk spin down timeout:
# 0: spin down disabled
# 1..240: timeouts from 5s to 20min (in units of 5s)
# 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
# (see 'man hdparm' for details)
#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
# Select io scheduler for the disk devices: noop/deadline/cfq (Default: cfq)
# Separate values for multiple devices with spaces.
#DISK_IOSCHED="cfq cfq"
# SATA aggressive link power management (ALPM):
# min_power/medium_power/max_performance
SATA_LINKPWR_ON_AC=max_performance
SATA_LINKPWR_ON_BAT=min_power
# PCI Express Active State Power Management (PCIe ASPM):
# default/performance/powersave
# Hint: needs kernel boot option pcie_aspm=force on some machines
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave
# Radeon graphics clock speed (profile method): low/mid/high/auto/default
# auto = mid on BAT, high on AC; default = use hardware defaults
# (Kernel >= 2.6.35 only, not with fglrx driver!)
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low
# New radeon dynamic power management method (dpm): battery/performance
# (Kernel >= 3.11 only, requires boot option radeon.dpm=1)
RADEON_DPM_STATE_ON_AC=performance
RADEON_DPM_STATE_ON_BAT=battery
# New radeon dpm performance level: auto/low/high (auto is recommended)
RADEON_DPM_PERF_LEVEL_ON_AC=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto
# WiFi power saving mode: 1=disable/5=enable
# (Linux 2.6.32 and later, some adapters only!)
WIFI_PWR_ON_AC=1
WIFI_PWR_ON_BAT=5
# Disable wake on lan: Y/N
WOL_DISABLE=Y
# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
# A value of 0 disables / >=1 enables power save.
SOUND_POWER_SAVE=1
# Disable controller too (HDA only): Y/N
SOUND_POWER_SAVE_CONTROLLER=Y
# Set to 1 to power off optical drive in UltraBay (ThinkPads only)
# when running on battery. A value of 0 disables this Feature (Default).
# Drive can be powered on again by releasing (and reinserting) the
# eject lever or by pressing the disc eject button on newer models.
# Note: an UltraBay hard disk is never powered off.
BAY_POWEROFF_ON_BAT=1
# Optical drive device to power off (default sr0)
BAY_DEVICE="sr0"
# Runtime Power Management for pci(e) bus devices
# (Kernel >= 2.6.35 only): on=disable/auto=enable
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto
# Runtime PM for *all* pci(e) bus devices, expect backlisted ones:
# 0=disable / 1=enable
# Warning: experimental option, could cause system instabilities
RUNTIME_PM_ALL=0
# Exclude pci(e) device adresses the following list from Runtime PM
# (separate with spaces). Use lspci to get the adresses (1st column).
#RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
# Set to 0 to disable/1 to enable usb autosuspend feature
USB_AUTOSUSPEND=1
# Devices from the following list are excluded from usb autosuspend
# (separate with spaces). Use lsusb to get the ids.
# Note: input devices (usbhid) are excluded automatically
#USB_BLACKLIST="1111:2222 3333:4444"
# WWAN devices are excluded from usb autosuspend:
# 0=do not exclude / 1=exclude
# Note: works for ids 05c6:* 0bdb:* 1199:* only
USB_BLACKLIST_WWAN=1
# Set to 1 to disable autosuspend before shutdown/0 to do nothing
# (workaround for usb devices that cause shutdown problems)
#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
# Restore radio device state (bluetooth, wifi, wwan) from previous shutdown
# on system startup: 0=disable/1=enable
# Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
# are ignored when this is enabled!
RESTORE_DEVICE_STATE_ON_STARTUP=0
# Radio devices to disable on startup: bluetooth wifi wwan
DEVICES_TO_DISABLE_ON_STARTUP="bluetooth"
# Radio devices to enable on startup: bluetooth wifi wwan
#DEVICES_TO_ENABLE_ON_STARTUP="wifi"
# Radio devices to disable on shutdown: bluetooth wifi wwan
# (workaround for devices that are blocking shutdown)
#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
# Radio devices to enable on shutdown: bluetooth wifi wwan
# (to prevent other operating systems from missing radios)
#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
# Radio devices to enable when wireless radio switch is turned on:
# bluetooth wifi wwan (Ubuntu + ThinkPad only)
DEVICES_TO_ENABLE_ON_RADIOSW="wifi wwan"
# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module required)
# Charging starts when the remaining capacity falls below the START_CHARGE_TRESH
# value and stops when exceeding the STOP_CHARGE_TRESH value.
# Main battery (values in %)
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80
# Ultrabay or slice battery (values in %)
#START_CHARGE_THRESH_BAT1=75
#STOP_CHARGE_THRESH_BAT1=80
# Set to 1 to disable use of tpacpi-bat on Sandy Bridge or newer Thinkpads
# and force usage of tp-smapi instead
DISABLE_TPACPIBAT=1
# ------------------------------------------------------------------------------
# tlp-rdw - Parameters for the radio device wizard
# Possible devices: bluetooth/wifi/wwan
# Hint: parameters are disabled by default, remove the leading # to enable them
# Radio devices to disable on connect
#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
# Radio devices to enable on disconnect
#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
# Radio devices to enable/disable when docked
#DEVICES_TO_ENABLE_ON_DOCK=""
#DEVICES_TO_DISABLE_ON_DOCK=""
# Radio devices to enable/disable when undocked
#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
#DEVICES_TO_DISABLE_ON_UNDOCK=""
«/home/irenica#» — Под рутом работать?! Фууу…
да, я ставлю пакеты и правлю конфиги от рута. неожидал?
Для этого есть sudo. Зачем же добровольно делать из Linux Windows?
мне нравится через su
назови причины по которым так делать не надо
Нет никакой причины кроме как тупой веры в Великое Убунту.
Технически, судо должно использоваться для пары команд, типа там reboot, shutdown, mount, umount.
А разрешать доступ ко всему из под судо крайне тупо — достаточно узнать пароль юзера и всё, имеешь полный доступ к системе.
Су же требует знания двух паролей что лично мне нравится куда больше.
Ну открой для себя «Defaults targetpw». Или, в конце концов, (как у меня) рут вообще задизейблен, на юзера автологин и пароль от юзера играет роль пароля от рута. И нет, это не убунточка, где так по дефолту сделано 🙂
«DISABLE_TPACPIBAT=1»
tp-smapi не работает на интелах Ivy Bridge
«Hint: do not use this option with Ivy Bridge models (X230, T430 et al.) where tpacpi-bat is mandatory because tp-smapi does not work.» — http://linrunner.de/en/tlp/docs/tlp-configuration.html
Если у тебя программа работает, то, либо у тебя не Ivy Bridge а Sandy Bridge и надо изменить на «DISABLE_TPACPIBAT=0», чтобы у копипастеров ничего не поломалось, либо в программе имеется защита от дурака — я без оскорблений и намеков=) , тогда это в статейке можно тоже отметить.