Search

Ubuntu 12.04 - HP 2510p laptop (wifi, fingerprint, performance and power management)

Contents[Hide]

HP 2510p

The HP 2510p is a 12.1” screen notebook designed for heavy duty and security.

Ubuntu Installation is very simple on this laptop, as it integrates some very standard components.

But, if you want to be able to fully exploit this laptop possibilities, you still need to do some specific configurations for :

  • Core 2 Duo CPU power management capabilities
  • Mobile Intel GM965 Express chipset
  • Intel Pro 4965 wifi adapter
  • AES2501 fingerprint sensor

This article will explain how to configure Ubuntu Precise 12.04 to fully use the HP 2510p laptop hardware.

It will also help you to tweak your HP 2510p for better overall performances and battery power management.

1. Wifi Connexion Problems

HP 2510p wireless adapter is Intel Pro 4965.

# lspci
...
10:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)

This adapter is directly recognised during an Ubuntu 12.04 installation.

You can straight away connect to networks using WEP encryption. But, you may get into trouble when using WPA2 encrypted networks. With this encryption protocol, connexion may be impossible, the adapter not being able to obtain an IP address.

This problem comes from the 802.11n protocol which is not fully handled by actual drivers. It has to be disabled to solve the issue.

To do so, create or edit the /etc/modprobe.d/options.conf file as root and add the following line :

/etc/modprobe.d/options.conf

options iwl4965 11n_disable=1

After a reboot, your wifi connexion problems should be part of the past.

2. Fingerprint Sensor

HP 2510p is embedding an AES2501 fingerprint sensor.

# lsusb
...
Bus 005 Device 002: ID 08ff:2580 AuthenTec, Inc. AES2501 Fingerprint Sensor

Thanks to the Fprint project, your fingerprint sensor can be fully supported under Ubuntu. It can allow you :

  • to login with your fingerprint
  • to replace your su password with your fingerprint

To do so, you first need to declare the FPrint PPA :

# sudo add-apt-repository ppa:fingerprint/fprint
# sudo apt-get update

You can now install the FPrint demo software :

# sudo apt-get install fprint-demo

The demo software can be launched from the accessories/fprint-demo menu.

Your fingerprint sensor should be recognised and you should be able to enroll your fingerprints.

FPrint demo -main screen     FPrint demo - finger print

2.1. Authentification Daemon

As your sensor has been tested and is fully working, you can now install the daemon that will be in charge of the fingerprint authentification process.

Your fingerprint authentification will then replace your password for login or su.

Install the libpam-fprintd daemon :

# sudo apt-get install libpam-fprintd

Once the daemon installed, you can enable the fingerprint login per user basis thru System settings / User Accounts.

When you select a user, a new Fingerprint login field is available to enable the use of the fingerprint sensor instead of the standard password.

Finger print authentification - step 1

The activation of this option is done in 2 main steps.

First one is the selection of finger to use.

Finger print authentification - step 2

Second one is the fingerprint enrollment.

Finger print authentification - step 3

Once your fingerprint has been registered, everything is ready for your fingerprint authentification.

Finger print authentification - step 4

2.2. Fingerprint Authentification

As the enrollment process has been done for your account, your authentification process is now done using :

  1. Your fingerprint, as the principal method
  2. Your password, in case of 3 faulty attempts

This double method process is true at anytime. That means that in case of trouble with your fingerprint recognition, you can always use your password.

So, if you close your session or reboot, your login screen should be like this :

Finger print authentification - Login

 

Everytime you will be launching an application needing the root permission, you will be prompted with a dialog like this :

Finger print authentification - Gksudo

Even under a terminal console, in case of sudo, you will be prompted the same way :

# sudo su
Swipe your finger on AuthenTec AES2501
Failed to match fingerprint
Swipe your finger on AuthenTec AES2501
Failed to match fingerprint
Swipe your finger on AuthenTec AES2501
Failed to match fingerprint
[sudo] password for xxxxx :

Your account access is now fully controled by your fingerprint …

3. Performance Tweaks

icon-performance

3.1. Preload

Preload is an adaptive readahead daemon. It monitors applications that you use, and by analyzing this data, predicts what applications you might run. It then fetches those binaries and their dependencies into memory for faster startup times.

If your hp 2510p is having more than 1 Gb of RAM, it will increase your overall experience.

To install it just do :

# sudo apt-get install preload

After some time you will notice that your apps are starting faster.

3.2. zRAM swap

zRAM creates a RAM based block device which acts as a swap disk, but is compressed and stored in memory instead of swap disk, allowing very fast I/O and increasing the amount of memory available before the system starts swapping to disk.

With the slow hard disk and a good amount of RAM found on modern laptops, zRAM is giving a real boost effect as soon as your system starts to need swapping.

To install it, do these commands :

# sudo add-apt-repository ppa:shnatsel/zram
# sudo apt-get update
# sudo apt-get install zramswap-enabler

It should now be operationnal.

You can check that it is running :

