Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0

2019-07-13 21:44发布

转载于:https://www.linuxidc.com/Linux/2017-12/149232.htm TLP是Linux下高级电源管理工具。以下是在Ubuntu 14.04,Ubuntu 16.04,Ubuntu 17.10以及衍生版中通过PPA安装最新的1.0版本。 TLP是一个具有自动后台任务的命令行工具。它带有一个配置(/etc/default/tlp),默认已经针对电池寿命进行了优化,所以您可以安装并后就不用什么要做的了。尽管如此,TLP是高度可定制的,以满足您的具体要求。 如何在Ubuntu下安装TLP 1.0: 虽然Ubuntu软件只提供旧版本,但您可以随时从其官方PPA安装最新的TLP。到目前为止,支持Ubuntu 14.04,Ubuntu 16.04,Ubuntu 17.04和Ubuntu 17.10。 1. 打开终端通过Ctrl + Alt + T或通过搜索“终端”形式的应用程序启动器。 当它打开时,运行命令: Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 linuxidc@linuxidc:~$ sudo add-apt-repository ppa:linrunner/tlp
[sudo] linuxidc 的密码: 在提示时输入您的密码(无视觉反馈),按Enter键继续添加PPA。
 TLP is a power management tool for Linux. It brings you the benefits of advanced power management without the need to understand every technical detail. Project homepage: http://linrunner.de/tlp Note: starting with Ubuntu Wily TLP is provided via the official Ubuntu repos. Only newer versions will be published here.
 更多信息: https://launchpad.net/~linrunner/+archive/ubuntu/tlp
Press [ENTER] to continue or Ctrl-c to cancel adding it. gpg: keybox '/tmp/tmp65mlg99j/pubring.gpg' created
gpg: /tmp/tmp65mlg99j/trustdb.gpg:建立了信任度数据库
gpg: 密钥 2B3F92F902D65EFF:公钥“Launchpad PPA for linrunner”已导入
gpg: 合计被处理的数量:1
gpg:              已导入:1
OK 2. 如果您安装了以前的版本,请通过Software Updater实用程序升级模拟器升级TLP。 或者直接运行以下命令来安装(或升级)TLP: linuxidc@linuxidc:~$ sudo apt-get update
命中:1 http://cn.archive.ubuntu.com/ubuntu artful InRelease
获取:2 http://cn.archive.ubuntu.com/ubuntu artful-updates InRelease [78.6 kB] 
获取:3 http://cn.archive.ubuntu.com/ubuntu artful-backports InRelease [72.2 kB]
获取:4 http://cn.archive.ubuntu.com/ubuntu artful-updates/main i386 Packages [109 kB] ...... linuxidc@linuxidc:~$ sudo apt-get install tlp
正在读取软件包列表... 完成
正在分析软件包的依赖关系树     
正在读取状态信息... 完成     
将会同时安装下列软件:
  ethtool libgsasl7 libkyotocabinet16v5 libmailutils5 libmysqlclient20
  libntlm0 libunwind8 linux-tools-4.13.0-19 linux-tools-4.13.0-19-generic
  linux-tools-common linux-tools-virtual mailutils mailutils-common
  mysql-common postfix smartmontools tlp-rdw
建议安装:
  mailutils-mh mailutils-doc procmail postfix-mysql postfix-pgsql postfix-ldap
  postfix-pcre postfix-lmdb postfix-sqlite sasl2-bin dovecot-common resolvconf
  postfix-cdb postfix-doc gsmartcontrol smart-notifier tp-smapi-dkms
  acpi-call-dkms
下列【新】软件包将被安装:
  ethtool libgsasl7 libkyotocabinet16v5 libmailutils5 libmysqlclient20
  libntlm0 libunwind8 linux-tools-4.13.0-19 linux-tools-4.13.0-19-generic
  linux-tools-common linux-tools-virtual mailutils mailutils-common
  mysql-common postfix smartmontools tlp tlp-rdw
