Showing posts with label intel. Show all posts
Showing posts with label intel. Show all posts

Monday, March 31, 2014

[Tutorial] Economizar energía en Linux


Si pueden y quieren no olviden hacer una Donación (por Paypal) para el blog chimbo así podré seguir haciendo gran contenido.


En este post les voy a mostrar algunos consejos que yo uso para poder reducir el consumo de energía en Linux

Bumblebee & Bbswitch (si tienen una tarjeta gráfica con tecnología Optimus)


Primero, antes que nada, si tienen una tarjeta gráfica NVIDIA con tecnología Optimus deben instalar bumblebee y bbswitch.

Estos programas les va a permitir apagar la tarjeta gráfica cuando no está en uso. También les va a permitir prenderla cuando quieran, por ejemplo cuando quieren lanzar juegos.

Por defecto, cuando instalan Linux es su máquina la tarjeta siempre está prendida aunque no esté en uso. Entonces luego de instalar Bumblebee van a ver una gran mejora en el tiempo que dura la carga de su batería (en mi caso fue por lo menos ganar un 50% más).

bumblebee es un "daemon" es decir un programa que se ejecuta cada vez que es llamado automáticamente por el sistema operativo y bbswitch es el módulo del núcleo que es el que se encarga de apagar o prender la tarjeta gráfica. Asegúrense de ver la página de Github sobre el proyecto bbswitch  si les interesa saber como funciona exactamente.

Para instalar los paquetes:

Desde Ubuntu 13.10, bumblebee está en los paquetes oficiales ( las dependencias van a hacer que bbswitch y el driver de NVIDIA se instalen también):

$ sudo apt-get install bumblebee

Si están en Arch deben instalar todo manualmente:

# pacman -S bumblebee bbswitch nvidia

Si tienen intel-dri y xf86-video-intel instalados, deben reinstalar todo junto para que no hayan problemas de conflictos entre intel-dri y nvidia.

También pueden escoger si quieren usar el driver privativo hecho por  NVIDIA o el driver libre Nouveau (xf86-video-nouveau). Puede ser interesante instalar bbswitch-dkms en vez de bbswitch en Arch, de esta forma el módulo del núcleo va a sobrevivir cuando se haga una actualización del núcleo linux.

Si quieren probar que su tarjeta está apagada o prendida pueden usar este comando:

# cat /proc/acpi/bbswitch


Si están en Arch asegúrense de ver la página del ArchWiki sobre Bumblebee, necesitan terminar de configurar bumblebee manualmente para poder usarlo correctamente.

Hace algunos meses hice un post mostrando como se puede usar Bumblebee y como pueden configurar el "bridge" que se usa para lanzar los programas. Si quieren pueden verlo aquí.

Gráficos Intel (jugando con Kernel Mode Settings)


Si no tienen una tarjeta gráfica pero quieren hacer unos pequeños cambios en su sistema, también hay algunas opciones para los gráficos de Intel.

Lo primero que tienen que hacer es cargar el módulo i915 manualmente editando el archivo /etc/mkinitcpio.conf:

# nano /etc/mkinitcpio.conf

Hay una línea donde encontrarán la palabra "MODULES", ahí van a añadir i915.
No estoy muy seguro si esto va a cambiar mucho en su sistema, ya que lo único que hace es iniciar este módulo durante lo que se llama "bootstrap" y no después. A lo mejor ganen milésimas de segundo de arranque.

MODULES="i915"

Luego de que hicieron eso deben regenerar el initramfs:

# mkinitcpio -p linux

Ahora los cambios para poder mejorar el rendimiento: creen o editen el archivo /etc/modprobe.d/i915.conf y añadan esta línea:

options i915 i915_enable_rc6=7 i915_enable_fbc=1 lvds_downclock=1

PowerTOP (analizar su consumo de energía)


PowerTOP es una herramienta interesante que les muestra qué programa o que proceso está consumiendo más energía en su computador.

Pueden instalarlo desde los paquetes oficiales de su distribución seguramente:

$ sudo apt-get install powertop

# pacman -S powertop

Necesitan tener derechos de super usuario para usar esta herramienta:

# powertop

Sin argumentos esta aplicación se parece a la interfaz de top, les muestra en una lista todos los servicios y programas en orden. Pueden cambiar de tabs para ver otras estadísticas como Idle, Device y Frequency.
La interfaz de PowerTOP

Hay algunas opciones interesantes en PowerTOP. Pueden crear un archivo html en el cual habrá un reporte sobre su consumo de energía, pero lo más interesante de esto es que les va a generar una página con todos los scripts que pueden utilizar para mejorar el rendimiento de su batería.

