Ubuntu 13.04 – Setting LCD Backlight Intensity On Boot

My laptop always defaults it’s backlight to maximum on boot, so under Ubuntu 12.10 I’ve been using /etc/rc.local to turn it down to about 30% on boot – which worked just fine, but this stopped working with Ubuntu 13.04,  The reason seems to be that the rc.local script was being run too soon, so the solution is just to add a second of so of delay using sleep:

# Set display to medium brightness
sleep 1.5
echo 1106 > /sys/class/backlight/intel_backlight/brightness
 

Note that these lines need to go before ‘exit 0′ of course, and the value (1106 in my case) will vary from machine to machine, and your preference.  To find the value, set the backlight as you want it at boot in the normal way, then check the active value from the command line:

jimbo@G580:~$ cat /sys/class/backlight/intel_backlight/brightness
1106
jimbo@G580:~$
 

For more information, see this askubuntu post – in particular, the backlight brightness might not be in intel_backlight.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Ubuntu 13.04 on the Lenovo G580 (i5-3210M)

lenovo-G580I recently updated my portable test lab – a Lenovo G580 – from Ubuntu 12.10 to 13.04, but the Lenovo supplied BCM4313 combined Bluetooth and WiFi adapter simply would not work under Ubuntu 13.04, and I never did get its Bluetooth function working even under 12.10.  In general, Broadcom doesn’t seem to be a particularly open-source friendly vendor unfortunately.

Replacing the mini PCIe adapter is easy enough, with a nice big access panel on the base of the machine, but Lenovo for some reason implement a ‘whitelist’ in the BIOS allowing only very specific adapters to be used, the service manual providing a list of just six parts:

  • WLAN, WiFi 1×2 BGN + WiMAX, Intel 6150NX MOW M PCIE NB HMC (LI), FRU 20002484
  • Intel 6150NX BSB M PCIE NB HMC (LI), FRU 20002543
  • WLAN, WiFi 1×1 BGN, Cbt BCM4313 MOW M PCIE NB HMC, FRU 20002505
  • WLAN, WiFi 1×1 BGN, Liteon AR9285 HB95 BGN MOW NB, FRU 20002357
  • WLAN, WiFi 1×1 BGN+BT4.0, Cbt BCM4313HMGB BGN+BT HMC, FRU 20002501
  • WLAN, WiFi 1×1 BGN+BT3.0, Liteon WB195 BGN+BT HMC, FRU 20002524

Of those, the Liteon AR9285 (Lenovo FRU 20002357) jumps out, since Atheros adapters are generally recommended for Linux – and fortunately, this eBay seller has them for a bargain £3.  Note that the adapter is also certified for G570 laptops, hence could be listed as such.

With that sorted, the machine is back to fully functional and power consumption, with the 3.8 kernel and Atheros WiFi adapter fitted, is significantly improved over the previous 3.5 kernel, running at about 9W writing this (according to Powertop), with low backlight and wireless enabled.

Other Configuration

The driver for the onboard Qualcomm Atheros AR8162 Fast Ethernet (alx) is now included in the kernel, so a clean install should be pretty easy.  My grub command line (in /etc/defaults/grub) is now:

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash acpi_backlight=vendor i8042.nopnp”
 

And to /etc/rc.local I’ve added these line to set the screen brightness to about 1/3rd on boot:

sleep 1.5

echo 1106 > /sys/class/backlight/intel_backlight/brightness

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Ubuntu 13.04 KVM VM Boot Hang

Whilst testing some Ubuntu 13.04 Server VMs via KVM (on Ubuntu 12.10), the VMs seemed to be getting stuck at first boot right after a clean installation:

ubuntu-server-13.04-KVM-boot-hang

Always, the VMs would sit for eternity at either the fsck prompt, or as shown here “plymouth is up”.  Fortunately, a simple fix – just change the VM video adapter from the default Cirrus type Virtual Machine Manager picks for Ubuntu to standard VGA:

vmm-setting-video-type

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Windows Server 2012 RemoteFX Requirements

It’s no secret that Microsoft are struggling to stay relevant in todays open-source world without page boundaries, but they do have the upper hand in some areas.  Take VDI – although Windows 7 is an awful platform for VDI, being so chatty and especially when it comes to disk, but Terminal Server shines, and with 2012, it really shines.

