LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Want to recover data from Encrypted partition (created by EXT3 Ubuntu 10.04) (https://www.linuxquestions.org/questions/linux-newbie-8/want-to-recover-data-from-encrypted-partition-created-by-ext3-ubuntu-10-04-a-837380/)

crts 10-21-2010 06:24 AM

Hi,

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.

shikhar623 10-21-2010 02:03 PM

1 Attachment(s)
Quote:

Originally Posted by crts (Post 4134631)
Hi,

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
Attachment 4938
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...

-------- Uninstall Beginning --------
Module: bcmwl
Version: 5.60.48.36+bdcom
Kernel: 2.6.35-22-generic (i686)
-------------------------------------

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...

-------- Uninstall Beginning --------
Module: bcmwl
Version: 5.60.48.36+bdcom
Kernel: 2.6.35-22-generic (i686)
-------------------------------------

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:~#
what next?

crts 10-21-2010 02:34 PM

I was assuming that /dev/sda7 was your encrypted device. As it seems /dev/sda7 is not encrypted. If you want to mount /dev/sda7 just do
Code:

sudo -i
mount /dev/sda7 /mnt

If /dev/sda7 is not what you are looking for then do the following
Code:

sudo -i
for f in /dev/sd*; do cryptsetup isLuks "${f}" && echo "${f}"; done

This will print all encrypted harddisks. Post the result before you continue.

shikhar623 10-21-2010 03:00 PM

Quote:

Originally Posted by crts (Post 4135121)
I was assuming that /dev/sda7 was your encrypted device. As it seems /dev/sda7 is not encrypted. If you want to mount /dev/sda7 just do
Code:

sudo -i
mount /dev/sda7 /mnt

If /dev/sda7 is not what you are looking for then do the following
Code:

sudo -i
for f in /dev/sd*; do cryptsetup isLuks "${f}" && echo "${f}"; done

This will print all encrypted harddisks. Post the result before you continue.

it gets mounted but i am not able to open USERNAME folder.
http://img209.imageshack.us/i/screenshot6xh.png/

crts 10-21-2010 03:06 PM

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.

shikhar623 10-21-2010 03:22 PM

Quote:

Originally Posted by crts (Post 4135138)
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

fbobraga 10-21-2010 03:44 PM

Quote:

Originally Posted by shikhar623 (Post 4135148)
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])

shikhar623 10-21-2010 03:50 PM

Quote:

Originally Posted by fbobraga (Post 4135163)
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
(issuing just the command nautilus after the sudo -i, in the same shell, is equivalent to it)

i did the same way. opened nautilus from the same terminal as root.

crts 10-21-2010 03:53 PM

Quote:

Originally Posted by shikhar623 (Post 4135148)
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.

shikhar623 10-21-2010 03:54 PM

Quote:

Originally Posted by crts (Post 4135168)
Now that looks like you did not do an encrypted install, but only encrypted your 'home' directory.

now how can i open the encrypted HOME Dir.?

crts 10-21-2010 04:00 PM

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

Before you try to mount you might need to issue
Code:

/etc/init.d/cryptdisks start
Exit the chroot environment
Code:

exit

fbobraga 10-21-2010 04:06 PM

this may help: https://help.ubuntu.com/community/En...ata%20Manually

or http://ubuntuforums.org/showthread.php?t=1337693

shikhar623 10-21-2010 04:31 PM

Quote:

Originally Posted by crts (Post 4135176)
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

Before you try to mount you might need to issue
Code:

/etc/init.d/cryptdisks start
Exit the chroot environment
Code:

exit

http://img41.imageshack.us/img41/2705/screenshot2ae.png
the first command did not work.

crts 10-21-2010 04:35 PM

Quote:

Originally Posted by shikhar623 (Post 4135194)

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.

shikhar623 10-21-2010 04:42 PM

Quote:

Originally Posted by crts (Post 4135176)
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

Before you try to mount you might need to issue
Code:

/etc/init.d/cryptdisks start
Exit the chroot environment
Code:

exit

having problem in last command "mount /home"
returns an error.do i need to edit /etc/fstab file?
http://img686.imageshack.us/img686/5...eenshot3xi.png


All times are GMT -5. The time now is 09:22 PM.