Tuesday, May 28, 2013

Dual Boot Ubuntu 12.04 and Windows 8 on the HP Envy Touchsmart 4 Ultrabook 4-1115dx

Recently, I had the not so genius idea of trying to run Ubuntu on an 'ultrabook'. I love the hardware on this new generation of laptops. They're thin, sleek and lightweight. Oftentimes, they're engineered with aluminum or partial aluminum enclosures. In short, to hardware nerds like me, they're sexy.

I did my research on selecting hardware. I've always known Dell, HP and Lenovo are generally safe bets on running Linux. I also briefly considered the Samsung 7 Ultra line, and I almost pulled the trigger on one, but the HP Touchsmart called my name. It had what I consider to be the perfect screen size (14") and the nail that sealed the deal was that my local Best Buy had an open floor model for $100 less than the normal price and a whopping $400 less than the Samsung. 

As soon as I got home and booted the Ubuntu 12.04 live USB, I knew this was going to quite an adventure. I should note that I did create a live USB for the latest version, 13.04. In my short experience in working with both live USB versions, 13.04 works much, much better out of the box. The wireless worked. So did the touchscreen. However, since this new hardware was going to replace my daily driver, I wanted the stability of a long term release (LTS) version. So, 12.04 was the choice. 

The Envy, just like all recent laptops, comes pre-installed with Windows 8. I'm not a Windows fan at all. The last version of Windows I actually used was XP. Nonetheless, I wanted to at least try Windows 8 and see what the fuss was all about. So, I knew I wanted to set up a dual boot.

 Let me just say, this was not easy. I scoured forums and bug reports for 3 days and finally found a decent configuration to run Ubuntu. Apologies go to my family for the significant mental capacity that was focused on getting this thing running. So, let's get started.

DISCLAIMER: I cannot be held responsible if you follow these steps and corrupt your system in any way or lose data. These steps are provided without warranty. Back up your data and use at your own risk.

Before beginning, make sure you have created a bootable live USB version of Ubuntu 12.04. A bootable USB is required since the Touchsmart lacks an optical drive. Make sure you use the 64 bit version of Ubuntu. Check the Ubuntu installation page if you need help with this step. The one thing I can recommend is to not create your bootable USB on a Mac. I made the first one on my iMac, and it seemed to cause issues until I made another one using my previous laptop running Ubuntu 12.04.

With the bootable USB created, the first order of business was to create a recovery USB for Windows 8. I wanted to be sure that I could always revert back to the factory settings if I hosed the hard drive somehow.  

With an emergency recovery disk made, the next step was to disable some boot features in the BIOS. The HP Envy Touchsmart utilizes the new UEFI specification. Fortunately, Ubuntu 12.04 supports UEFI. If you want more information on the boot features being disabled, please check here.

When you boot the laptop, immediately press the ESC key to access the advanced boot menu. When the advanced boot menu appears, press F10 to access the BIOS settings.

In the BIOS, you'll want to change the following to "disabled": 'Secure Boot' and 'Intel Rapid Start Technology' Once these items are changed, save and exit the BIOS. 




Next, boot into Windows 8 and disable hibernation mode.

While still in Windows, you'll want to partition your hard drive to make room for Ubuntu. Make sure you leave the new partition as unallocated or free space. Alternatively, you can use GParted with the Ubuntu live USB or any other partitioning strategy you prefer.

*Note: Make sure you leave enough room for Windows 8. I left 60 GBs for Windows, and it was barely enough. I really should have left at least 70GB.

