2013-07-07

Configuring the 2013 Sony Vaio pro 13 with Arch Linux

WARNING: DO NOT PURCHASE THE 2013 SONY VAIO PRO:
See this: http://community.sony.com/t5/VAIO-Hardware-Networking/New-Sony-Vaio-Pro-Wifi-Issue/td-p/143557
Sony should recall these.  The wifi antenna was placed internally right next to components that block the signal.  For example: I can be sitting in the center of a starbucks and not see their wifi network.

I will leave my original blog post that has gathered some attention for the configuration, but I will be attempting to return this laptop, although I expect sony to do nothing due to the size of the company and their shady history.

You will need a usb ethernet adapter for this. The one I have is autodetected and configured by arch installer.

These are the steps I used in order to get up and running on this amazing piece of hardware.  This is me remembering what I did about 36 hours ago, as I type this on my awesome new vaio pro running e17.

I used the dd method of copying the arch install boot image to a thumbdrive and used that to boot.

configure the BIOS
With the laptop OFF, press the assist button, this boots the laptop into the sony efi boot/recovery menu.

Select BIOS setup
Make sure secure boot is off and change the boot method from UEFI to "legacy".
Also set external boot to enabled, and give it higher priority in the boot order.

Shut down and boot with the thumbdrive in:
It is very important you don't just boot as-is. You have to press tab and edit the kernel boot parameters. Add libata.force=noncq as a boot parameter.
And a side-note on this: The existing boot parameters looked strange to me because it contained a ../../ at the end of the string, so I placed it somewhere in-between two of the existing parameters that looked "normal" to me.

From here forward I followed the arch install guide as normal until a point.
After some research I decided on ext4 for both my / and /boot partition.
Those are the only partitions I created. There is no need for a /swap partition on this hardware. I used fdisk to do the partitioning and here is a printout of my table(with a 250mb boot partition):
Disk /dev/sda: 128.0 GB, 128035676160 bytes, 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x9dc83417

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      514047      256000   83  Linux
/dev/sda2          514048   250069679   124777816   83  Linux

If you just follow the guide, you won't be able to boot because the libata.force setting naturally won't persist to your install.
I used grub, because it's dead simple and just works.
So follow the instructions for grub...
pacman -S grub...
Except BEFORE you generate the grub.cfg you need to edit the /etc/defaults/grub file.
So that's before you run "grub-mkconfig -o /boot/grub/grub.cfg" edit this setting(line 4 for me) in /etc/defaults/grub to contain the libata... parameter:
GRUB_CMDLINE_LINUX_DEFAULT="quiet libata.force=noncq"

Continue with the rest of the guide and you should have a bootable system.

Boot into your install:
You're not done yet!

Install git:
pacman -S git

linux-firmware
UPDATE 2013-08-16 - the arch repo version contains the firmware
get the latest linux-firmware (which as of only a few days ago includes the firmware for this intel 7260 card)
The repo: http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/
rm -rf /lib/firmware
git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git /lib/firmware


kernel source from iwlwifi
clone the linux kernel source from this repo: http://git.kernel.org/cgit/linux/kernel/git/iwlwifi/iwlwifi.git/

git clone git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git
UPDATE(2013-07-21): kernel source
Use the mainline kernel 3.11-rc5
Linus merged in the iwlwifi repo. https://www.kernel.org/
(You'll still have to do the next part)

UPDATE - 2013-09-13 - Support for this CPU is finally in the linux repo as of 2013-09-12 (https://github.com/torvalds/linux)

DONT COMPILE YET, first you'll need to edit one line in this file: drivers/cpufreq/intel_pstate.c

This is very important, without doing this your cpu will be stuck at 800mhz.

Here is my diff, real simple, just add a single line(or make sure it's there... hopefully this makes it's way to mainline soon)


diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 07f2840..1ce506a 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -522,6 +522,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
        ICPU(0x2a, default_policy),
        ICPU(0x2d, default_policy),
        ICPU(0x3a, default_policy),
+       ICPU(0x45, default_policy),
        {}
 };

Ok, now you are prepared to compile.
pre-compile checklist:
- clone the github repo kernel
- /lib/firmware is updated and contains iwlwifi-7260-7.ucode
- cloned the linux source from the iwlwifi repo
- downloaded the current mainline kernel
- edited the intel_pstate.c file

an annoyance here is since you're booted into a kernel that does not contain the haswell support, you will be running at 800mhz, and thus compilation will take long.

Now you'll be following the arch directions on how to compile your own kernel from source. The arch documentation for this is great.
https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional

I will leave the rest to you... or my future self referring back to this.

Also, I want to give credit to two blogs that helped guide me in the right direction in all of this:

Nick Brackley's blog: http://www.nicksplace.com.au/
and
https://spicious.com/sony-vaio-pro-11-with-ubuntu.html

Thanks guys!

I hope I didn't miss anything.  I will edit this if I did.

update:
ok, it's been a few days, and I've been monitoring the cpu with i7z.
I'm posting this little update to say I've notice that when I put the laptop to sleep(close the lid), and wake it up again, the CPU seems to be frozen at 2.9..Ghz.
I will be looking into this soon, and posting what I find, if anything useful.

update 2:
I've been reading quite a bit about the stuck turbo mode situation.  It seems it isn't the only problem.  Apparently the cpu should also be able to idle as low as 800mhz.  Currently(ignoring the sleep/wake turbo-mode bug), my cpu sits idle at 1800mhz and turbos properly up to 3ghz.  I don't think I will do anything here.  I'm almost always near an outlet to stay plugged in, if this temporary bug causes my battery life to be less amazing.  I'm getting at least 4 hours(real-life usage) anyway.
Doing a bit more research this weekend; perhaps the kernel pstate/governors can be disabled altogether and let the cpu manage itself?  I don't have a lot of knowledge of this area of tech, but I wish to learn.

update 3:
external monitor/hdmi sound - works perfect!
see: https://wiki.archlinux.org/index.php/Xorg#Multiple_monitors.2FDual_screen
and of course for sound I'm using pulseaudio, and I use pavucontrol to control pulse settings

boot speed test, see for youself how fast this beast is:


update 4:
the wireless driver is now included in the mainline kernel 3.11-rc2.
I've updated the blog post, but also noting it here.

update 5:
Another thing I realize I should post is that I have been unable to get the built-in microphone to work.
I simple get pavucontrol reporting the internal microphone as "unavailable".  I'll be looking at this more this week, and will update if I can get it working.

update 6(2013-08-16):
I've got to the point where I compile every new kernel rc.  Still waiting for intel pstate support to be baked in to the kernel and I still haven't figured out how to get the internal mic working.  Those two things are all that remain for 100% support.
At the moment I plug in a headset I use for my phone, and the mic on that works through the combined headsest/mic port.
I have a kernel config that has been working very well.
Posting it here for public consumption, but don't criticize too hard, I haven't been customizing kernels for very long.
https://s3.amazonaws.com/elouisyoung/.config

update 7 (2013-09-13)
Yesterday I noticed Linus pulled in a commit that enabled haswell support(finally).  No more need to add the CPU id, as described above.  So I have struck the irrelevant portions of the blog post.
Support is looking good now, although I have never got the internal mic to do anything other than show "Unavailable" in pulse audio.

update 8 (2013-10-13)
The mic finallly works with current master branch kernel.  This leaves only the wifi problem.  Well it's a hardware design failure on sonys part so I will be doing whatever I can to return this laptop to Frys when the new samsung ativ 9 is on the shelf.  Screw you sony for not doing a recall for the wifi failure.