Connect the Ethernet NIC to the LAN, since WiFi doesn't work in Ubuntu until after installing the bcmwl-kernel-source package.
From the Mac OS X 10.10.2 (Yosemite) installer:
- Create a new two-partition layout, with the first partition named "Macintosh HD", formatted as Mac OS Extended (Journaled), and sized to 40 GB; and with the second partition formatted as free space.
- Install OS X on "Macintosh HD".
- Skip signing in with your Apple ID. (Otherwise, take all of the defaults.)
- When prompted create a user account named "Mac User" (macosx) with the standard root password.
- Update Mac OS X after completing the installation.
After installing Mac OS X, download and install rEFInd.
Connect an external hard drive of some kind (e.g., a USB flash drive), insert the Ubuntu 15.04 installation media, and reboot the computer.
Press F2. (FIXME: correct?) Boot EFI\BOOT\grubx64.efi from Ubuntu 15.04 amd64; do not use the legacy boot option. At the grub menu,
highlight Try Ubuntu without installing and press e to edit the
menu entry. Set gfxpayload to auto (was keep), and replace
quiet splash on the kernel command line with nomodeset. Press F10
to boot to the live environment. Note that control keys do not work
in the grub menu entry editor.
From the Ubuntu 15.04 installer:
- At the "Preparing to install Ubuntu" screen, enable "Download updates while installing" and "Install this third-party software".
- Unmount any mounted partitions if prompted.
- At the "Installation type" screen, select "Something else".
- At the "Something else" screen, create a root file system on the external hard drive (e.g., /dev/sdb), which may require creating a new partition table on that device. Also change the device for boot loader installation to the external hard drive.
- Skip swap partition creation/assignment if prompted.
- Set the location (time zone), keyboard layout, initial user account, and computer name when prompted.
Once Ubuntu finishes installing, click "Continue Testing", switch to
virtual terminal 1 (Control-Alt-Fn-F1), and log into the LiveCD as
ubuntu (no password). To remotely access the live environment, set
a password on the "ubuntu" account, install/run the OpenSSH server by
running the following commands, and connect via SSH to ubuntu@ubuntu:
passwd
sudo apt-get update
sudo apt-get --yes install openssh-server
Install ZFS in the live environment:
sudo apt-add-repository --yes ppa:zfs-native/stable
sudo apt-get update
sudo apt-get --yes install ubuntu-zfs
Add three partitions, one for the boot volume (contains the kernel and initrd), one for swap, and the third for the LUKS container hosting the ZFS pool:
sudo gdisk /dev/sda <<EOF
n
+1G
c
4
boot0
n
8e00
c
5
root0
w
y
EOF
Force the kernel to re-read the partition table if necessary:
sudo partprobe
Set up the encrypted backing volume(s):
sudo cryptsetup --verbose --hash sha512 --cipher aes-xts-plain64 --verify-passphrase --batch-mode luksFormat /dev/disk/by-partlabel/root0
sudo ed /etc/crypttab<<EOF
a
cryptroot0 /dev/disk/by-partlabel/root0 none luks
.
w
q
EOF
sudo cryptdisks_start cryptroot0
Configure the ZFS pool and format/mount the boot volume:
sudo zpool create -f -O mountpoint=none -o altroot=/mnt -o ashift=12 rpool /dev/mapper/cryptroot0
sudo zfs create -o mountpoint=none rpool/ROOT
sudo zfs create -o mountpoint=/ rpool/ROOT/ubuntu
sudo zpool set bootfs=rpool/ROOT/ubuntu rpool
sudo mke2fs -F /dev/disk/by-partlabel/boot0
sudo mkdir /mnt/boot
sudo mount /dev/disk/by-partlabel/boot0 /mnt/boot
Mount the Ubuntu installation on the external hard drive (e.g., /dev/sdb1) and copy it to the ZFS pool:
sudo mount /dev/sdb1 /target
(cd /target && sudo find . -depth -print | sudo cpio -pdm /mnt)
sudo umount /target
Configure the swap volume:
sudo zfs create -V 16G rpool/swap
sudo ed /etc/crypttab<<EOF
a
cryptswap0 /dev/zvol/rpool/swap /dev/urandom swap,cipher=aes-xts-plain64,hash=sha512
.
w
q
EOF
Configure /etc/fstab and /etc/crypttab:
sudo cp /etc/crypttab /mnt/etc/crypttab
sudo rm /mnt/etc/fstab
sudo ed <<EOF
a
/dev/disk/by-partlabel/boot0 /boot ext2 defaults,nosuid,nodev,noexec 0 0
/dev/disk/by-partlabel/EFI\\x20System\\x20Partition /boot/efi vfat ro,fmask=133,noauto 0 0
/dev/mapper/cryptswap0 none swap defaults 0 0
.
w /mnt/etc/fstab
q
EOF
Use the ubuntu-drivers command to identify which non-default drivers
need to be added to the installation in order for the laptop to
operate normally:
sudo ubuntu-drivers devices
Note that these drivers can only be found in the non-main repositories. At a minimum cryptsetup, ZFS, and the nVidia drivers must be added to the installation; grub-efi may also be installed if desired:
sudo mount --bind /dev /mnt/dev
sudo chroot /mnt mount -t devpts devpts /dev/pts
sudo chroot /mnt mount -t proc proc /proc
sudo chroot /mnt mount -t sysfs sysfs /sys
sudo cp /etc/resolv.conf /mnt/etc
sudo chroot /mnt add-apt-repository --yes ppa:zfs-native/stable
sudo chroot /mnt apt-get update
sudo chroot /mnt apt-get --yes install cryptsetup
sudo chroot /mnt apt-get --yes install ubuntu-zfs zfs-initramfs
sudo chroot /mnt apt-get --yes install nvidia-340-updates
#sudo chroot /mnt apt-get --yes install grub-efi
FIXME: errors installing nvidia-prime
Setting up nvidia-prime (0.8.1) ...
invoke-rc.d: unknown initscript, /etc/init.d/nvidia-prime not found.
dpkg: error processing package nvidia-prime (--configure):
subprocess installed post-installation script returned error exit status 100
Install a version of the initramfs-tools hook script "cryptroot" modified to support ZFS pools, and then update the initial RAM disk image:
wget https://raw.githubusercontent.com/irtnog/helper-scripts/master/ubuntu-15.04/initramfs-tools/hooks/cryptroot
chmod a+x cryptroot
sudo cp cryptroot /mnt/etc/initramfs-tools/hooks
sudo chroot /mnt dpkg-reconfigure cryptsetup
FIXME: with intel-microcode installed, update-initramfs fails silently
Configure rEFInd:
sudo ed <<'EOF'
a
"Boot with standard options" "boot=zfs"
.
w /mnt/boot/refind_linux.conf
q
EOF
Optionally install grub-efi (which disables rEFInd):
#sudo ed /mnt/etc/default/grub <<'EOF'
#/GRUB_CMDLINE_LINUX_DEFAULT
#s/quiet splash/boot=zfs/
#w
#q
#EOF
#c
#sudo chroot /mnt mount -o rw /boot/efi
#sudo chroot /mnt mkdir /boot/efi/EFI/Ubuntu
#sudo chroot /mnt grub-install
#sudo chroot /mnt update-grub
Cleanup:
sudo chroot /mnt umount /sys
sudo chroot /mnt umount /proc
sudo chroot /mnt umount /dev/pts
sudo chroot /mnt umount /dev
#sudo chroot /mnt umount /boot/efi
sudo chroot /mnt umount /boot
sudo rm /mnt/etc/resolv.conf
sudo zfs snapshot rpool/ROOT/ubuntu@`date -Iseconds`
sudo zpool export rpool
Reboot the computer. Hold the Alt (Option) key to force the Apple EFI boot loader to run. Boot into Mac OS X and re-bless rEFInd.
Reboot the computer. At the rEFIt boot menu, select the Linux entry
(e.g., "Boot vmlinuz-3.19.0-16-generic.efi.signed from BOOT") and
press F2. At the boot options menu, select the "Boot using default
options" entry and press F2. In the line editor, add boot=zfs
(note leading space) to the end of the line. Press Enter to continue
booting.
To fix the missing resolv.conf file:
sudo dpkg-reconfigure --default-priority resolvconf
To fix the incompletely configured nvidia-prime package:
sudo dpkg-reconfigure nvidia-prime
To change the default screen or keyboard brightness, install pommed.
References:
http://blog.ls-al.com/ubuntu-on-a-zfs-root-file-system-for-ubuntu-15-04/ http://www.larsko.org/ZfsUbuntu http://markus.heberling.net/2013/11/07/ubuntu-13-10-luks-encypted-zfs-root-on-hp-n54l/ https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Ubuntu-14.04-or-Later-to-a-Native-ZFS-Root-Filesystem http://wiki.centos.org/HowTos/EncryptTmpSwapHome http://askubuntu.com/questions/55868/installing-broadcom-wireless-drivers
xenophonf commentedFeb 11, 2016