Pero antes de que PowerTOP pueda generar este reporte necesita recolectar datos. Así pueden calibrar esta herramienta con

# powertop --calibrate

Asegúrense de que su laptop está utilizando la batería y dejen a PowerTOP correr por un rato. Cuando el programa muestre la interfaz normal pueden salir de esta y volver a usar su computador. La calibración debería haberse terminado.

Después de que hicieron eso pueden generar el reporte con:

# powertop --html=report.html

Luego pueden consultar el archivo con su navegador favorito.
Un ejemplo del archivo HTML creado por PowerTOP
La primera vez que usen PowerTOP es muy probable que vean que PulseAudio está consumiendo bastante energía.

Pueden crear un archivo de configuración para remediar esto

$ sudo nano /etc/modprobe.d/audio_powersave.conf

Añadan la línea:

options snd_hda_intel power_save=1

Si usan Intel, o : 

options snd_ac97_codec power_save=1

Para ac97.

PowerTOP tiene la habilidad de hacer cambios en sus preferencias para mejorar el rendimiento de su batería. Para eso solo deben usar el comando:

# powertop --auto-tune

Pueden crear un servicio SystemD por ejemplo:

$ sudo nano /etc/systemd/system/powertop.service

[Unit]
Description=Powertop tunings
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/powertop --auto-tune
Environment="TERM=xterm"

[Install]
WantedBy=multi-user.target

Después de que lo crearon solo deben habilitarlo:

# systemctl enable powertop.service

TLP


Si no usan SystemD o si su distribución no tiene la última versión de PowerTOP con la opción de "auto tune", pueden usar TLP. Hice un post anterior sobre como instalar TLP en Ubuntu.

Entonces, qué hace TLP? Es una herramienta para gestionar su consumo de energía. Va a cambiar sus preferencias dependiendo de la fuente de poder de su computador. Por ejemplo va a cambiar el gobernador de su CPU cuando estén usando su computador con su batería.

Cuando lo instalen van a tener algunas opciones por defectom que son bastante buenas y van a funcionar. Pero pueden editar las configuraciones como quieran en realidad. Asegúrense de ver la página explicando las diferentes opciones que pueden utilizar. (Requiere un gran conocimiento de Linux en general)

Si quieren instalar TLP en Arch

# pacman -S tlp tlp-rdw 

Si usan un Thinkpad (IBM/Lenovo) necesitan unos paquetes extra

# pacman -S tp_smapi acpi_call

Y para finalizar habilitan los servicios con SystemD

# systemctl enable tlp
# systemctl enable tlp-sleep

Si quieren usar tlp-rdw, necesitan habilitar el dispatcher de Network Manager

# systemctl enable NetworkManager-dispatcher

Si están en Ubuntu:

$ sudo add-apt-repository ppa:linrunner/tlp
$ sudo apt-get update 


Luego instalen los paquetes que necesiten

$ sudo apt-get install tlp tlp-rdw

(si usan un Thinkpad)

$ sudo apt-get install tp-smapi-dkms acpi-call-tools 

Aquí pueden ver como instalar TLP en otras distribuciones.

Si quieren ver las configuraciones de su sistema pueden usar TLP (necesita derechos root)

# tlp stat

Va a hacer un log enorme con toda la información que les puede interesar.
Tal vez sea interesante redirigir la salida hacia un archivo:

# tlp stat > tlpoutput.data

O pueden usar grep para encontrar una línea específica, como por ejemplo saber en qué modo está TLP en este momento?

# tlp stat | grep "TLP power save"
La primeras líneas de TLP stat

Les gustó este post? No se olviden de agregarme a sus círculos en G+ o de seguirme en Twitter: @RobertoXMed

Si pueden y quieren no olviden hacer una Donación (por Paypal) para el blog chimbo así podré seguir haciendo gran contenido.

Monday, March 24, 2014

[Tutorial] Energy saving in Linux


In this post I will show you some tips that I use in order to reduce my power consumption in Linux.

Bumblebee & Bbswitch (if you have an Optimus GPU)


First thing first, if you have a NVIDIA graphics card with Optimus technology you should install bumblebee and bbswitch.

This piece of software will actually turn off the dedicated video card when it is not in use. And turn it on when you want to use it.

By default, when you install Linux in you machine the card will always be on. So after installing Bumblebee you will see a real improvement in battery life (almost a 50% increase).

bumblebee is the daemon and bbswitch is the kernel module that actually turns the card on and off. Make sure you take a look at the Github page of the bbswitch project if you are interested to know how this actually works.

To install the packages:

Since Ubuntu 13.10, bumblebee is in the official packages (dependencies should pull bbswitch and the NVIDIA driver too):

