Wish to install Ubuntu 16.04 LTS on a MacBookAir6,2 (dual boot with macOS Sierra).
I created USB stick with Ubuntu image.
brew cask install unetbootin
I pressed at boot ALT key and entered "Install Ubuntu" and receive the error
error: premature end of file /casper/vmlinux.efi
alloc magic is broken at 0x7a2d93c0: 7a179da0
aborted. press any key to exit
When you google this error message there are no hits. I configured a firmware password on my MacBook Air. Because of security I don't wish to undo that.
I had the same problem and was able to solve it. (In my case, I made the bootable thumb drive from Mac OS X (Mac Mini), but I was running it on a Thinkpad X220 Tablet. So I think that the booting problem is not specific to the Macbook).
You need to first format the thumb drive and then run unetbootin and setup Ubuntu on it.
To format the thumb drive from Mac OS X, you can follow these instructions and format as MS-DOS (FAT). Essentially you need to use the Applications>Utilities>Disk Utility, select the drive, and then format as FAT.
The issue came because you did not format the drive first.