Everyone wants a rich-media enabled desktop.  And it’s hardly a big ask in the smart-phone, media-powered world in which we find ourselves.  Yet until now, RDP has meant video playing like the server somehow offloaded the content to a 386-powered multimedia PC from 1991.

RemoteFX

RemoteFX arrived with Windows Server 2008 R2, offering compression and media redirection with the aim of improving things.  Scrolling a PDF for example on a 2008 R2 Terminal Server (with RDP 7.1 client) uses about 1/3rd of the bandwidth as on a 2008 Terminal Server, and playing a WMV file in Windows Media Player (WMP) uses content redirection, so rendering the video on the client device for a properly smooth video experience.  Try it!

Meanwhile Microsoft have done a great job confusing everybody it seems with RemoteFX in Server 2012.  RemoteFX has grown into a suite of technologies to enhance graphics on RDP, but the confusion has arisen because the hardware requirements for RemoteFX when operating in a classic VDI model (i.e. with Windows 8 VMs) are quite complex, needing dedicated graphics hardware and SLAT.  And that means RemoteFX for Windows 8 VMs presumably won’t work under VMware.

But the hardware requirements for RemoteFX in Terminal Server (aka Remote Desktop Server Session Host) deployments?  These are simple: SSE2, which arrived with Pentium 4 in 2001.  Essentially then, none.  And this works in virtual Terminal Servers too.

Configuration

To get RemoteFX working for RDS in Server 2012, we just need to install the RDS Session Host roles – that’s it!  Everything has been designed to work straight out the box.  The one gotcha is that it needs RDP Client v8 of course, which for some reason Microsoft makes difficult to download.  Either spend about an hour fighting Microsoft updates 2574819 and 2592687, or for Windows 7 (x64) clients just copy mstsc from the Server 2012 installation as detailed here.  Using the Microsoft updates, note that there is no local security policy editor for certain Windows 7 editions (like starter), but that’s only needed to enable the UDP transport which isn’t essential anyway.

Performance

This of course is the big question: what does it actually do?  Lots, actually.  But for me most importantly, video – regardless of the application or file format – is detected and the mechanism used to deliver the video to the client is dynamically determined based on bandwidth and latency, and can (and will) change continuously in real-time.  Essentially, when moving content is detected, the RDS server switches to a video-conferencing style of encoding using H.264.

Of course real-time H.264 encoding comes at a cost in CPU cycles.  Testing on my laptop (Server 2012 VMs running under KVM on 3rd-gen Ivy Bridge CPU) a single full-screen RDP session entirely absorbs one CPU core at 3GHz (on the server side) and 100% of an Atom N450 on the client side.  But, it does work!

Bandwidth depends on the video bit rate, file type, codec, client resolution, and the playing application.  Windows Media Player still benefits from media redirection and so has much lower server CPU and network bandwidth needs (say 50% of one core on the server side, and about 3Mbps network in my particular test).  Switching to VLC with the same video, server CPU jumped to ~130% of one core, and network bandwidth to about 6Mbps, the RDS server transcoding screen refresh to an H.264 stream on-the-fly.  In both cases, the Atom N450 client I was using was properly maxed, but the video was acceptable.  Moving to a newer Intel B950 CPU, the client side runs at about 25% and full screen video works just fine.

Switching back to RDP 7.1, the difference is clear.  With only WMP redirection at hand, playing video outside of Media Player runs straight into network bandwidth constraint with the continual bitmap refreshes, c.20Mbps on my home wireless, and is totally unusable, whilst WMP redirection itself of course works fine at about 3Mbps.

In Summary

For Terminal Server deployments, the Windows Server 2012 RemoteFX Requirements are simply to have a CPU with SSE2, which is provided by all commodity hypervisors and any CPU that will run Server 2012.  RemoteFX for Remote Desktop Session Hosts works just fine on virtualised terminal servers, but the H.264 media transcoding is CPU intensive and when in use, a single user will chew up about 3GHz of an Ivy Bridge CPU.