升级了 0 个软件包,新安装了 18 个软件包,要卸载 0 个软件包,有 36 个软件包未被升级。
需要下载 5,205 kB 的归档。
解压缩后会消耗 23.3 MB 的额外空间。
您希望继续执行吗? [Y/n] Y Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 安装过程中还会提示如下内容 Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 安装后,TLP作为后台任务静静地运行。您可以通过编辑/etc/default/tlp来更改默认设置,或使用命令行工具来指定您的需求。阅读完整的文档安装成功后,就可以启动TLP或者reboot(重启) sudo tlp start 检查TLP是否正常运行 sudo tlp-stat Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 linuxidc@linuxidc:~$ sudo tlp stat
[sudo] linuxidc 的密码:
--- TLP 1.0 -------------------------------------------- +++ Configured Settings: /etc/default/tlp
TLP_ENABLE=1
TLP_DEFAULT_MODE=AC
TLP_PERSISTENT_DEFAULT=0
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
CPU_HWP_ON_AC=balance_performance
CPU_HWP_ON_BAT=balance_power
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1
NMI_WATCHDOG=0
ENERGY_PERF_POLICY_ON_AC=performance
ENERGY_PERF_POLICY_ON_BAT=powersave
DISK_DEVICES="sda sdb"
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"
SATA_LINKPWR_ON_AC=max_performance
SATA_LINKPWR_ON_BAT=min_power
AHCI_RUNTIME_PM_TIMEOUT=15
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low
RADEON_DPM_STATE_ON_AC=performance
RADEON_DPM_STATE_ON_BAT=battery
RADEON_DPM_PERF_LEVEL_ON_AC=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on
WOL_DISABLE=Y
SOUND_POWER_SAVE_ON_AC=0
SOUND_POWER_SAVE_ON_BAT=1
SOUND_POWER_SAVE_CONTROLLER=Y
BAY_POWEROFF_ON_AC=0
BAY_POWEROFF_ON_BAT=0
BAY_DEVICE="sr0"
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto
USB_AUTOSUSPEND=1
USB_BLACKLIST_BTUSB=0
USB_BLACKLIST_PHONE=0
USB_BLACKLIST_WWAN=1
RESTORE_DEVICE_STATE_ON_STARTUP=0 +++ System Info
System        = Hewlett-Packard 0999200000200010000610101 HP 242 G2 Notebook PC
BIOS          = F.01
Release        = Ubuntu 17.10
Kernel        = 4.13.0-17-generic #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017 x86_64
/proc/cmdline  = BOOT_IMAGE=/vmlinuz-4.13.0-17-generic.efi.signed root=UUID=61bddbce-c91d-43e1-acd2-ae110433b841 ro quiet splash vt.handoff=7
Init system    = systemd v234
Boot mode      = UEFI +++ TLP Status
State          = enabled
Last run      = unknown
Mode          = unknown
Power source  = AC +++ Processor
CPU model      = Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz /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  =  800000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  3100000 [kHz] /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq  =  800000 [kHz]
/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq  =  3100000 [kHz] /sys/devices/system/cpu/cpu2/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq  =  800000 [kHz]
/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq  =  3100000 [kHz] /sys/devices/system/cpu/cpu3/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq  =  800000 [kHz]
/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq  =  3100000 [kHz] /sys/devices/system/cpu/intel_pstate/min_perf_pct      =  25 [%]
/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/turbo_pct        =  25 [%]
/sys/devices/system/cpu/intel_pstate/num_pstates      =  24 x86_energy_perf_policy: program for your kernel not installed. /sys/module/workqueue/parameters/power_efficient      = Y
/proc/sys/kernel/nmi_watchdog                          = 1 +++ Undervolting
PHC kernel not available. +++ Temperatures
CPU temp              =    42 [°C]
Fan speed              = (not available) +++ File System
/proc/sys/vm/laptop_mode              =    0
/proc/sys/vm/dirty_writeback_centisecs =  500
/proc/sys/vm/dirty_expire_centisecs    =  3000
/proc/sys/vm/dirty_ratio              =    20
/proc/sys/vm/dirty_background_ratio    =    10 +++ Storage Devices
/dev/sda:
  Model    = WDC WD1200BEVS-22UST0                 
  Firmware  = 01.01A01
  APM Level = 254
  Status    = active/idle
  Scheduler = cfq   Runtime PM: control = on, autosuspend_delay =  -1   SMART info:
      4 Start_Stop_Count          =    7307
      5 Reallocated_Sector_Ct    =        0
      9 Power_On_Hours            =    14093 [h]
    12 Power_Cycle_Count        =    6184
    193 Load_Cycle_Count          =  433570
    194 Temperature_Celsius      =      26    [°C]
