Comment 114 for bug 1040557

Revision history for this message
Val (vk1266) wrote :

I am delighted to report that Ubuntu 12.10 64-bit is now running on my Samsung NP700Z5C, dual booting in UEFI mode from Grub2 to either Ubuntu or pre-installed Windows 8.

My installation process is described below. However, the nature of this bug is such that you should consider very carefully if you still want to attempt installation of 64-bit Ubuntu on your Samsung laptop. If something does not work for you the way it should, your motherboard may be permanently damaged and your laptop may get bricked. For this reason, this bug should have been flagged "nuclear" rather than "critical".

The process below is long and much more arduous than it should be. It applies only to the installation of 12.10 64-bit. To install 12.04, get one of the latest daily builds from http://cdimage.ubuntu.com/precise/daily-live/current/ (dated January 18th, 2013 or later) and install from it in a usual way. To the best of my knowledge, daily builds for 12.10 Live CD are not available. I hope Steve or someone else could clarify this.

My system is: Samsung Chronos NP700Z5C, BIOS version P04ABJ, MICOM version P04ABJ, Windows 8 pre-installed on a GPT-partitioned disk. There is also a 16 Gb ExpressCache disk but I have not touched it yet.

1. While in Windows 8, make space for Ubuntu by shrinking Windows partition. It's probably a good idea at this point to leave all other partitions intact. You must not delete the EFI partition - the one flagged 'boot' - this thing alone may be enough to brick your laptop!

2. Make sure that:
   - Fast BIOS Mode is disabled
   - AHCI Mode is enabled
   - "Secure Boot" is disabled
   - VERY IMPORTANT: "OS Mode Selection" is set to "CSM OS"; any other setting will likely brick your laptop
   - Save your BIOS settings

3. Boot Ubuntu 12.10 64-bit Live CD and select "Try Ubuntu without installing". You may be able to install from a USB drive. I have not tried that route. Create swap and root partitions for Ubuntu. Take note of the number of your Ubuntu partition, you will need it at the final stage of installation. In my case, it was partition 8 (gpt8). Create a 10 Mb BIOS Boot Partition: in GParted, create an unformatted partition and set bios_grub flag on it. If you want to preserve your original MBR, create a backup copy of it at some non-volatile location:
   dd if=/dev/sda of=/mnt/mbr_original bs=440 count=1
Replace sda and location of mbr_original as necessary.

4. Install Ubuntu. Once you get to "Installation type", do not install Ubuntu alongside Windows; choose the "Something else" option instead. Use the Ubuntu root partition you created as the root mount point. If the installer offers you to resize a Windows partition, decline. You don't want to mess around with Windows partitions at this point; you can always do it later. The bootloader must be installed in /dev/sda (or whichever is the boot disk in your case), NOT in /dev/sda1 or other partition.