With your bootable USB plugged directly into a USB port (please don't use a hub, powered or not), reboot the computer and immediately press ESC to access the advanced boot menu again. Press F9, then select use the arrow keys to select your USB drive as the boot media. With the USB drive selected, press ENTER.

You'll be presented with a menu that gives you the option to 'Try Ubuntu', or 'Install Ubuntu'. Go ahead and select 'Try Ubuntu'. We need to run a couple of commands before the Ubuntu installer will recognize the hard drive in this laptop.

At this point, you should be running the live USB on your laptop. You'll notice that most of the hardware works pretty well out of the box, except for wifi. Don't worry, we'll get that working later. In the meantime, I'd suggest using a network cable for internet access.

The HP comes with a standard 500 GB HDD. I was completely unaware of this at the time of purchase, but the HP also comes with a 32 GB SSD for caching and fast booting of Windows 8. These two drives are linked together in a RAID configuration. As such, the Ubuntu installer fails to recognize either drive, making installation of Ubuntu not possible with the current configuration. In order to install Ubuntu, we need to unlink these drives. 

Open the Terminal (ctrl+alt+t) and enter the following command to list the drives on your system:

sudo fdisk -l
Assuming the only external drive you have plugged in is the live USB, you should see 3 entries: /dev/sda, /dev/sdb, /dev/sdc. You may see additional partitions as well (e.g: sda1, sda2, etc).

/dev/sda should be your 500 GB HDD.
/dev/sdb should be your 32 GB SSD.
/dev/sdc should be your live USB, and should be the smallest drive listed.
*Note: It is your responsibility to determine which drive is which on your system

Assuming your drives match my configuration, issue the following commands to disable the RAID configuration on the two internal drives:


sudo dmraid -E -r /dev/sda
sudo dmraid -E -r /dev/sdb


With the RAID configuration disabled, you can proceed with installing Ubuntu. I chose to install Ubuntu on the 500 GB drive alongside Windows 8. Theoretically, you should be able to install the OS on the SSD drive in the advanced installer options, but personally, I chose not to do this. To run this installer, just double click the icon on the desktop labeled 'Install Ubuntu 12.04.x'.

At this point, the installer should proceed through it's normal steps, including recognizing both drives in the laptop. When the installer asks how you want to install Ubuntu, select 'Something Else'.

From the chunk of unallocated space, create the following partitions:

  1. linux swap - 8GB (double the 4GB of RAM in the HP)
  2. Ext4 mounted to '/' - choose the size you need. I chose 50GB
  3. Ext4 mounted to '/home' - size should be the remainder of the chunk
Make sure the bootloader is installed on the drive '/dev/sda' and not on a partition '/dev/sdax' where 'x' is a number. 



When the installation finishes, you should be able to boot into Ubuntu. However, you'll probably notice  you're no longer able to boot into Windows 8. Fortunately, this is an easy fix. From Ubuntu (make sure you're no longer running from the live USB), install and run the package boot-repair. Make sure you follow the steps for 'Recommended Repair'. Afterwards, reboot and verify you can boot into both Ubuntu and Windows 8 now. Note that the option to boot Windows is labeled, 'Windows 8 EFI Loader'.

Now that you can boot both into both OS's, The next step is to get wifi working properly. The HP is outfitted with the Ralink 3290 wireless card. In the most recent version of Ubuntu (13.04), this card is supported pretty well out of the box. However, it isn't supported in Ubuntu 12.04. There's two things we need to do to get wireless working properly:

  1. Download and compile the Ralink 3290 driver
  2. Install a Linux kernel that is both compatible with the driver and compatible with the rest of the HP hardware.
First, we need to download the right kernel. Chances are, if you installed Ubuntu 12.04.2, your kernel version is 3.5.x. Unfortunately, there is a bug between the Ralink 3290 driver and this kernel that causes a kernel panic. After testing several kernel versions, it seems like kernel 3.3.8 works best with the Touchsmart and Ubuntu 12.04.

To install kernel version 3.3.8, issue the following commands in the terminal:
*Note: This version of the kernel does not have support for the touchscreen on the HP. If you want touchscreen support, I'd suggest installing Ubuntu 13.04 instead.


mkdir /tmp/3.3.8 && cd /tmp/3.3.8
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.8-quantal/linux-headers-3.3.8-030308-generic_3.3.8-030308.201206041356_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.8-quantal/linux-headers-3.3.8-030308_3.3.8-030308.201206041356_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.8-quantal/linux-image-3.3.8-030308-generic_3.3.8-030308.201206041356_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.8-quantal/linux-image-extra-3.3.8-030308-generic_3.3.8-030308.201206041356_amd64.deb
sudo dpkg -i *.deb

Then, update the Grub menu with this command:

sudo grub-update

With the kernel installed, reboot, and at the Grub menu, choose 'Previous Ubuntu Versions' and make sure you select the option labeled as the 3.3.8 kernel.

Once booted, the next step is to download and install the Ralink 3290 driver by following these steps

At this point, you should have a functioning dual boot machine with working wifi!

There are still 3 outstanding issues that I have been unable to solve up to this point. The first two are related to syslog messages that appear occasionally when resuming from suspend. They seem relatively harmless...
  1. Package Power Limit notification which is documented here.
  2. No irq hander for vector which is documented here.
  3. No bluetooth support

Well, that's it! Good luck!



6 comments:

  1. I was using Ubuntu but now i have changed it to windows .. cause my subway surfers hack was not running on it .

    ReplyDelete
  2. I'm starting to see a decent amount of traffic to this post, and i just wanted to point out that I have since moved to Ubuntu 13.04 after seeing random kernel panics with using a non supported kernel. I also installed 13.04 on the 32 GB SSD drive, and the boot times are insanely fast. I figure i'll keep upgrading until we get to the next LTS.

    http://blog.brianhosie.com/2013/07/ubuntu-1304-on-touchsmart-envy.html

    ReplyDelete
  3. Replies
    1. I am now running 14.04 on this machine now, and it works nicely. I also got rid of the dual boot setup and run just Ubuntu now.

      Delete
    2. I have the same laptop and I have the issue caused by the SSD. There is no step which allows to choose 'Something Else' and it only recognizes /dev /sda. I am wondering what will be the impact of disabling the RAID configuration on Windows.

      Delete
  4. Thx for this post, very informative.

    Best regards
    Toby, due diligence data room

    ReplyDelete