+++ SATA Aggressive Link Power Management
/sys/class/scsi_host/host0/link_power_management_policy  = max_performance
/sys/class/scsi_host/host1/link_power_management_policy  = max_performance
/sys/class/scsi_host/host2/link_power_management_policy  = max_performance
/sys/class/scsi_host/host3/link_power_management_policy  = max_performance
/sys/class/scsi_host/host4/link_power_management_policy  = max_performance
/sys/class/scsi_host/host5/link_power_management_policy  = max_performance +++ AHCI Host Controller Runtime Power Management
/sys/bus/pci/devices/0000:00:1f.2/ata1/power/control = on
/sys/bus/pci/devices/0000:00:1f.2/ata2/power/control = on
/sys/bus/pci/devices/0000:00:1f.2/ata3/power/control = on
/sys/bus/pci/devices/0000:00:1f.2/ata4/power/control = on
/sys/bus/pci/devices/0000:00:1f.2/ata5/power/control = on
/sys/bus/pci/devices/0000:00:1f.2/ata6/power/control = on +++ PCIe Active State Power Management
/sys/module/pcie_aspm/parameters/policy = default (using bios preferences) +++ Intel Graphics
/sys/module/i915/parameters/enable_rc6      =  1 (enabled)
/sys/module/i915/parameters/enable_dc        = -1 (use per-chip default)
/sys/module/i915/parameters/enable_fbc      =  0 (disabled)
/sys/module/i915/parameters/enable_psr      =  0 (disabled)
/sys/module/i915/parameters/modeset          = -1 (use per-chip default)
/sys/module/i915/parameters/semaphores      =  1 (enabled) +++ Radeon Graphics
/sys/class/drm/card1/device/power_dpm_state = balanced
/sys/class/drm/card1/device/power_dpm_force_performance_level = off +++ Wireless
bluetooth = none (no device)
wifi      = on
wwan      = none (no device) wlo1(rt2800pci)              : wifi, connected, power management = on +++ Audio
/sys/module/snd_hda_intel/parameters/power_save            = 0
/sys/module/snd_hda_intel/parameters/power_save_controller = Y +++ Runtime Power Management
Device blacklist = (not configured)
Driver blacklist = amdgpu nouveau nvidia radeon (default) /sys/bus/pci/devices/0000:00:00.0/power/control = on  (0x060000, Host bridge, no driver)
/sys/bus/pci/devices/0000:00:01.0/power/control = on  (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:02.0/power/control = on  (0x030000, VGA compatible controller, i915)
/sys/bus/pci/devices/0000:00:03.0/power/control = on  (0x040300, Audio device, snd_hda_intel)
/sys/bus/pci/devices/0000:00:14.0/power/control = on  (0x0c0330, USB controller, xhci_hcd)
/sys/bus/pci/devices/0000:00:16.0/power/control = on  (0x078000, Communication controller, mei_me)
/sys/bus/pci/devices/0000:00:1a.0/power/control = on  (0x0c0320, USB controller, ehci-pci)
/sys/bus/pci/devices/0000:00:1b.0/power/control = on  (0x040300, Audio device, snd_hda_intel)
/sys/bus/pci/devices/0000:00:1c.0/power/control = on  (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:1c.2/power/control = on  (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:1c.3/power/control = on  (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:1c.6/power/control = on  (0x060400, PCI bridge, pcieport)
/sys/bus/pci/devices/0000:00:1d.0/power/control = on  (0x0c0320, USB controller, ehci-pci)
/sys/bus/pci/devices/0000:00:1f.0/power/control = on  (0x060100, ISA bridge, lpc_ich)
/sys/bus/pci/devices/0000:00:1f.2/power/control = on  (0x010601, SATA controller, ahci)
/sys/bus/pci/devices/0000:00:1f.3/power/control = on  (0x0c0500, SMBus, no driver)
/sys/bus/pci/devices/0000:01:00.0/power/control = auto (0x038000, Display controller, radeon)
/sys/bus/pci/devices/0000:07:00.0/power/control = on  (0x028000, Network controller, rt2800pci)
/sys/bus/pci/devices/0000:07:00.1/power/control = on  (0x0d1100, Bluetooth, no driver)
/sys/bus/pci/devices/0000:09:00.0/power/control = on  (0xff0000, Unassigned class [ff00], rtsx_pci)
/sys/bus/pci/devices/0000:0f:00.0/power/control = on  (0x020000, Ethernet controller, r8169) +++ USB
Autosuspend        = enabled
Device whitelist    = (not configured)
Device blacklist    = (not configured)
Bluetooth blacklist = disabled
Phone blacklist    = disabled
WWAN blacklist      = enabled Bus 002 Device 002 ID 8087:8000 control = auto, autosuspend_delay_ms =    0 -- Intel Corp.  (hub)
Bus 002 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 2.0 root hub (hub)
Bus 001 Device 002 ID 8087:8008 control = auto, autosuspend_delay_ms =    0 -- Intel Corp.  (hub)
Bus 001 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 2.0 root hub (hub)
Bus 004 Device 001 ID 1d6b:0003 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 3.0 root hub (hub)
Bus 003 Device 003 ID 04f2:b40d control = auto, autosuspend_delay_ms =  2000 -- Chicony Electronics Co., Ltd  (uvcvideo)
Bus 003 Device 004 ID 058f:6366 control = on,  autosuspend_delay_ms =  2000 -- Alcor Micro Corp. Multi Flash Reader (usb-storage)
Bus 003 Device 002 ID 10c4:8105 control = on,  autosuspend_delay_ms =  2000 -- Cygnal Integrated Products, Inc.  (usbhid)
Bus 003 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms =    0 -- Linux Foundation 2.0 root hub (hub) +++ Battery Status
/sys/class/power_supply/BAT0/manufacturer                  = Hewlett-Packard
/sys/class/power_supply/BAT0/model_name                    = Primary
/sys/class/power_supply/BAT0/cycle_count                    = (not supported)
/sys/class/power_supply/BAT0/charge_full_design            =  2599 [mAh]
/sys/class/power_supply/BAT0/charge_full                    =  2599 [mAh]
/sys/class/power_supply/BAT0/charge_now                    =  2599 [mAh]
/sys/class/power_supply/BAT0/current_now                    =      0 [mA]
/sys/class/power_supply/BAT0/status                        = Full Charge                                                      =  100.0 [%]
Capacity                                                    =  100.0 [%] linuxidc@linuxidc:~$ 然后如果找到  +++ System Status
TLP power save = enabled
power source  = ac TLP power save = enabled #说明已经成功开启 sudo tlp stat #显示所有信息和设置 sudo tlp stat -b #只显示电池信息 相当于 sudo tlp-stat --battery Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 sudo tlp stat -c #只显示配置信息  相当于 sudo tlp-stat --config Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 sudo tlp stat -r  #显示无线设备的状态信息 相当于 sudo tlp-stat -rfkill Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 sudo tlp stat -t #只显示温度和风扇转速 相当于 sudo tlp-stat --temp Ubuntu 16.04/17.10下安装电源管理工具TLP 1.0 sudo tlp stat -T #显示debug信息  (/var/log/debug) 如果想要关闭TLP,  vi /etc/default/tlp  将其中的 "TLP_ENABLE=1" 改为 "TLP_ENABLE=0"即可.如果想要定制更多的东西,也可以去配置这个文件. 卸载: 要删除tlp,请打开终端并运行命令: sudo apt-get remove --autoremove tlp 要删除PPA,请启动Software&Updates并导航到“其他软件”选项卡。