Friday, September 6, 2013

Arch linux installation on a Sony Vaio Pro 13 -- Gnome Desktop, Grub efi bootloader and a custom kernel

The other day I bought a new Sony Viao Pro 13. It was a custom model with an i7, 8GB of ram, and the 128 SSD. It was a lot of help for me reading through other blogs of this nature (to be specific here and here thanks Guys)   so I figured I would add my experience to the mix. In part this is for my own reference but I welcome any comments, suggestions or questions. I am still pretty new to Arch so I will probably make a rather exhaustive list of commands at some points where I really don't quite understand what I am doing.
This will take you through the process I went through, as best as I can convey it, from Windows 8 to Gnome 3.8 running on Arch linux.

System Specs

I am just going to do a raw dump of my order confirmation email here most of it is the same as every other Vaio pro
Product:US-SVP132190X-LBOM
Component:Kaspersky® Internet Security (30-day trial)
Component:128GB (128GB x1) PCIe solid state drive
Component:8GB (8GB fixed onboard x1) DDR3L-1600MHz
Component:Internal lithium polymer battery (4740mAh)
Component:No Trusted Platform Module
Component:No VGA display adapter
Component:Intel® HD Graphics 4400
Component:4th gen Intel® Core™ i7-4500U (1.80GHz / 3.00GHz with Turbo Boost)
Component:Touch screen
Component:Windows 8 64-bit
Component:Microsoft® Office 2013 trial version
Component:No Fresh Start
Component:Carbon Black
Component:13.3" Full HD TRILUMINOS for Mobile IPS touch display (1920 x 1080)

Prep for install

This is based on the state of the world at 30/8/2013. It begins with a brand new, custom built,  fresh from China System.
  1. Mark as mine (using pen or something)
  2. Register with Sony
  3. Write Recovery Image to USB (13.5 GB) using Sony’s recovery software (Not the windows recovery stuff though this may not be any different)
  4. Download and Write Arch ISO to USB (<1 GB)
  5. Update Firmware (this should be doable in linux also)
  6. Shut Down and say goodbye to Windows
  7. Edit BIOS
    1. From a shutdown machine press the sony assist button to boot the desired menu
    2. Enable External Boot
    3. Disable secure boot
    4. Return to assist menu and boot from external device
  8. Edit Boot parameters
    1. at the arch menu press ‘e’ before it attempts to boot
    2. Add libata.force=noncq as a boot parameter (this is done to disable native command queuing which seems to be a problem with this SSD card)
    3. press enter to boot into the Arch live disk environment

Install Arch

This section follows the Arch install guide but gives specific details about how these things were done. Some of the steps taken were to get around the limits of the kernel 3.10 they should not be necessary soon. I followed to some extent this guide.

Partition disks

I partitioned with a GUID partition table. I created 3 partitions, boot, root, and home.
  1. gdisk /dev/sda (opens the GTP editor)
  2. o (command wipes the old table)
    1. n (Creates a new partition)
    2. Default first sector
    3. 512M (Last sector for /boot partition)
    4. Hex code ef00 (for boot partition)
    5. Repeat a-c for 45G / partition and 82G /home use default Hex code
  3. w (writes partition to disk and exits)

Format Partitions

Format partitions as fat32 for the /boot partition, etx4 for the others.
  1. mkfs.vfat -F32 /dev/sda1 (Format boot partition as fat32)
  2. mkfs -t ext4 /dev/sda2 (Format root partition as ext4)
  3. mkfs -t ext4 /dev/sda3 (See above)

Mount Partitions

Mount the partitions to proper places for the arch base install from live disk.
  1. mount /dev/sda2 /mnt
  2. mkdir /mnt/boot
  3. mkdir /mnt/home
  4. mount /dev/sda1 /mnt/boot
  5. mount /dev/sda3 /mnt/home

Connect to internet

Connect through a USB adapter (the wifi drivers do not come with the install media yet). I had to tether with my phone because I don't have the proper adapter.
  1. Connect phone to wifi
  2. Connect phone to computer
  3. Turn on USB tethering
  4. ping google.com (check for proper connection)

Install Base system and bootloader (grub efi)

