Sunday, July 26, 2015

Recovering Ubuntu 14.04 LTS from Ubuntu 15.04 LiveCD

Recently I attempted to upgrade my Ubuntu 14.04 LTS system, but it failed miserably with the kernel upgrade because my /boot partition was much much too small (~300 MB).

Unbeknownst to me, it didn't fail gracefully, and I could no longer restart the system. This created another problem because my / filesystem was encrypted using cryptoLUKS.

So, using another computer, I copied over a Ubuntu 15.04 64 bit ISO to one of my thumb drives and decided to take the opportunity to upgrade.

 I had no issue using cryptsetup to mount my old filesystem.

That command looked like `cryptsetup luksOpen /dev/sda5 /media/ubuntu/$ID`

But I ran into some issues with trying to recover my ubuntu installation from Ubuntu 15.04. Thought I'd document what I went through for posterity. You see, the Ubuntu 15.04 livecd doesn't come with exfat-fuse, and my ~400 GB external filesystem is exFat.

Since it's a LiveCD, it has no persistence allowing me to install this package. Luckily, I had fuse-exfat installed on my main system.

Here's what I had to do:

`mount -o bind /dev /media/ubuntu/$ID/dev` to give my encrypted and mounted HDD system access to the LiveCD's /dev, where /dev/sda5 was available.

Then I had to:

`chroot /media/ubuntu/$ID/dev` to change my root filesystem to the encrypted one, thus giving the system access to exfat-fuse.

`mount -t exfat /dev/sdc3 /mnt` to mount my external drive as exfat.

 Finally, I could `tar cfz /mnt/home.tar.gz /home/me` to gzip and tarball my home directory for copying after my upgrade.

Blech.

I'll update this post after I install Ubuntu 15.04 to the system and untar my home dir to my new /home.

UPDATE:

Alright, I installed and full-disk encrypted my Ubuntu 15.04 installation. I copied over my old home dir, after installing exfat-fuse. Then I installed srm via `apt-get install secure-delete` and srm'd my old home dir backup on the exFat drive. Finally!