Installing Debian on a Sony laptop

As often happens with season changes, I found myself installing a new system on my laptop. This time, I wanted to switch to Debian, as I was pretty impressed by the Debian Social Contract and Free Software Guidelines. With the shift in developed societies (North American and European) toward automated surveillance systems, I am now fully convinced that we need to push for free software. But this is another story ;)

Back to this Autumn install, my laptop is a Sony Vaio Z (VPC-Z13M9E) and I went on to install Debian 7.1.0 (Wheezy). I downloaded the debian-7.1.0-amd64-lxde-CD-1.iso image from the official website as I wanted to start from a lightweight system. However, I ended up installing Xfce to get various features working, so I would recommend starting directly from a bigger image like debian-7.1.0-amd64-xfce-CD-1.iso.

Power consumption

My first reflex, after installing, was to check for power consumption with powertop:

$ sudo apt-get install powertop
$ sudo powertop

Not surprisingly, it displayed a roaring 20+ W consumption. I know from experience that it comes from the dual graphics hardware of the machine: both the Intel and Nvidia cards are powered up, the latter accounting for at least 5W even when it's not working. The solution to this problem is to pass the acpi_osi= option (note: nothing after the '=' sign) to the kernel at bootup: edit /etc/default/grub, and add this argument to the GRUB_CMDLINE_LINUX_DEFAULT variable. After edditing, mine is as follows (more on the other arguments below):

GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi= acpi_backlight=vendor video.brightness_switch_enabled=1"

Do your editting, then update grub and restart your system:

$ sudo vim /etc/default/grub
$ sudo update-grub

When the "STAMINA" LED goes green, you are good to go. If none of the LEDs ("STAMINA", "SPEED" or "AUTO") power up, it means both cards are activated and you need to reboot your system again.

More power savings

My first reflex was to install the laptop-mode-tools, as well as Powertop to get the battery discharge rate. Powertop will give you some advices in the "Tunables" section, which you may want to add to /etc/rc.local so they are permanently applied. In my case, I added a few lines to disable Bluetooth, WWAN and Ethernet Wake-on-LAN, as well as additional sysctls from this page. Here is my /etc/rc.local:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

/usr/sbin/rfkill block bluetooth
/usr/sbin/rfkill block wwan
/sbin/ethtool -s eth0 wol d  # disable wake-on-lan

# Additional sysctls
echo 5 > /proc/sys/vm/laptop_mode
echo 0 > /proc/sys/kernel/nmi_watchdog
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
echo Y > /sys/module/snd_hda_intel/parameters/power_save
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
echo min_power > /sys/class/scsi_host/host2/link_power_management_policy
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done

exit 0

You will need to install rfkill and ethtool to disable bluetooth, wwan and Wake-on-LAN.

Screen brightness

At this point, I could not set the screen brightness at all. The problem is partially documented in this bug report: gnome-power-manager: display backlight brightness has no effect on Sony Vaio VPCYA1V9E. I therefore added the two backlight-related kernel arguments to my GRUB config (above). After rebooting, /sys/class/backlight/acpi_video0 was indeed replaced by /sys/class/backlight/sony, which comes from the sony-laptop kernel module, and I could set the brightness using, for instance:

$ xbacklight -set 20

Installing Xfce

The Fn keys for volume and screen-brightness control were still not working, though, which prompted me to install Xfce and use xfce4-power-manager. Xfce comes with a bunch of other nice features: font anti-aliasing, network and power management as taskbar icons, the Thunar file manager, GTK+ themes, ... As I use the awesome window manager (tiling rocks!), the simplest way for me to integrate both was to remove xfce4-panel from my Xfce session (in xfce4-session-settings), and create the following ~/.Xsession file:

exec awesome & xfce4-session

This Xsession file is executed by lightdm when you select "Default Xsession" at login time.

Final consumption

With all these settings, I get a round 10.0 W discharge rate, with no particular application running and minimum screen brightness.


Feel free to post a comment by e-mail using the form below. Your e-mail address will not be disclosed.

📝 You can use Markdown with $\LaTeX$ formulas in your comment.

By clicking the button below, you agree to the publication of your comment on this page.

Opens your e-mail client.