5. Reboot. Do NOT change any BIOS settings yet! Once you have Ubuntu booted from your hard disk, take note of the kernel version: "uname -a". Download and install Colin King's patches: http://kernel.ubuntu.com/~cking/samsung-1040557. Reboot and take note of the kernel version. It must match Colin King's version (as of time of this writing, it's 3.5.0-21.32).

6. Obtain UUID of your EFI partition. Assuming it's /dev/sda2, execute:
   sudo blkid /dev/sda2
You should get something like this:
/dev/sda2: LABEL="SYSTEM" UUID="7816-793A" TYPE="vfat"

7. Create mount point for the EFI partition:
   sudo mkdir /boot/efi
Add the following two lines to your /etc/fstab, using the UUID you obtained earlier:
# EFI boot partition
UUID=7816-793A /boot/efi vfat defaults 0 0

8. Reboot. Make sure that you see "Boot" and "Microsoft" directories in /boot/efi/EFI. If you do, continue to the next step. If you don't, stop and find out what's wrong. Once you have proceeded past the installation of grub-efi, you will not be able to boot in the CSM mode and you would likely need to start from the beginning if something is wrong with your Ubuntu installation.

9. In the CSM mode you can only install grub-efi but you cannot generate Grub menu because you need to be booted in the UEFI mode in order to read EFI variables that are necessary to generate Grub menu. Therefore, you need a UEFI bootloader that would allow you to boot Ubuntu in the UEFI mode for the first time. Windows UEFI bootloader will not help you; it will boot Windows, period. At this point, I recommend you obtain a rEFInd CD image and make a bootable CD with rEFInd. The advantage of rEFInd CD is that it will boot you in the UEFI mode and you won't have to mess around installing more files to your EFI partition and taking risks with efibootmgr. Obtain a rEFInd CD image from here: http://www.rodsbooks.com/refind/getting.html and burn the image to a CD.

10. Now, install grub-efi:
   sudo apt-get install grub-efi-amd64
Note that this removes grub-pc and grub-gfxpayload-lists. That's fine. Install the EFI bootloader:
   sudo grub-install --efi-directory=/boot/efi --target=x86_64-efi --bootloader-id=Ubuntu-12.10_64
Now you should see "Ubuntu-12.10_64" directory in /boot/efi/EFI.

11. Reboot and make one change to your BIOS settings:
   - change "OS Mode Selection" from "CSM OS" to "UEFI OS"
Save settings. Insert your rEFInd CD and reboot.

12. Now comes the hardest part. From the rEFInd main menu, select "Ubuntu-12.10_64". You will now be placed in the Grub shell, and you will be manually typing Grub commands:
   insmod efi_gop
   insmod efi_uga
   insmod ext2
   insmod gzio
If you accidentally make a mistake in these commands or in the commands below, restart with Ctrl-Alt-Del and repeat your commands. This is generally safer than taking changes with your first boot.
Determine UUID of your EFI partition:
   ls
You will get a list of partitions; assuming that your boot disk is 0 and your Ubuntu partition is gpt8 (use your number that you noted in Step 3), type:
   ls '(hd0,gpt8)'
Take note of the UUID of your Ubuntu partition. It is a long identifier in the form of 641fdda9-3f4d-41c4-9d32-bfbf56e6d80d. Use your Ubuntu partition UUID to issue the following commands:
   set root='(hd0,gpt8)'
   search --no-floppy --fs-uuid --set=root 641fdda9-3f4d-41c4-9d32-bfbf56e6d80d
In the following two commands, use Tab key to auto-complete filenames for vmlinuz and initrd, such as: having typed /boot/vm, hit Tab and have Grub shell autocomplete the filename for you. This will ensure that you don't have a typo in the file name.
   linux /boot/vmlinuz-3.5.0-21-generic root=UUID=641fdda9-3f4d-41c4-9d32-bfbf56e6d80d
   initrd /boot/initrd.img-3.5.0-21-generic
   boot
and with luck, now you are in Ubuntu for the first time in UEFI mode!

13. Create Grub menu:
   sudo update-grub

That's it!

If you created a backup of your original MBR, now is the time to restore it, replacing mbr_original and sda as necessary. Double-check everything before executing this command, one mistake and your MBR may be filled with garbage:
   dd if=/mnt/mbr_original of=/dev/sda bs=440 count=1
Also, it is safe to delete the BIOS Boot Partition at this point.

14. However, booting Windows from Grub menu will likely not work for you as it did not for me. It's a known bug:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1024383
I fixed the problem by following post #18 in the above page. However, I instantly hit another problem: Grub menu disappeared and Ubuntu was booting without any menu options. It turned out that it is caused by incorrect timeout setting in /etc/grub.d/30_os-prober. To fix it, comment out the line with "adjust_timeout" in this block of code in 30_os-prober (I am going to file a bug report on this):
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
  adjust_timeout
  exit 0
fi

15. Most likely you will see that "kworker" process consumes 80-100% of one CPU core on your Samsung laptop. It is a known bug:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/887793
Follow post #116 to fix it.