[SOLVED] Want to recover data from Encrypted partition (created by EXT3 Ubuntu 10.04)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
here is another procedure. I assume you used the alternate installer and used lvm to create an encrypted root and swap partition.
1.) Boot from the liveCD and become root by typing into a terminal
Code:
sudo -i
2.) Install some tools (You will need internet access for this to work)
Code:
aptitude install cryptsetup lvm2
3.) Assuming that /dev/sda7 is the partition that holds your encrypted filesystem
Code:
cryptsetup luksOpen /dev/sda7 sda7_crypt
You should be asked for your passphrase now. Enter it. If everything went well it should display something like
Code:
Key slot 0 unlocked.
4.) Make your logical volumes visible
Code:
vgchange -a y
The result should be something like
Code:
2 logical volume(s) in volume group "ubuntu" now active
Enter the following
Code:
ls /dev/ubuntu/
It should list the names of the logical volumes. One of them should be named root or so.
5.) Mount the logical volume named root.
Code:
mount /dev/ubuntu/root /mnt
If everything went Ok, then you should be able to access your files in /mnt. After you have copied your files to a secure location (thumbdrive, external harddisk... just not to the temporary filesystem of the liveuser) you can unmount everything and close the encrypted drive.
Code:
sync
umount /mnt
vgchange -a n
cryptsetup luksClose sda7_crypt
That should be it. If your setup varies or if any of the command fails post exactly what you have typed with the corresponding output up to the command that failed.
here is another procedure. I assume you used the alternate installer and used lvm to create an encrypted root and swap partition.
1.) Boot from the liveCD and become root by typing into a terminal
Code:
sudo -i
2.) Install some tools (You will need internet access for this to work)
Code:
aptitude install cryptsetup lvm2
3.) Assuming that /dev/sda7 is the partition that holds your encrypted filesystem
Code:
cryptsetup luksOpen /dev/sda7 sda7_crypt
You should be asked for your passphrase now. Enter it. If everything went well it should display something like
Code:
Key slot 0 unlocked.
4.) Make your logical volumes visible
Code:
vgchange -a y
The result should be something like
Code:
2 logical volume(s) in volume group "ubuntu" now active
Enter the following
Code:
ls /dev/ubuntu/
It should list the names of the logical volumes. One of them should be named root or so.
5.) Mount the logical volume named root.
Code:
mount /dev/ubuntu/root /mnt
If everything went Ok, then you should be able to access your files in /mnt. After you have copied your files to a secure location (thumbdrive, external harddisk... just not to the temporary filesystem of the liveuser) you can unmount everything and close the encrypted drive.
Code:
sync
umount /mnt
vgchange -a n
cryptsetup luksClose sda7_crypt
That should be it. If your setup varies or if any of the command fails post exactly what you have typed with the corresponding output up to the command that failed.
Hope this helps.
Step 2 did not work
instead i used
Quote:
apt-get install cryptsetup lvm2
the code is as follows:
Quote:
ubuntu@ubuntu:~$ sudo -i
root@ubuntu:~# aptitude install cryptsetup lvm2
The program 'aptitude' can be found in the following packages:
* aptitude
* aptitude-gtk (You will have to enable component called 'universe')
Try: apt-get install <selected package>
root@ubuntu:~# aptitude install cryptsetup lvm2
The program 'aptitude' can be found in the following packages:
* aptitude
* aptitude-gtk
Try: apt-get install <selected package>
root@ubuntu:~# aptitude install cryptsetup lvm2
The program 'aptitude' can be found in the following packages:
* aptitude
* aptitude-gtk
Try: apt-get install <selected package>
root@ubuntu:~# aptitude install cryptsetup lvm2
The program 'aptitude' can be found in the following packages:
* aptitude
* aptitude-gtk
Try: apt-get install <selected package>
root@ubuntu:~# apt-get install cryptsetup lvm2
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
root@ubuntu:~# apt-get install cryptsetup lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
cryptsetup is already the newest version.
The following extra packages will be installed:
libdevmapper-event1.02.1 watershed
The following NEW packages will be installed:
libdevmapper-event1.02.1 lvm2 watershed
0 upgraded, 3 newly installed, 0 to remove and 14 not upgraded.
2 not fully installed or removed.
Need to get 446kB of archives.
After this operation, 1,278kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ maverick/main libdevmapper-event1.02.1 i386 2:1.02.39-1ubuntu6 [27.3kB]
Get:2 http://archive.ubuntu.com/ubuntu/ maverick/main watershed i386 5 [10.7kB]
Get:3 http://archive.ubuntu.com/ubuntu/ maverick/main lvm2 i386 2.02.54-1ubuntu6 [408kB]
Fetched 446kB in 22s (19.5kB/s)
Selecting previously deselected package libdevmapper-event1.02.1.
(Reading database ... 124563 files and directories currently installed.)
Unpacking libdevmapper-event1.02.1 (from .../libdevmapper-event1.02.1_2%3a1.02.39-1ubuntu6_i386.deb) ...
Selecting previously deselected package watershed.
Unpacking watershed (from .../archives/watershed_5_i386.deb) ...
Selecting previously deselected package lvm2.
Unpacking lvm2 (from .../lvm2_2.02.54-1ubuntu6_i386.deb) ...
Processing triggers for man-db ...
Setting up initramfs-tools (0.98.1ubuntu6) ...
update-initramfs: deferring update (trigger activated)
cp: cannot stat `/vmlinuz': No such file or directory
dpkg: error processing initramfs-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up bcmwl-kernel-source (5.60.48.36+bdcom-0ubuntu5) ...
Removing old bcmwl-5.60.48.36+bdcom DKMS files...
Status: Before uninstall, this module version was ACTIVE on this kernel.
wl.ko:
- Uninstallation
- Deleting from: /lib/modules/2.6.35-22-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod....
DKMS: uninstall Completed.
------------------------------
Deleting module version: 5.60.48.36+bdcom
completely from the DKMS tree.
------------------------------
Done.
Loading new bcmwl-5.60.48.36+bdcom DKMS files...
First Installation: checking all kernels...
Building only for 2.6.35-22-generic
Building for architecture i686
Building initial module for 2.6.35-22-generic
Done.
wl.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/2.6.35-22-generic/updates/dkms/
depmod....
DKMS: install Completed.
update-initramfs: deferring update (trigger activated)
ffcp: cannot stat `/vmlinuz': No such file or directory
dpkg: error processing bcmwl-kernel-source (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up libdevmapper-event1.02.1 (2:1.02.39-1ubuntu6) ...
dpkg: dependency problems prevent configuration of watershed:
watershed depends on initramfs-tools; however:
Package initramfs-tools is not configured yet.
dpkg: error processing watershed (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lvm2:
lvm2 depends on watershed (>= 2); however:
Package watershed is not configured yet.
dpkg: error processing lvm2 (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin ...
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
ldconfig deferred processing now taking place
Errors were encountered while processing:
initramfs-tools
bcmwl-kernel-source
watershed
lvm2
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ubuntu:~# cryptsetup luksOpen /dev/sda7 sda7_crypt
Device /dev/sda7 is not a valid LUKS device.
root@ubuntu:~# aptitude install cryptsetup lvm2
The program 'aptitude' can be found in the following packages:
* aptitude
* aptitude-gtk
Try: apt-get install <selected package>
root@ubuntu:~# clear
root@ubuntu:~# aptitude install cryptsetup lvm2
The program 'aptitude' can be found in the following packages:
* aptitude
* aptitude-gtk
Try: apt-get install <selected package>
root@ubuntu:~# apt-get install cryptsetup lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
cryptsetup is already the newest version.
lvm2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
4 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up initramfs-tools (0.98.1ubuntu6) ...
update-initramfs: deferring update (trigger activated)
cp: cannot stat `/vmlinuz': No such file or directory
dpkg: error processing initramfs-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up bcmwl-kernel-source (5.60.48.36+bdcom-0ubuntu5) ...
Removing old bcmwl-5.60.48.36+bdcom DKMS files...
Status: Before uninstall, this module version was ACTIVE on this kernel.
wl.ko:
- Uninstallation
- Deleting from: /lib/modules/2.6.35-22-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod....
DKMS: uninstall Completed.
------------------------------
Deleting module version: 5.60.48.36+bdcom
completely from the DKMS tree.
------------------------------
Done.
Loading new bcmwl-5.60.48.36+bdcom DKMS files...
First Installation: checking all kernels...
Building only for 2.6.35-22-generic
Building for architecture i686
Building initial module for 2.6.35-22-generic
Done.
wl.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/2.6.35-22-generic/updates/dkms/
depmod....
DKMS: install Completed.
update-initramfs: deferring update (trigger activated)
cp: cannot stat `/vmlinuz': No such file or directory
dpkg: error processing bcmwl-kernel-source (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of watershed:
watershed depends on initramfs-tools; however:
Package initramfs-tools is not configured yet.
dpkg: error processing watershed (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lvm2:
lvm2 depends on watershed (>= 2); however:
Package watershed is not configured yet.
dpkg: error processing lvm2 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
Errors were encountered while processing:
initramfs-tools
bcmwl-kernel-source
watershed
lvm2
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ubuntu:~#
That is probably because you are opening nautilus a normal user.
Try as root
Code:
nautilus
BTW, it does not seem like you have any encrypted disks.
the USERNAME got opened with NAUTILUS.
but the USERNAME directory contains ony two files.
i mean there is no Desktop,Documents, ....in the USERNAME folder.as shown in the shreenshot. http://img301.imageshack.us/img301/7...reenshotxx.png
Last edited by shikhar623; 10-21-2010 at 03:25 PM.
the USERNAME got opened with NAUTILUS.
but the USERNAME directory contains ony two files.
i mean there is no Desktop,Documents, ....in the USERNAME folder.as shown in the shreenshot. http://img301.imageshack.us/img301/7...reenshotxx.png
as said, nautilus need to be open as root to access the /home/USERNAME - open it in the shell (not by the menu!) issuing the command:
Code:
sudo nautilus
(as instructed, issuing just the command nautilus after the sudo -i, in the same shell/terminal, is equivalent to it - note the change of "$" to "#" after the sudo -i command: this shows that the next commands will be run by the user root [in the LiveCD password isn't asked to issue sudo])
the USERNAME got opened with NAUTILUS.
but the USERNAME directory contains ony two files.
i mean there is no Desktop,Documents, ....in the USERNAME folder.as shown in the shreenshot. http://img301.imageshack.us/img301/7...reenshotxx.png
Now that looks like you did not do an encrypted install, but only encrypted your 'home' directory.
I am not sure if this will work since I never encrypt my /home. I always encrypt the whole disk. You could try the following as root
Code:
mount --bind /dev /mnt/dev
mount -t devpts devpts /mnt/dev/devpts
mount -t tmpfs shm /mnt/dev/shm
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
chroot /mnt
mount /home
I am not sure if this will work since I never encrypt my /home. I always encrypt the whole disk. You could try the following as root
Code:
mount --bind /dev /mnt/dev
mount -t devpts devpts /mnt/dev/devpts
mount -t tmpfs shm /mnt/dev/shm
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
chroot /mnt
mount /home
I was assuming that /dev/sda7 is mounted on /mnt. Replace /mnt with whereever you mounted /dev/sda7.
You might want to also check out the link provided by fbobraga.
I am not sure if this will work since I never encrypt my /home. I always encrypt the whole disk. You could try the following as root
Code:
mount --bind /dev /mnt/dev
mount -t devpts devpts /mnt/dev/devpts
mount -t tmpfs shm /mnt/dev/shm
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
chroot /mnt
mount /home
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.