$ sudo apt-get install bumblebee

If you are in Arch you install the packages manually:

# pacman -S bumblebee bbswitch nvidia

If you have intel-dri and xf86-video-intel installed, you will have to reinstall them together with the rest to avoid a dependency conflict between intel-dri and nvidia.

You can also choose if you want to use the binary blob made by NVIDIA or the Nouveau driver (xf86-video-nouveau) that is Open Source. It can be interesting to install bbswitch-dkms instead of bbswitch in Arch so the kernel module will survive kernel updates.

If you want to test if the card is actually off you can run the command:

# cat /proc/acpi/bbswitch


If you are in Arch make sure you check the Arch Wiki page about Bumbeblee, you will need to do some other configuration in order to use bumblebee correctly.

I made a post some months ago showing how to run some tests using the dedicated graphic card and how to configure the "bridges" used by Bumblebee. Make sure you check it here.

Intel Graphics (playing with Kernel Mode Settings)


If you don't have a dedicated graphic card or if you want to tweak a little more in your system you can do some things about intel graphics.

First of all you can load the i915 module manually using the configuration file in /etc/mkinitcpio.conf:

# nano /etc/mkinitcpio.conf

There is a line that contains the word MODULES, add the module i915. Actually I'm not really sure that this is really necessary, this will initialize the module during bootstrap and not after that is the normal behavior of the kernel.

MODULES="i915"

After you did that you need to regenerate the initramfs:

# mkinitcpio -p linux

You can gain some energy editing (or creating) the file /etc/modprobe.d/i915.conf and adding the line:

options i915 i915_enable_rc6=7 i915_enable_fbc=1 lvds_downclock=1

PowerTOP (analyzing power usage of your machine)


PowerTop is an interesting tool that shows you what is the most consuming program or process of your computer.

You can install it from the official packages of your distribution:

$ sudo apt-get install powertop

# pacman -S powertop

You will need root privileges to run powertop

# powertop

Without arguments the application will show a top-like interface showing applications and services. You can switch tabs and check some stats like Idle, Device and Frequency.
The PowerTOP interface

There are some interesting features in PowerTOP. You can make a html file that will be like a report of your power consumption and what is interesting is that it will show you the preferences that you should if some configuration files.

But before you do that, PowerTOP needs to collect data about your machine. So you can calibrate this tool using

# powertop --calibrate

Make sure you are using your laptop's battery and leave it for a while. The program will change your backlight and preferences. And when the interface of powertop will appear again you can exit it. The calibration should be done by then.

After you have done that you can generate the report with:

# powertop --html=report.html

Then you can check it with your favorite browser.
Example of the HTML file created by PowerTOP
The first time you run PowerTOP it is very likely that you will see that PulseAudio is draining a lot of power.

You can create a config file to solve this

$ sudo nano /etc/modprobe.d/audio_powersave.conf

Insert the line

options snd_hda_intel power_save=1

If you are using Intel, or

options snd_ac97_codec power_save=1

For ac97.

PowerTOP has the ability to tune your preferences in order to save power. You just need to run:

# powertop --auto-tune

You can even create a simple SystemD service (if you are using SystemD in your distribution)

$ sudo nano /etc/systemd/system/powertop.service

[Unit]
Description=Powertop tunings
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/powertop --auto-tune
Environment="TERM=xterm"

[Install]
WantedBy=multi-user.target

After you created the service just enable it:

# systemctl enable powertop.service

TLP


If you don't run SystemD or if your distribution doesn't have the latest PowerTOP version with the "Auto tune" feature you can use TLP. I did a post about how to install TLP in Ubuntu.

So what does TLP does? It is a power management tool that will change the default option of your system depending in the power source of your computer. For example it will change the CPU governor when you are using your battery.

When you install it you will have a default configuration file, that is pretty good and will work. But you can edit the configuration as you want, the problem is that you actually need to know what you want. Make sure you check the page explaining the different settings that you can use.

If you want to install TLP, in Arch:

# pacman -S tlp tlp-rdw 

If you are using a Thinkpad (IBM/Lenovo) you will need this extra packages

# pacman -S tp_smapi acpi_call

Then you need to start the SystemD service

# systemctl enable tlp
# systemctl enable tlp-sleep

Then if you want to use tlp-rdw, the radio device wizard you need to enable the Network Manager dispatcher

# systemctl enable NetworkManager-dispatcher

If you are using Ubuntu:

$ sudo add-apt-repository ppa:linrunner/tlp
$ sudo apt-get update 


Then install the packages that you need

$ sudo apt-get install tlp tlp-rdw

(if you are using a Thinkpad)