# cat /var/log/syslog | grep zram
Apr 21 13:14:26 nicolas-2510p kernel: [ 26.021442] zram: module is from the staging directory, the quality is unknown, you have been warned.
Apr 21 13:14:26 nicolas-2510p kernel: [ 26.033008] zram: Creating 2 devices ...
Apr 21 13:14:26 nicolas-2510p kernel: [ 26.171935] Adding 1015872k swap on /dev/zram0. Priority:100 extents:1 across:1015872k SS
Apr 21 13:14:26 nicolas-2510p kernel: [ 26.183287] Adding 1015872k swap on /dev/zram1. Priority:100 extents:1 across:1015872k SS

More info can be found on  http://www.webupd8.org/2011/10/increased-performance-in-linux-with.html

3.3. Virtual Memory

With Linux, you can tune how much RAM based cache to use for dirty pages and how frequently to flush that cached data back to disk. Dirty pages are the pages in memory that have been updated but still not written to disk. You can also tune the behavior of memory swap. Because of the low speed 5400 rpm hard disk provided by HP 2510p, proper virtual memory tweaks can give a real performance boost.

Five important parameters can be adjusted :

  • vm.swappiness - This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase agressiveness, lower values decrease the amount of swap.
  • vm.dirty_ratio - Contains, as a percentage of total system memory, the number of pages at which a process which is generating disk writes will itself start writing out dirty data.
  • vm.dirty_background_ratio - Contains, as a percentage of total system memory, the number of pages at which the pdflush background writeback daemon will start writing out dirty data.
  • vm.dirty_expire_centisecs - The pdflush writeback daemons will periodically wake up and write 'old' data out to disk. This tunable expresses the interval between those wakeups, in 100'ths of a second.
  • vm.vfs_cache_pressure - Controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects.

vm.swappiness=60 is the default setting in Ubuntu. Reducing this value may improve overall performance for a typical Ubuntu desktop or laptop installation. A value of vm.swappiness=10 is recommended in  https://help.ubuntu.com/community/SwapFaq.

If vm.dirty_ratio and vm.dirty_background_ratio are too high, when the flush starts, you will get blocked I/O for as much as several seconds at a time, not being able to do anything else. For example, with Ubuntu standard setting vm.dirty_ratio=60, it represents a very big amount of data to write back to a slow disk (1.2 Gb data for 2 Gb RAM) !

A typical side effect of this setting is seen during big file transfers : during the transfer, your gnome desktop will behave as freezed. This is because your file is cached & flushed, cached & flushed, ...

So, because of netbook and laptop specificities (good amount of RAM & slow disk), we need to lower these values to avoid these freeze. For 2 Gb RAM (you can adjust these values to your specific configuration), I tweaked these parameters to vm.dirty_ratio=10 and vm.dirty_background_ratio=5.

vm.vfs_cache_pressure determine the behavior of cache between dentry + inodes and file blocks. Decreasing vm.vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches instead of file blocks. File block are then being freed first. We can tune this parameters in a way that you will get less 'freeze' feeling while exploring your filesystem when a file transfer is already running. Your previous directory listing will remain longer in the cache memory. After short tests, I decided to set vm.vfs_cache_pressure=50.

For test purpose, you can set all these parameters dynamically, effect is immediate :

# sudo su
# sysctl -w vm.swappiness=10
# sysctl -w vm.dirty_ratio=10
# sysctl -w vm.dirty_background_ratio=5
# sysctl -w vm.vfs_cache_pressure=50

You can now check that you can browse your filesystem directories much faster during heavy file transfers.

As we need to make the changes permanent, you need to surcharge the kernel values that will be used at boot time in a new configuration file under /etc/sysctl.d :

# sudo gedit /etc/sysctl.d/99-laptop-tweaks.conf

/etc/sysctl.d/99-laptop-tweaks.conf

# /etc/sysctl.d/99-laptop-tweaks.conf
# Configuration file for setting netbook and laptop kernel tweaks
#

# limit usage of disk swap
vm.swappiness = 10

# limit percentage of dirty cache in memory
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10

# give filesystem cache more importance than file blocks cache
vm.vfs_cache_pressure = 50

They will be taken into account at every boot.

4. Power Management

icon-battery

4.1. Advanced Power Management

Hard Disk Advanced Power Management defines your hard disk behavior in a way to :

  • protect its heads by doing head parking when possible
  • save energy by spinning down after inactivity period

The head parking mecanism helps to protect your hard disk in case of shock. A brand new hard disk is able to handle between 200 000 and 600 000 head parking cycles before failure. So you have to make sure that your APM tuning is not resulting in a too fast head parking cycle.

APM parameter has to be set by hdparm and for the default Samsung 80 Gb Hard Disk of HP 2510p it can take these values :

  • 1 : Aggressive APM settings, head parking occurs after a very short time
  • 128 : manufacturer default value, quite aggressive about head parking
  • 254 : Relaxed APM settings, head parking takes place after a very long time
  • 255 : APM disabled, head parking disabled

The main problem is that Ubuntu default value is set to 128, which is quite low.