I had to edit the mirror list until I found a working mirror for my setup to get this to work. It probably was a time sensitive issue (or a problem with my phone's ips). I got grub to work using this guide here as well as the info about native command queue disabling.
  1. pacstrap /mnt base
  2. (grub prep)
    1. umount /sys/firmware/efi/efivars
    2. modprobe -r efivars
    3. modprobe efivars
  3. genfstab -U -p /mnt >> /mnt/etc/fstab
  4. nano /mnt/etc/fstab (check for proper generation)
  5. arch-chroot /mnt (enter chroot environment)
  6. nano /etc/locale.gen (Uncomment English)
  7. locale-gen (build locale or something)
  8. echo LANG=en_US.UTF-8 > /etc/locale.conf
  9. hwclock --systohc --utc (sync hardware clock)
  10. echo pb_lpt > /etc/hostname
  11. passwd
  12. (Grub install)
    1. pacman -S grub efibootmgr
    2. grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck
    3. nano /etc/default/grub (edit to make permanent the disable native command queuing)
    4. GRUB_CMDLINE_LINUX_DEFAULT="quiet libata.force=noncq" (make line look like this)
    5. grub-mkconfig -o /boot/grub/grub.cfg
    6. mv /boot/EFI/grub/*.efi /boot/EFI/Boot/bootx64.efi (move this file so that sony recognizes it. May require creation of new directory. The file may not show up there where I say to move it from but it should exist somewhere, SORRY)
  13. exit
  14. umount /mnt/{boot,home,}
  15. reboot (into new installation)

Post installation

This Section contains information about what I did post install to make the system usable.

Connect to Network (temporary)

  1. systemctl start dhcpcd.service
  2. Enable USB tether on phone or plug in adaptor
  3. ping google.com (check that it is working)

User management

Create a new user with username archy and give elevated privileges
  1. useradd -m -g users -s /bin/bash archy
  2. cat /etc/group (to review available groups)
  3. usermod -aG wheel,disk,games.network,video,audio,storage,power archy (add to other groups)
  4. chfn archy (add other information full name phone number etc.)
  5. passwd archy
  6. pacman -S sudo
  7. VISUAL=”/usr/bin/nano -p” visudo
  8. (uncomment line “%wheel ALL=(ALL) ALL)

Custom kernel (kernel 3.10 does not have what is required)

I could not download kernel directly because of my network setup I assume (probably the same issue that required a diffrent mirror for pacman) so I copied it to USB using another computer. I will admit I have never compiled a custom kernel before and don't really know what I did but it seems to be working wonderfully.
  1. Place kernel into ~/kernelbuild
  2. sudo pacman -S base-devel (install developer tools)
  3. Followed this Here
    1. Used .config file from here
    2. Before compilation edit this file:
      1. ~/kernelbuilld/*/drivers/cpufreq/intel_pstate.c
      2. ...
        @@ -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),     (Add this line not these words)
               {}
        };
        ...
      3. Add the last line ICPU(0x45…
  4. Continue with Arch guide
  5. Boot into new kernel
  6. # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver (if this shows intel_pstate then it worked)

Gnome installation

  1. pacman -S x86-video-intel gnome gnome-extra
  2. sudo systemctl enable gdm
  3. sudo systemctl enable network-manager* (wildcard may not work but I mean enable all of those things that start with network-manager)

To do

  • I Gnome keeps freezing soon after a reboot. This is fixed by going into a new consle (ctrl+alt+f2) and typing the command pkilll -HUP gnome-shell

Hardware setup

This is more or less a list of things I would like to do/ have done with to get this hardware to work as I want it to. Most of it is guessing as I have not had time to really look into this stuff.

Bios

To do

  • Update Bios using while on linux (don’t know how yet and I don't think there is an update available)

Keyboard

  • Using Gnome-tweak tool change CapsLock to Super (this disables the windows button except on virtual machines..)

Touchpad Trackpad
  • sudo pacman -S x86-input-synaptics

To do

  • There is occasional double bounce with three finger click. Look into that
  • Add three/four finger gestures
    • Switch workspace
    • Switch tab

Touchscreen

Installed eGTouch driver from aur.

Multi touch seems to work. But not with may apps

HDMI out

  • Video works

To Do

  • Sound does not make it through…

USB ports

Work well including the charge while sleeping.
I don't have USB 3 device to test yet

Speakers

Just work

Headphone/speaker jack

Both work

Mics

Seem to work

Camera

Just works so far!

Keyboard backlight

This works well without interference.

To Do

Manual adjustment? I don't need this but I would be interested to know how it might be done

Display

Backlight requires manual adjustment at this point

TO Do

Use ambient light sensor to adjust the display.

GPU

To do

Untested

NFC

Not tested

To Do

  • Maybe try some of these things:
    • The Python implementation is Here
    • Stuff about nfc-tools found Here
    • The intel open source project is Here

Bluetooth

Enable bluetooth service and it will connect... usually.
  • Mouse tested (working)

To do

  • Does not transfer files between phone and Laptop
  • Test with Keyboard

Hibernation

To do

Untested

I hope this helps. Please let me know if you have any questions or comments I would love to learn more about these things but I have lost some of my motivation (and time) now that school has started again.
EOF