2

I decided yesterday to upgrade from 16.04 to GNOME(Ubuntu) 17.04. I followed the instructions using a live-usb but when I tried to reboot this did not work out. So I repeated the installation twice till it worked.

I now have an Ubuntu-Gnome 17.04 working system. However the home folder data of the old install were encrypted. A fact that I had forgotten.

I get:

$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
sda             931.5G                                                
├─sda1   vfat     479M /boot/efi                                      
├─sda2   ext4   186.3G /                                              
├─sda3   swap     3.7G                                                
│ └─cryptswap1 │        swap     3.7G [SWAP]                          
└─sda4   ext4   741.1G
/media/gnsibab/be2da67b-d6ac-4b75-a94e-34ad4d62c040  sr0             
1024M

I want to open sda4 which is my old /home partition. However I did not save the passphrase. I only have my old login name sirah18 (whereas gnsibab is my new login name) and my old login password oldpass. How can I recover the data that are inside the sda4 partition?(Note: sda4 has a greater size than sda2.) PLEASE consider me a newbie because I had a very long 4 years break from using Ubuntu.

I tried:

$ cryptfs-unwrap-passphrase wrapped-passphrase
Error: Unwrapping passphrase failed [-2]

$ cat /etc/fstab
UUID=462b7284-7533-47e9-9c38-8d6c775d73ef /               ext4   errors=remount-ro  0       1
UUID=6675-4A8A                            /boot/efi       vfat    umask=0077        0       1
UUID=25592dd8-52fb-49e4-a376-9f5693f3c15e none            swap    sw                0       0
/dev/mapper/cryptswap1 none swap sw 0 0

Finally I am now using again encrypted home folder when I installed the last time but now I have saved the passphrase.

UPDATE: I FOUND THE PASSPHRASE - Had it saved in a USB drive after all. Did like stephan told me:

gksudo gedit /etc/fstab  added: UUID=be2da67b-d6ac-4b75-a94e-34ad4d62c040 /home ext4 defaults 0 2
sudo cp -rp /home/.ecryptfs/gnsibab/ /media/gnsibab/be2da67b-d6ac-4b75-a94e-34ad4d62c040/.ecryptf‌​s/
sudo cp -rp /home/gnsibab/ /media/gnsibab/be2da67b-d6ac-4b75-a94e-34ad4d62c040/

reboots successfully

$ sudo mount -t ecryptfs /home/sirah18/.Private /home/sirah18/Private 
Passphrase:  
Select cipher:   
 1) aes: blocksize = 16; min keysize = 16; max keysize = 32
 2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
 3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
 4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
 5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
 6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]: 1
Select key bytes:
 1) 16
 2) 32
 3) 24
Selection [16]: 1
Enable plaintext passthrough (y/n) [n]: n
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [0ebecd7fc86a9814]: 65b9422c4ecc5e53
Attempting to mount with the following options:
  ecryptfs_unlink_sigs
  ecryptfs_fnek_sig=65b9422c4ecc5e53
  ecryptfs_key_bytes=16
  ecryptfs_cipher=aes
  ecryptfs_sig=0ebecd7fc86a9814
Mounted eCryptfs

But Private folder is empty. I get:

$ sudo ecryptfs-recover-private sirah18
INFO: Searching for encrypted private directories (this might take a while)...
find: ‘/proc/2225/task/2225/net’: Invalid argument
find: ‘/proc/2225/net’: Invalid argument
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8AxPhJtAm2cepgCjSXk2vOU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8Zy5QlHf4bmjh-2o4On0tPU--’: No such file or directory
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8FgvJk0Y3CxCU7dhZ4KDdzk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8bEZdy915POoTqZ8yGDR6AE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8ZteXtq4cErCuYGVOLyfCq---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8LnOginVw5O5lLjZFbWMRv---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8QAYayz7xdRsJ7kEnx0Omrk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8N9zop1o89Leh8-14gGeClU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8K8duUb6ZTYolC6IFCaw.5E--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt88-zKowxY3laVs-z5oTuwxU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8NJPlguVA6BqEdb0sHjechk--’: No such file or directory  
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8.njQ3vaFHIAtU0TkxxIBVE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8nPvPzRW.O8utPRdP6jPvBU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt88g3l4RZv0rjefrdncnD5pk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8MtQHrXtUgpBqAjYNku1Ayk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8dXhM33s4of2rLM1KHDVYnU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8YbUBLndntDBQLuihssPAnk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8Wv65dwU9eS5V6D7iUQvDZ---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8JPNjK9sKB8KY08MyeWXiQ---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8XQ5dqqwxjeNrg6xFKonBIk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt863ci3CVYSS6CKD4SckaUPU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8VDk2q6hShlHb0TMVgESjRk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8LZi3nRP7FK3ktPwwZFTrAE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8o5mSmCZxs0s1KVwLlYy5KE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8iwywMPwdaxxnufaFGZFFFE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt83BzOMjBpqZKWVrJ.e5ID6E--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8-ajdK3Jfl.0X7Yy9rMx6UU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt80BtrLgbjRfDcvZLXG7C3jU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8IdpOfBXXqBAOtslTcVLxkU--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8vrBrypo.oO5UdHGZ407v2E--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8bK.efSVPf9cZDRbJt.nxQk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8RcAEdx73qHDtfX6wPkyrF---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8ZppBlCuzOCWQPHb9XM4glk--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8OVaWQBoAa1tAwa2vHSYF9---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8I4c0qMhAeR1ANSvQB3ZxEE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8H.r0FfzSkXUdCo1fi.GEwE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8uq47VRVFO45O4AlMPh1FbE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8GdQCq-RK16dxB4w6Pz-hfE--’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8W.VhhQOPVmtEzPsVlvJRj---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8azLm8vZkWpoh8kKQTCih8---’: No such file or directory 
find: ‘/home/sirah18/Private/ECRYPTFS_FNEK_ENCRYPTED.FWac7O8cdBWxk-T5z6dTuO1YrK-tqJ-viXt8240D.plYihNtCcTJiUoghU--’: No such file or directory 
find: ‘/run/user/1000/gvfs’: Permission denied
1

The issue was resolved in the comments. Here is a summary of what we did:

Copy the new home folder to the old home partition and make Ubuntu automount that partition at startup

Since during his last installation OP did not choose to use his former home partition sda4, it was necessary to modify /etc/fstab such that this partition is mounted automatically at startup. But before we did that, we had to copy the current home folder for his user gnsibab to that partition. Since the new home directory was encrypted, as well, this had to be done by

$ ecryptfs-umount-private
$ cp -rp /home/.ecryptfs/gnsibab /$OLD_HOME_PARTITION/.ecryptfs
$ cp -rp /home/gnsibab/ /$OLD_HOME_PARTITION

where OLD_HOME_PARTITION was the mount point of sda4. The ecryptfs-umount-private is in order to prevent files from being changed as they are being copied (Sometimes it gives the error Sessions still open, not unmounting, in that case, you should logout of your graphical session and use Ctrl+Alt+F1 to login at a text console and execute these commands there). Note that in many answers on AskUbuntu, they recommend rsync instead of cp as this for example allows you to continue the copy progress if it gets interrupted.

After copying the new home folder, we added the line

UUID=be2da67b-d6ac-4b75-a94e-34ad4d62c040 /home ext4 defaults 0 2

to /etc/fstab, and by doing so, OP was able to login as gnsibab after rebooting with sda4 mounted under /home.

Recovering the old data

In order to access the encrypted data for the old user sirah18, we used

sudo ecryptfs-recover-private /home/sirah18/.Private

which detects the wrapped-passphrase file in /home/sirah18/.ecryptfs, asks for the old login passphrase, and uses that to unwrap the mount passphrase and mount the .Private folder at a directory in /tmp.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.