Another important parameter is the spindown timeout, which is as low as 2 seconds with Ubuntu standard setting.

That means that your hard disk may park its heads as soon as it detects 2 seconds without disk activity. Both these values imply most of the time some very frequent hard disk head parking.

You can easily check your head parking counter with smartctl tool. You may have to install it as it is not installed by default.

# sudo apt-get install smartmontools

The number in red is your head parking counter. If you go on battery and check it every minute, you should see it increasing quite fast ...

# sudo smartctl -a /dev/sda | grep Load_Cycle_Count
193 Load_Cycle_Count 0x0032 097 097 000 Old_age Always - 34552

To change the default behavior and protect your hard disk, you need to add this section at the end of /etc/hdparm.conf :

# sudo gedit /etc/hdparm.conf

/etc/hdparm.conf

...
# set APM to 254 and spindown to 2 hours (244)
/dev/sda {
  apm = 254
  spindown_time = 244
}
...

These values will take effect after next reboot.

4.2. Laptop Mode Tools

Laptop Mode Tools is a laptop power saving package. It allows you to extend the battery life of your laptop. It is the primary way to enable the Laptop Mode feature of the Linux kernel, which allows your laptop hard drive to spin down. In addition, it allows you to tweak a number of other power-related settings using a simple configuration file.

You can install that package very simply :

# sudo aptitude install laptop-mode-tools

4.2.1. Oneiric Ocelot bug

If at the end of the install you get this message,

Setting up laptop-mode-tools (1.57-1ubuntu1) ...
* Enabling laptop mode...
Unhandled kernel version: 3.0 ('uname -r' = '3.0.0-17-generic')
Couldn't acquire lock. Retrying....

 you are in front of a bug of the Oneiric version, which is incompatible with kernel 3.0. But, this bug is simple to correct !

To do so, just open /usr/sbin/laptop_mode file as root and add the line in red :

/usr/sbin/laptop_mode

...
case "$KLEVEL" in
  "2.4" ) ;;
  "2.6" ) ;;
  "3.0" ) ;;
  *)
    log "ERR" "Unhandled kernel version: $KLEVEL ('uname -r' = '$(uname -r)')" >&2
    exit 1
  ;;
...

You now need to restart the laptop-mode service :

# sudo /etc/init.d/laptop-mode start
 * Enabling laptop mode...

Bug is part of the past ...

4.2.2. APM settings

Laptop mode tools allow you to tweak APM parameters (explained earlier) when switching to battery mode.

To reflect the boot parameters modifications explained previously, you need to set them as the default battery mode parameters.

You need to modify /etc/laptop-mode/laptop-mode.conf as root :

/etc/laptop-mode/laptop-mode.conf

...
CONTROL_NOATIME=1
...
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=7200
...
BATT_HD_POWERMGMT=254
...

4.2.3. USB

USB auto-suspend is enabled by default. It means that any USB device will be set into sleep mode to save power.

This may be a problem if you are using a USB mouse (usbhid) or a USB key (usb-storage). You need to blacklist them from being set to sleep mode.

On the same aspect, to be able to use the fingerprint, you need to blacklist it from the devices handled by auto-suspend.

First, get the fingerprint USB device ID :

# lsusb
...
Bus 005 Device 002: ID 08ff:2580 AuthenTec, Inc. AES2501 Fingerprint Sensor

To blacklist devices, you need to add the ID in /etc/laptop-mode/conf.d/usb-autosuspend.conf as root :

/etc/laptop-mode/conf.d/usb-autosuspend.conf

...
AUTOSUSPEND_USBID_BLACKLIST="08ff:2580"
...
AUTOSUSPEND_USBTYPE_BLACKLIST="usbhid usb-storage"

4.2.4. Bluetooth

If you want to automatically disable the bluetooth adapter when running on battery, you have to set bluetooth management in /etc/laptop-mode/conf.d/bluetooth.conf as root :

/etc/laptop-mode/conf.d/bluetooth.conf

...
CONTROL_BLUETOOTH=1

4.3. Jupiter Applet

Under Gnome, Jupiter applet allows some important power saving actions :

  • adjust CPU frequency
  • enable/disable wireless device like Bluetooth or Wifi
  • enable/disable multiple video displays

Even if this applet is not compulsory, it may be very helpful.

As Jupiter is supported by WebUpd8 team, a PPA is available to ease the installation of this applet :

# sudo add-apt-repository ppa:webupd8team/jupiter
# sudo apt-get update
# sudo apt-get install jupiter

If you are using Gnome Shell, the icon is available thru the lower message bar.

To display it into the topbar, you need to install the gnome-shell-classic-systray extension :

# sudo add-apt-repository ppa:webupd8team/gnome3
# sudo apt-get update
# sudo apt-get install gnome-shell-classic-systray

After a reboot, the jupiter applet should be accessible via the topbar icon

Jupiter applet

 

With these different tips, you are now able to use the full potential of your HP 2510p laptop.

If you want to go further, with some overclocking or hardware modifications, the HP 2510p owners lounge forum is a very good place to start.

Enjoy !

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus