Hardware: HP EliteBook Revolve 810 G1 with Ubuntu Linux

From Luky-Wiki
Revision as of 22:16, 15 August 2013 by Lukas Dzunko (talk | contribs) (I/O scheduler)

Jump to: navigation, search

Attention: this page is work in progress.

Hardware

Linux Compatibility

Linux Configuration

Problem with network

If you experiment with pre-installed Windows 8 and put system to sleep or plug cable later while notebook is running you may notice following problem. Linux detect network card properly. "Lights" on connector are shining but network is not working. Mostly likely Ubuntu report disconnected cable and in console you may see "NO-CARRIER".

While I was searching what is wrong with my new notebook and network card i found following problem. Once system is put into sleep and there is no need to have network card enabled then it is put to so called "deep sleep" mode. Unfortunately it is not woken up by driver properly in default configuration (according to bug report it should be fixed in future or it is already fixed). Workaround for this problem is really simple.

First of all you need to know device address of Ethernet controller:

root@lukas:~# lspci | grep Ethernet
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
root@lukas:~# 

In my case address of network card is "00:19.0". Power control device is located on /sys filesystem under /sys/devices/pciXXXX:XX/XXXX:XX:XX.X/power/control where X mean variable location depending on installation itself. Technically it should be same for all revolve notebooks but I'll put here complete information how to find it. Just in case someone face same problem also on different platform.

With find | grep combination it is easy to find correct "file":

root@lukas:~# find /sys | grep '00:19.0.*power/control'
/sys/devices/pci0000:00/0000:00:19.0/net/eth0/power/control
/sys/devices/pci0000:00/0000:00:19.0/power/control
root@lukas:~# 

File /sys/devices/pci0000:00/0000:00:19.0/power/control can contain following:

  • off - device is disabled
  • auto - device should work in automatic mode (this one is problematic)
  • on - device is fully enabled (e.g. it is not in sleep state even with no network cable)

If reading of power/control show "auto" then resolution of problem with network is simple:

root@lukas:~# echo on > /sys/devices/pci0000:00/0000:00:19.0/power/control
root@lukas:~# 

If cable was already plugged while you issue "echo on >" command then re-plug cable to trigger cable detection (nw manager, dhcp, etc.).

Brightness control

Brightness or backlight of integrated monitor can be modified in two ways. Via ACPI interface or via platform specific driver. Even there is way how this should work there is no standard defined and notebooks can differ. Revolve 810 notebook present to system both ways but the ACPI method is not working well. Actually changing "brightness" level via ACPI will put display to it's maximum. To fix this problem I switched my notebook to "platform" configuration which is working well.

First of all i checked if there is another method to change backlight level:

root@lukas:~# ls -1 /sys/class/backlight/
acpi_video0
intel_backlight
root@lukas:~# 

As expected it is :) So now notify kernel which one is correct. Kernel command line is configured in /etc/default/grub and i changed original:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

It is neccesary to issue update-grub to propagate changes:

root@lukas:~# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.8.0-27-generic
Found initrd image: /boot/initrd.img-3.8.0-27-generic
Found linux image: /boot/vmlinuz-3.8.0-19-generic
Found initrd image: /boot/initrd.img-3.8.0-19-generic
Found memtest86+ image: /memtest86+.bin
done
root@lukas:~# 

After next reboot brightness control should work well.

Add Brightness Control to Ubuntu Desktop

While working with this notebook in tablet configuration it is handy to have brightness control as applet near to clock, network, sound, etc. There is allready such a applet and details are here

Installation of it is simple:

add-apt-repository ppa:indicator-brightness/ppa
apt-get update && sudo apt-get install indicator-brightness

Note: Level 0 mean really zero light on Revolve notebooks. Please be aware that selecting Level 0 will disable backlight of display (can be used to temporary disable internal monitor and save power)

SSD configuration (enable use of TRIM functionality)

There is already bunch of articles describing TRIM functionality so i try to summarize only important stuff. If you are interested in good reading then try this article. SSD Disk should know which block are free to properly distribute write operation and don't bother with with deleting during write. Especially delete operation is time consuming so and if there is no "free space" know for SSD then it should go through full read-delete-write cycle.

To successfully use TRIM command it is necessary to have support for it on all I/O layers:

1. SSD Disk

root@lukas:~# hdparm -I /dev/sda
...
	   *	Data Set Management TRIM supported (limit 8 blocks)
	   *	Deterministic read ZEROs after TRIM
...

So disk is supporting TRIM command

2. dm-crypt layer (only if encryption is enabled)

Configuration of dm-crypt/luks is in /etc/crypttab. For security reason discard(trim) is disabled on this layer. You can check more in this article. To enable forwarding of trim command simply add discard to end of crypt configuration in /etc/crypttab:

sda5_crypt UUID=<some UID generated during installation> none luks,discard

To enable modification it is neccesary to rebuild initrd (update-initramfs -u) and reboot system:

root@lukas:~# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-3.8.0-27-generic
root@lukas:~# 

After reboot there should be allow_discards keyword in output of following command:

root@lukas:~# dmsetup table /dev/mapper/sda5_crypt --showkeys
0 499611648 crypt aes-xts-plain64 <encryption key> 0 8:5 4096 1 allow_discards
root@lukas:~# 

3. LVM Layer

To enable forwarding of trim command on LVM layer it is necessary to enable issue_discards in /etc/lvm/lvm.conf

# [...]
devices {
   # [...]
   issue_discards = 1
   # [...]
}
# [...]

If it was not enabled then perform same step for recreation of initrd as for dm-crypt.

4. File system layer

Now it is time to check if everything is working well. Issue fstrim -v / and see output of it:

root@lukas:~# fstrim -v /
fstrim: /: FITRIM ioctl failed: Operation not supported

"Operation not supported" or similar error mean that there is something wrong and mostly likely some of I/O layer is not accepting TRIM command.

root@lukas:~# fstrim -v /
/: 239296339968 bytes were trimmed
root@lukas:~#

If there were some bytes trimmed then all I/O layers are forwarding trim correctly and now it is time to finalize setup.

5. Automatic trimming of free space

There are two options.

  • First is to instruct file system to trim data immediately after file they is deleted. I don't recommend this option as it cause several problems. Trimming is time consuming operation and if disk receive trim after each delete operation then this can cause performance degradation as disk will be busy trimming and other I/O operation will wait in queue. Additionally deleted file is immediately lost. With delayed trimming there is chance to recover deleted files.
  • Second option is to trim free space periodically from script. If there is reasonable free space kept on system this option is better as unused space will be trimmed at once and mostly likely it will be not noticed by user. To trim disk periodically i use following script for cron.weekly schedule:
root@lukas:~# cat /etc/cron.weekly/dofstrim
#! /bin/sh

(
  echo
  date -R
  for mount in / /boot
  do
    fstrim -v $mount
  done
) >> /var/log/fstrim.log 2>&1

# EOF
root@lukas:~# 

If you have more file systems (for example /home) then add them to "for mount in" line.

Log file should contain something like:

root@lukas:~# cat /var/log/fstrim.log

Thu, 15 Aug 2013 21:31:49 +0200
/: 441421824 bytes were trimmed
/boot: 150890496 bytes were trimmed
root@lukas:~# 

Note: i changed /boot from ext2 to ext4 in order to support fstrim.

SSD Checklist

Ubuntu 13.04 is already well configured but for reference I'll put here some things which should be checked while SSD i used.

FS mount options

Update of access time on files can create unnecessary writes and access time is mostly likely not used by users. Ubuntu use "relatime" which is good compromise between atime/diratime and noatime/nodiratime.

root@lukas:~# cat /proc/mounts | grep -e vg-root -e /boot
/dev/mapper/ubuntu--vg-root / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
/dev/sda1 /boot ext4 rw,relatime 0 0
root@lukas:~# 

I/O scheduler

If your system contain only one SSD disk and you don't use external storage often, then it is good option to disable I/O scheduler. There is no need to reorder I/O commands to SSD disk as performance is not degrading with "seek" operation. To disable scheduler just add elevator=noop to your kernel boot parameters in /etc/default/grub (append to GRUB_CMDLINE_LINUX_DEFAULT). This is also OK if you occasionally use USB sticks.

Swap and swappiness

I have 8 GB of memory so during normal usage there will be no need to have swap space. As i will work also with memory consuming software (vmware, virtualbox, ...) i keep swap in case there will be huge demand on memory. Swap can reduce SSD's life so i modify vm.swappiness in way that kernel will swap only if really necessary.

root@lukas:~# grep vm.swappiness /etc/sysctl.conf 
vm.swappiness=0

Command to see if value is set correctly:

root@lukas:~# sysctl vm.swappiness
vm.swappiness = 0

work area

hardware

Name HP EliteBook Revolve 810 Tablet Processor Intel Core i7-3687U with Intel HD Graphics 4000 (2.1 GHz, 4 MB cache, 2 cores) Intel Core i5-3437U with Intel HD Graphics 4000 (1.9 GHz, 3 MB cache, 2 cores)

Screen 11.6” 1366×768 Widescreen RAM Up to 12GB HDD Up to 128GB Optical Drive None Graphics Intel HD Graphics 4000 Network 10/100/1000 Ethernet Intel 802.11a/b/g/n with WiDi 2×2


Linux Compatibility

Device Compatibility Comments Processor Not Tested Screen Not Tested Touch Screen Not Tested HDD Not Tested Graphics Chip Not Tested DisplayPort Not Tested Sound Not Tested Bulti-in Microphone Not Tested Headphone Jack Not Tested Microphone Jack Not Tested Ethernet Not Tested Wireless Not Tested Bluetooth Not Tested WWAN Not Tested USB Not Tested Card Reader Not Tested Webcam Not Tested GPS Not Tested Docking Station Not Tested Touch Pad Not Tested Suspend/Resume Not Tested


ssd

sumary


Links

http://www.webupd8.org/2013/01/enable-trim-on-ssd-solid-state-drives.html

https://wiki.ubuntu.com/MagicFab/SSDchecklist

http://askubuntu.com/questions/282831/what-is-recommended-as-optimal-ssdhdd-setup-for-ubuntu

https://wiki.archlinux.org/index.php/SSD_Memory_Cell_Clearing

http://worldsmostsecret.blogspot.sk/2012/04/how-to-activate-trim-on-luks-encrypted.html?m=1

http://www.howtogeek.com/62761/how-to-tweak-your-ssd-in-ubuntu-for-better-performance/

http://www.makeuseof.com/answers/how-to-best-set-up-ubuntu-12-10-on-my-laptops-ssd/

http://blog.christophersmart.com/2013/06/05/trim-on-lvm-on-luks-on-ssd/

https://wiki.archlinux.org/index.php/Dm-crypt_with_LUKS

https://bbs.archlinux.org/viewtopic.php?id=144084

http://tombuntu.com/index.php/2012/04/26/setting-up-ubuntu-on-an-ssd/


http://www.linlap.com/hp_elitebook_revolve_810_tablet