September 29, 2009

Regaining access to an encrypted /home directory after re-installation of Ubuntu Jaunty Jackalope - Part I

Following the disaster of upgrading to Ubuntu Karmic Koala Alpha 6 (see
Upgrading from Ubuntu 9.04 to Karmic Koala Alpha 6 failed ... - Part I, II and III
I decided to re-install 9.04 Jaunty Jackalope with the alternate CD to be able to regain access my encrypted files. (BAD IDEA - read ahead!)

I decided to do a clean install and in order not to disturb my original /home/UserA directory (/home is on a separate partition from /) I chose to use UserB as the pseudo root account.

Logging in using UserB I re-created UserA as a user using the GUI (menu: System -> Administration -> Users and Groups). As /home/UserA was already present, i had to use /home/UserA1 as the /home dir for this user.

Having created the UserA I went into a shell and did:

$ sudo chown -R UserA,UserA /home/UserA

as it incorrectly had the UID and GID of UserB (UID=1000,GID=1000).

Setting

Now /home/UserB is having his /home dir encrypted so at least encryption is up and running. But I still could not access the old encrypted /home/UserA dir neither from being logged in as UserA or UserB.

Looking closer at the home dir I realised that I had missed something. The /home/UserB/.ecryptfs is symlinked to /var/lib/ecryptfs/UserB. This is where the passphrases and signatures resides. And I just deleted those by re-installing. DOH!

Do not delete your partition that contains /var/lib!

I will be back soon with an alternative solution - I hope (otherwise my files are lost :-/)

September 25, 2009

Upgrading from Ubuntu 9.04 to Karmic Koala Alpha 6 failed ... - Part III

Final post regarding my failed upgrade from Ubuntu Jaunty (9.04) to Karmic Koala (future 9.10):

I deleted the /dev/sda2 partition that hosted the interim Ubuntu Studio install I used in Part I and grew the root partition on /dev/sda1 to it's full size again, both using GParted running off an external drive that used to be the hard drive for this laptop. Then I used resize2fs to let the fs knw it had the extra space.

Then I did #7-9 mentioned in Part II - only #8 took a little longer than 10 minutes :-)

And when I rebooted I got the new Karmic Koala splash screen. Woohooooo! And it recognises my encrypted /home partition so that is lovely!

Now my plan is to backup all my data and remove the data I do not need on the laptop and do a clean install of Karmic Koala Alpha. I am leaving behind the Ubuntu Studio stuff - I will do that on the desktop box instead. I will however put in Eclipse (www.eclipse.org) in order to play with Android (www.android.com) development

Mission Accomplished!

September 24, 2009

Upgrading from Ubuntu 9.04 to Karmic Koala Alpha 6 failed ... - Part II

Update from previous post:
I googled for some kind of solution to my problem and found this post from the ubuntu mail archive: [Bug 398214] Re: Karmic Koala stopps dead after /scripts/init-bottom

The solution there is the following:
1. Ensure you are connected to your router by DHCP.
2. Start your machine and select the "recovery kernel linux 2.6.31-10" with the
"down" button. Press "e" on your keyboard.
3. Select the "kernel uuid=..." entry with the "down" button and type "e" again.
4. Change "ro single" to "rw init=/bin/bash". Press "Enter" and "b" on the
keyboard.
5. Wait until booting stops and press "Enter".
6. "root@(none):" is displayed. Type in the konsole:
dhclient eth0
7. After this operation the connection to the internet is activated and you can
type in the konsole:
apt-get dist-upgrade
8. Wait 10 min until upgrade is done.
9. Reboot your machine and select "kernel linux 2.6.31-9" in grub.
I am running kernel 2.6.28-rt3 from UbuntuStudio 9.04 but I do not think that will be a problem. For the remainder of this post replace 2.6.31-39 with 2.6.28-rt3 (in my case) or what ever kernel you are running (within reason ;-)

I did #1-7 but got this error message:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
As I was already in the root recovery shell there was no need for sudo so I did:
#dpkg --configure -a

I got various dependency problems but they were not the main showstoppers. However I got:
* Mounting securityfs on /sys/kernel/security
[357.593965] type=1505 audit(12xxxxxx32.173:2): operation="profile_replace" info="failed to unpack profile" name="/usr/sbin/mysqld" pid=2180
/sbin/apparmor_parser: unable to replace "/usr/sbin/mysqld" profile doesn't conform to protocol
[357.xxxxxx] type=1505 audit(12xxxxxx32.604:3): operation="profile_load" name="/sbin/dhclient_script" name2="default" pid=2181
[357.xxxxxx] type=1505 audit(12xxxxxx32.605:4): operation="profile_replace" info="failed to unpack profile" name="/sbin/dhclient3" pid=2181

[... several other lines both kernel and dpkg lines ...]

Recursive error fixed. Need to reboot.

Here i had to do - I never got a shell prompt. But the system shuts down nicely and reboots.

I did #1-5 after the reboot and then
#dpkg --configure -a
Still dependency problems but dpkg finishes this time.

Did #6 and got this response:
You might want to run 'apt-get -f install' to correct these
The following packages have unmet dependencies:
libgnomekbdei4: Depends: libgomekbd4 but it is not installed
libice-dev: Depends: libice6 (=2:1.0.5-1) but 2:1.0.4-1 is installed
ubuntu-minimal: Depends: rsyslog but it is not installed
xserver-xorg: Depends: console-setup (>= 1.29) or
console-setup-mini (>= 1.29) but it is not installed

#apt-get -f install
which finishes apparently without problems

#apt-get dist-upgrade
[ ... several lines from apt-get listing packages ... ]
1241 upgraded, 320 newly installed, 18 to remove and 3 not upgraded
1 not fully installed or removed
Need to get 0B/1938 MB of archives
After this operation 859 MB of additional disk space will be used
Do you want to continue [Y/n]?

Well normally I would answer yes here BUT - from a recent df I remembered I had only about 350 MB available disk space. From part I you might remember that I resized the / partition (/dev/sda1) and did an install of Ubuntu-Studio 9.04 on the freed 3 GB from this rezise. Now it seems it is time to delete this install and re-resize the sda1 partition to its former size to continue with the fix.

I will return with part III when this is done ...

September 22, 2009

Upgrading from Ubuntu 9.04 to Karmic Koala Alpha 6 failed ...

I wanted to try out the new Ubuntu Karmic Koala, destined to be Ubuntu 9.10 so I decided to upgrade my laptops Ubuntu 9.04 (Jaunty Jackalope) to Karmic Koala Alpha6.

Bad Idea.

The laptop has its /home directories encrypted and I think this is what is messing up the upgrade. So now I have an unusable laptop. Which is a bit sad, because it has our photos on it :-(

I am trying to figure out how to bring it back to life.

If I start is in a recovery session it boots the kernel(s) (2.6.28.-3-rt, 2.6.28-14 and 2.6.28-15) and (apparently) runs the /scripts/local-premount, /scripts/local-bottom and /scripts/init-bottom successfully (it replies "Done." "Done." to the two first scripts and just "Done." on the third). From there I can only press which briefly gives me the recovery console but after a few short seconds the system shuts down.

I tried installing Ubuntu Studio 9.04 on available space but included my old /home directory during the install (just putting it in /etc/fstab, not formatting the drive) so the files are still there, only they are encrypted.

When booting this partition I get to the login screen. I can login, but just get a black screen with the mouse pointer on it - the /home files are not accessible so Gnome does not know how to render the screen or setup panels, menus etc.

Next step is to install Ubuntu Studio 9.04 again without referring to the old /home. Then installing encryptfs to see if I can get access to the files. I will keep you posted.