Nevertheless, it’s a big step forward for Microsoft and in my opinion this will only reinforce the trend of Terminal Server replacing Windows XP on the Corporate Desktop, rather than any Windows derivative other than for it’s RDP client.

Get the RDP 8 client either from Microsoft updates 2574819 and 2592687, or from the Windows Server 2012 installation itself.

VN:D [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:D [1.9.22_1171]
Rating: +1 (from 1 vote)

Ubuntu 12.10 on the Lenovo G580 (i5-3210M)

Lenovo’s G580 seems to have potential as a test-lab on-the-move, in particular for KVM, and with a 3rd-gen i5/HM76, 16GB RAM and an OCZ SSD, it should be good for a few VMs at least (Intel VT can be enabled in the G580 BIOS).

So here we go again, Ubuntu 12.10 – this time 64-bit.

Disk Layout for KVM Test Lab

My budget would stretch only to a low-end 120GB SSD, but by re-using the supplied SATA drive in an optical bay SATA tray (laptop DVD drives are all standard, with a custom face panel just clipped on that can be easily moved to the drive tray), storage capacity and speed should both be well covered. The idea is to use the SSD for the OS and swap, and the spinning disk for VMs via LVM. Since I want hibernate support, swap is 32GB, the remainder of the SSD being ext4 with the discard mount option set and the noop scheduler via sysfsutils in /etc/sysfs.conf.

Basic Install and Kernel Update

At time of writing, the installer delivered kernel 3.5.0-17, which can be updated (to 3.5.0-18) with sudo aptitude safe-upgrade. This should be done first as a the alx driver must be added for the Ethernet controller, an Atheros AR8162, per this post:

~# sudo apt-get install linux-headers-generic build-essential
~# wget http://www.orbit-lab.org/kernel/compat-wireless-3-stable/v3.5/compat-wireless-3.5.1-1-snpc.tar.bz2 tar -xf compat-wireless-3.5.1-1-snpc.tar.bz2
~# cd compat-wireless-3.5.1-1-snpc
~# ./scripts/driver-select alx
~# make
~# sudo make install
~# sudo modprobe alx

Machine Specific Tweaks

To get LCD backlight control working, add acpi_backlight=vendor to /etc/default/grub.conf then run sudo update-grub, and reboot.  Ubuntu always sets the backlight to maximum on every boot, but it can be set to a specific level by adding a line to /etc/rc.local, for example to set about 1/3rd brightness:

# Set display to medium brightness
echo 1106 > /sys/class/backlight/intel_backlight/brightness

Suspend and hibernate work properly on this machine, so hibernation can be enabled – assuming swap partition has enough space – by following the official guide.

The Broadcom combined Bluetooth and WiFi adapter works to Broadcom’s usual low standards when it comes to power-save mode performance, so I’ve added a few lines to the power.d wireless script to disable power management for any installed BCM43xx network adapters. The script just needs to be put into /etc/pm/power.d and given execute permissions, and is then run instead of the standard script at /lib/pm-utils/power.d, for example when switching from mains to battery power.

Performance and Power Consumption

Areas that don’t disappoint – once the POST is done, Ubuntu boots to a usable desktop in just five seconds.

According to PowerTop, the machine baseline is about 14W (low backlight), but this can be reduced when on-the-move to about 10W by disabling networking and bluetooth, setting processor governor to conservative and muting the mic input (allowing the sound hardware to sleep). Enabling RC6pp seems to cause some stability issues and doesn’t reduce power consumption particularly, the 3.5 kernel selecting RC6p by default.

Is the Lenovo G580 a Good Machine for Ubuntu 12.10?

With many machines, running Ubuntu still means some compromises, for example on the Dell Mini 1012 battery life is poor (compared to Windows) and resume is unreliable, even with a spinning disk.

But with the G580, the OS is rock-sock and the system performs brilliantly.  Power consumption seems well controlled, and KVM VMs run well too.

VN:D [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:D [1.9.22_1171]
Rating: +1 (from 1 vote)

Copyright © Peacon Ltd, 2010, 2011
Technology blog by James Pearce

If you find the content of this blog useful, please consider donating just a pound towards the costs:

WordPress Appliance - Powered by TurnKey Linux