Thanks for the info; I will try this and if it works, I'll see if I can do a writeup so others may benefit or improve upon the process.
It worked! I'm working on writing up a full procedure.
Installing Ubuntu onto a microSD card (or USB drive) on a Surface Pro 3
Part I - Preparation
Overview
This procedure will install Ubuntu onto a microSD card or USB drive, on a Surface Pro 3. And I mean really install it:
- You'll get a real, complete install, where you can use the entire USB drive. You won't be limited by "Try Ubuntu" / 4 GB casper persistent file, etc.
- Nothing related to Ubuntu will be left on the Surface SSD after it's cleaned up, so Windows will be able to start up smoothly.
(no GRUB screen in the way - the Surface being what it is, you might not even have a keyboard attached to use the arrow keys or press Enter!) - You can use the latest version of Ubuntu right off http://www.ubuntu.com/download/desktop which is required for the best Surface support.
Ready-made images are easier to use, but aren't always up-to-date.
One done, you'll be able to switch back and forth between Windows 10 and Ubuntu by following just a few steps.
This procedure might be useful for other computers that use UEFI, where you want to run Ubuntu exclusively off a USB drive.
Things you will need:
- Surface Pro 3, running Windows 10. This procedure might work on Windows 8.x as well, but I developed and tested it on 10 only.
- Power supply for Surface Pro 3 - best to do this on AC power
- USB hub - I was able to get away with an unpowered hub since all I had was one slow USB drive and a mouse, but if you have two USB drives, a mouse, and a keyboard, go powered.
- USB mouse
- Surface Pro 3 Type Cover OR a USB keyboard - see note below
- USB drive for the Ubuntu installer, 2 GB or greater. It can be an old slow one. Note - all existing files will be erased.
- MicroSD card or USB drive that you want to install Ubuntu onto. See "Storage Media Selection" below. Note - all existing files will be erased.
- BitLocker Drive Encryption Recovery Key - very important!
- Windows 10 Recovery Drive - also very important
Also:
- A fresh backup of your Surface Pro 3 in case it gets hosed
- Second computer with a microSD card reader, to work with the microSD card if needed, and to look stuff up if something goes wrong
- Plenty of time
Optional:
Notes about hardware compatibility:
SP3TC = Surface Pro 3 Type Cover. No spaces between the keys
SP4TC = Surface Pro 4 Type Cover. Spaces between the keys, nicer feel, works on a Surface Pro 3 as well as the newer Surface Pro 4.
At the time of this writing (January 2016), Ubuntu 15.10 at supports the SP3TC, but not the SP4TC. Support for the SP4TC might be added in Ubuntu 16.04 LTS.
Ubuntu 14.04.3 LTS does not support the SP3TC nor the SP4TC, so if you want to install that version, you'll need to use an external USB keyboard.
It is possible to add support for any Type Cover to any version by recompiling the kernel, but that is additional complexity I did not want to get into for a procedure that's already long.
The touchpad on any Type Cover won't work regardless of which version is installed. A Bluetooth mouse seems to be a reasonable workaround.
Storage media selection:
Regardless of whether you install to a USB stick or a microSD card, you'll want one that has good performance on small random reads/writes, and good durability for frequent writes.
If you're installing to a USB stick, the SanDisk Extreme USB 3.0 might be the best choice at the moment, it seems to include SSD-grade flash memory. Unfortunately it's rather large hanging off the side USB port of a Surface.
I like installing to a microSD card, as it frees up the USB port. Unfortunately, there aren't any standout microSD cards, they all seem to be optimized for large sustained writes (eg GoPro) or large block writes (eg Android cell phone camera), but not the small random reads/writes that an OS will do. The benchmarks out there only test the first two cases, not the last case which is what we're interested in.
That said, I am using a Samsung EVO 64 GB microSD card, because that is what I had on hand already, based on recommendation from The Wirecutter (http://thewirecutter.com/reviews/best-microsd-card/). It seems like the Samsung 64GB PRO or PRO+ might be even better choices, but I couldn't find any reviews or benchmarks that covered small random reads/writes. Maybe the Raspberry Pi folks would know what's best, as they run their systems off microSD cards.
Terminology:
I will assume you're installing to a microSD card rather than a USB drive, but the same procedure applies to both.
The thing that appears when you hit a special key combination on bootup used to be the BIOS screen, but now it's UEFI firmware, not BIOS. Therefore I will refer to it as the "UEFI firmware screen", even though I still think of it as a BIOS screen after tinkering with computers for years.
My Background / My Goal:
Though my desktop operating system has always been some version of Windows, I've used Unix-like systems for years, primarily for web hosting / web development. So this means that either someone else set up the box and I'm using it, or I'm running Linux as a VM and don't have to worry much about setup. This is the first time in years that I'm running Linux directly on hardware.
My goal was to install Steam and run a game that runs only on Linux, which is what got me into this procedure. Having wasted time in the past due to installation procedures missing steps, missing information, or just plain out missing, that is why this is a bit long and verbose.
Installing Ubuntu onto a microSD card (or USB drive) on a Surface Pro 3
Part II - Procedure
At various points during this procedure, and after you're done, you'll have to switch between Windows and Ubuntu. Here's the steps to do it, so they aren't repeated numerous times below.
Switch to Ubuntu
Shut down Windows - a full shutdown, not sleep, not hibernate.
Insert the microSD card (or USB drive) with Ubuntu
Boot into the the UEFI firmware screen by holding Volume Up, press Power for 2 seconds and release. Keep holding Volume Up until the UEFI screen appears.
Secure Boot Control - Change to Disabled
Configure Alternate System Boot Order - change to USB -> SSD
Exit Setup
Save configuration and reset.
Remember to switch to the original SP3 Type Cover if you normally use the SP4TC.
Switch to Windows
Shut down Ubuntu.
Remove the microSD card (or USB drive) with Ubuntu
Boot into the the UEFI firmware screen by holding Volume Up, press Power for 2 seconds and release. Keep holding Volume Up until the UEFI screen appears.
Secure Boot Control - Change to Enabled
Configure Alternate System Boot Order - could change it to SSD only, or leave it as USB -> SSD
Exit Setup
Save configuration and reset.
You can switch back to the new SP4TC if you have it.
Disclaimer
I am not an Ubuntu or Linux expert, in fact I'm quite a newbie at this type of installation. I cannot offer support, and you do this at your own risk. Please make backups and don't do this if you need your Surface for anything important anytime soon!
Step 0 - Get everything together
Make sure you have everything listed above, especially a fresh backup of your Surface, the BitLocker Key, and the Windows recovery drive.
Step 1 - Prepare the Install drive
Download Universal-USB-Installer-1.9.6.3.exe from http://www.pendrivelinux.com/univers...easy-as-1-2-3/
Download the latest version of Ubuntu from http://www.ubuntu.com/download/desktop
Run the Universal USB installer.
Install to the USB drive. Let it reformat it. Don't worry about a persistent file.
Step 2 - Prepare the MicroSD card or USB drive
This is optional, you can do this later during the Ubuntu install, but I prefer to do it ahead of time.
Use Windows Disk Management to delete all partitions on your target microSD card or USB drive.
(Right-click Computer, Manage, Storage, Disk Management (Local))
Be careful! A wrong move here and you could erase a drive with data on it.
If there's a partition that won't delete, try this:
Start
diskpartlist disk
select disk 99 (use whatever drive number it is)
recover
clean
exit
Step 3 - Prep the Surface
Follow instructions above to Switch to Ubuntu.
Before starting, plug in your USB hub, Ubuntu install drive, USB mouse, target microSD card or USB drive, and a USB keyboard if you don't have a Surface Pro 3 Type Cover.
Step 4 - Install Ubuntu
After it boots, you'll see the GNU GRUB screen.
Select Install Ubuntu.
Select language
DO NOT connect to a network right now - sometimes it hangs install
DO NOT install third-party software right now - sometimes it hangs install
Installation Type - Something Else (very important, don't overwrite anything)
Step 5 - Partitioning
Identify the drives:
sda is normally the Surface built-in SSD. sdb is usually the microSD card. You could have more drives, or they could be labelled something else. Take a close look at them and verify which is which. I know my Surface has a built-in 250 GB SSD, I'm installing to a 64 GB microSD card, from a 16 GB USB drive, so I can use the size to verify which is which. Also the built-in SSD has lots of partitions for Windows, whereas the microSD card has none because I blanked it in Step 2. Be careful!
On sdb (or whatever your USB drive or microSD card is), create the following partitions:200 MB, Primary, Beginning, EFI System Partition
46000 MB, Primary, Beginning, Ext4, Mount Point: /
17822 MB, Primary, Beginning, Swap Area
100 MB is usually enough for a boot partition, but everyone's pushing for 200 MB nowadays so I went with that.
A rule of thumb for Swap is that it should be twice your RAM. My Surface has 8 GB RAM so approximately 16000 MB is enough.
In reality I just typed 46000 MB for the root partition and used the rest of the available space for swap.
We'll decrease swap usage later to hopefully extend the life of the flash media.
Boot Loader:
This is where the install program fails. You'd think this would be sufficient:Device for boot loader installation: /sdb/sdb1 (or wherever you created the EFI System Partition)
But in reality, Setup completely ignores what you put in and sticks it on /dev/sda2 anyway, hosing Windows 'till it's cleaned up. I am not the only one with this problem; see http://ubuntuforums.org/showthread.php?t=2309806 This action is what made this whole procedure necessary. There's steps below to clean up this mess. (which is the whole point of this guide)
Verify which partitions the installation will change, and proceed if correct.
Step 6 - Continue Install
Time Zone - Select your local time for now. This will require an adjustment later on.
Who are you - enter info.
Sit back and wait for Ubuntu to install.
Let Ubuntu reboot. Be sure to remove the USB drive you used for the installation.
Boot GRUB menu - Ubuntu
After reboot, welcome to a fresh install! Well, maybe not. At this point if you pulled the card and turned secure boot back on, Windows wouldn't start up anymore. So…
(well, first I go into Settings and turn the screen brightness down! Then…)
Step 7 - Clean up after install, Part I - put the files where they should have gone
Log into Ubuntu. Open a terminal.sudo su
List mounted drives:df
In my case, /dev/sda2 is mounted as /boot/efi. That's where the GRUB files went.
The microSD card EFI partition isn't mounted.
(from https://help.ubuntu.com/community/Mount/USB)
List drives available for mounting:fdisk -l
In my case, it's /dev/sdb1. That's where the GRUB files should have gone. (I can tell by the drive size and description - it's the EFI drive, and it's about 200 MB as set above)
Create mount point:mkdir /media/microsdefi
Mount the drive. You should look up which uid and gid to use, but 1000 seems to be the default for the first user on a fresh install:mount -t vfat /dev/sdb1 /media/microsdefi -o uid=1000,gid=1000,utf8,dmask=027,fmask=137
Create directories and copy files. The goal is to get all the files
in /boot/efi/EFI/ubuntu/
into /media/microsdefi/EFI/ubuntu
(THANK YOU ubfan1 for a clear explanation of what was required)
(Resident expert oldfred also notes this: http://ubuntuforums.org/showthread.p...5#post13424975)cd /media/microsdefi
mkdir EFI
cd EFI
mkdir ubuntu
cd ubuntu
cp /boot/efi/EFI/ubuntu/* .
Then, copy /media/microsdefi/EFI/ubuntu/shimx64.efi
to /media/microsdefi/EFI/Boot/bootx64.efi (note - file name change!),
and /media/microsdefi/EFI/ubuntu/grubx64.efi
to /media/microsdefi/EFI/Boot/grubx64.efi (note - same file name)cd ..
mkdir Boot
cd Boot
cp ../ubuntu/shimx64.efi bootx64.efi
cp ../ubuntu/grubx64.efi .
exit, exit, and shut down Ubuntu.
Step 8 - Clean up after install, Part II - remove GRUB from the SSD
Plug in the Windows recovery drive.
Follow instructions above to Switch to Windows. Ensure Windows will boot from USB first.
Restart.
(this is based on http://askubuntu.com/questions/44363...ess-to-windows)
Windows Recovery
Choose keyboard layout.
Troubleshoot
Advanced options
Command Prompt
Type in your BitLocker recovery key if required.diskpart
list disk
You'll want to select the boot drive. In my case it's Disk 0.select disk 0
Show the partitionslist partition
Find the EFI partition. In my case it's 100 MB so it's easy to spot. Select it.select partition 99 (use whatever number it is for you)
Assign the partition to a driveassign letter=u
Exit diskpartexit
You can take a look at the offending directory one last time:u:
cd efi
dir
Now, get rid of the GRUB files:rd /s u:\efi\ubuntu
Fix the Windows boot record:c:
cd \windows\system32
bootrec/fixmbr
bootrec/fixboot
All done!exit
Select Turn off your PC.
Unplug the Windows recovery drive.
Start up, verify you can get back into Windows.
Step 9 - Have a bit of fun switching back and forth!
There's still some work to be done, but you can follow the steps above to "Switch to Ubuntu" and "Switch to Windows".
Step 10 - Decrease swappiness
(remember to Switch to Ubuntu)
Normally Ubuntu swaps files to disk frequently. Since the disk is a microSD card that's a bit slow and has limited write cycles, it's best to reduce swapping to only when needed.
(from http://askubuntu.com/questions/10391...ure-swappiness)sudo nano /etc/sysctl.conf
Then, find this line and change it from 60 to 10, or add it to the file:vm.swappiness = 10
Reboot to make it take effect.
Verify the changes stick after reboot:cat /proc/sys/vm/swappiness
Step 11 - Clock
When I go into Windows, the clock is wrong. It turns out this is a common problem. See http://askubuntu.com/questions/16937...f-on-dual-boot for possible solutions. I agree that the clock really should be set to UTC, but given that the Surface is primarily a Windows machine, I'll take the heretic's solution and let it be local as Windows wants. In Ubuntu:sudo nano /etc/default/rcS
Find UTC=yes and change it toUTC=no
Reboot if you'd like.
Step 12 - Updates
You're done!
Follow the procedures above to switch between Ubuntu and Windows whenever you'd like.
NOW it's okay to connect to a network and install updates in Ubuntu.
You might want to set up the Bluetooth mouse now if you have one, so you'll have a neater setup.
Final Notes
I recommend taking your BitLocker key with you if you're travelling, as it's possible to trigger a protection mechanism that will require your to re-enter your key. That happened to me only once before I got the above procedure figured out, but it's a good precaution anyway. Take along your Windows recovery drive as well.
Acknowledgements
Major thanks to ubfan1 for providing the crucial file-moving instructions in Step 7 to make this work.
Raspberries to the Ubuntu installer for doing something other than what I told it to do, making this process a lot harder than it should be.

Originally Posted by
haoz2
That's exactly what I'm trying to do these days. Failed though

Check this out:
Installation from a compressed image file in windows. https://help.ubuntu.com/community/Installation/UEFI-and-BIOS#in_Windows
Just two steps and perfectly works. However Surface keyboard won't.
It is Ubuntu 14.04, and for some reason it's impossible to upgrade kernel for Live USB.
So I'm hoping there were compressed image for SP3 we can download

You'll need at least 15 for Surface Pro 3 Type Cover support, 14 LTS won't work. (unless you want to recompile the kernel) The procedure I wrote up lets you use 15 instead of 14. It won't support the Surface Pro 4 Type Cover, but maybe the upcoming version 16 will.
Bookmarks