$ sudo apt-get install tp-smapi-dkms acpi-call-tools 

Here you can check how to install it in other distributions.

If you want to check all the parameters used in the configuration files you can use TLP (needs root privileges)

# tlp stat

It will make an enormous log with all the information that you may want. Maybe you can redirect the output to a file:

# tlp stat > tlpoutput.data

Or you can grep the output to find an specific line, like is TLP actually in power saving mode right now?

# tlp stat | grep "TLP power save"
The first lines of the TLP stat output

Did you like this post? Don't forget to add me to your circles in G+ or to follow me on Twitter: @RobertoXMed

Please consider donating to the Blog it will be of great help! Thank you.

Saturday, June 29, 2013

[Review] Thinkpad T430u from a Linux perspective

Thinkpad T430u from a Linux perspective


What is he talking about? Versión en espanol (pronto...)
 

Overview


Recently I purchased a new computer. Being a Linux user when you plan to buy a new computer, you really want to know if your hardware is going to work out of the box.

I wanted to buy a computer that will last for a long time and that would have great specs. After long hours of research I came with two options:
  • The Gazelle professional from System 76, mainly because it comes with Ubuntu and everything works great.
  • The Thinkpad T430u from Lenovo, the model with the i7 processor and the nVidia graphic card.
At the end I decided to purchase the Thinkpad because it had some features I found very interesting.
Also, buying the Gazelle would be a little bit difficult because I live in France. So at the end I would end up paying the same price.


Hardware specifications


I have the 86148CU model of the T430u series. It comes with the following features:

  • i7 IvyBridge dual-core processor, 1.9GHz with TurboBoost up to 3.00GHz.
  • Intel 4000HD Graphics.
  • nVidia GeForce 620m 1GB with Optimus Technology
  • 4 GB of RAM
  • 126GB Toshiba SSD

Some other hardware specifications:

  • 3 cell battery, up to 7 hours (I get around 5 hours with TLP installed and using an Ethernet connexion)
  • 2 USB 3.0 ports
  • 1 SD card slot
  • Headphone/Microphone jack
  • Finger print reader
  • HDMI port
  • Mini Display port 




What does that mean exactly? Well, sadly, some hardware is not going to work out of the box.

T430u and Ubuntu



First thing I did after getting my new computer: delete Windows and format the drive. I was happily surprised that I didn't had any problems with UEFI booting. I had so much troubles trying to make Ubuntu boot in a Dell XPS so I was expecting to make change some options in the BIOS but I could boot and install Ubuntu without problems.

During the installation process, I noticed that the UltraNav utility and the keyboard mouse worked really well. All function buttons worked well too.
The only problem, was that I needed to enable the proprietary drivers for WiFi, so I needed a wired connection to do that.


After enabling my WiFi connexion I did almost everything I mention in this entry of my blog. But I had to test some drivers in order to use all my hardware.

Enabling drivers

As I mentioned before, some of the things that comes with the computer aren't working out of the box.

First of all I wanted to test the graphic card that comes installed. As you can see in the image above I can't enable the drivers automatically. This happens with nVidia graphic cards that use Optimus Technology.

After breaking X like 5 times, I ended up finding the Bumblebee project. I installed Bumblebee using a PPA and I was finally able to properly use my graphic card and safe some battery life.
Here is a post about how to install Bumblebee and how to test it. +1 for this amazing project (+Bumblebee Project in Google+).

Second thing I wanted to make sure that was working was my finger print reader. I did some research for the packages I could install to use my finger print reader, and I found the Fingerprint Gui project.
There is a PPA I used and the configuration was very simple. I set it up so when I need to have special permissions I can swipe my finger or put my password. It works pretty well and even if you are using your system with tty1 (Ctrl + Alt + F1) you can still use the finger print reader.


Conclusion


I don't see why I couldn't recommend this computer. Honestly it works better with Linux that my previous machine. Hibernation works well and if I close the lid the computer Suspends. I had some issues enabling drivers but it wasn't very difficult to make my hardware work.

Sadly the model with the i7 processor is discontinued. And I can't say how you can enable the WWAN if you have one. But if you don't want all that fancy stuff you won't run into any problems and you could make everything work.

Thinkpads are popular for being great pieces of hardware, so if you want to invest in a good computer that will last for a long time I would recommend you the Thinkpad T430u. It may be expensive for some people, specially if you don't live in the US but if you can get yourself a computer like this one you won't be disappointed.

Here is a very very very detailed review, but with a Windows perspective.

Did you like this post? Don't forget to add me to your circles in G+ or to follow me on Twitter: @RobertoXMed .

If you can and if you want, don't forget to Donate so I can keep up the good work.