LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Just another encryption problem (https://www.linuxquestions.org/questions/linux-newbie-8/just-another-encryption-problem-4175514251/)

kulfon 08-11-2014 01:11 PM

Just another encryption problem
 
Hello linux community.
My problem isn't notching challenging I believe but after four days of searching and trying how to recover data I'm in the same place.
From the beginning. In my first ssd drive I have W7, on another hdd 1TB data (ntfs) and on 160Gb connected with USB is (was?) MINT 17 encrypted with LUKS. Unfortunately I can't remember that I encrypted whole partition or only /home catalog. Four days ago I was trying to install crunchbang on USB pendrive and when installator ask to save partitions setup I chose default with was pendrive. After that on new system grub there was only crunchbang and W7 OS to chose without MINT because hdd with MINT was disconnected during debian installation. So, assuming. All I need is recover/repair mint system or at least /home catalog. Maybe it's possible to fix GRUB/GPT??
I was trying with
http://alvinabad.wordpress.com/2012/...ncrypted-disk/ but I stuck on
Quote:

cryptsetup -v luksOpen /dev/sda5 sda5_crypt
I can't use commands like
Code:

lvdisplay, vgchange,
Some info

Code:

fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x16b5d5a7

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848  234438655  117115904    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d4981

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              63  614405924  307202931    7  HPFS/NTFS/exFAT
/dev/sdb2      614405925  1281778154  333686115    7  HPFS/NTFS/exFAT
/dev/sdb3      1281778155  1953520064  335870955    7  HPFS/NTFS/exFAT

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

  Device Boot      Start        End      Blocks  Id  System
/dev/sdc1  *          1  312581807  156290903+  ee  GPT

Disk /dev/sdd: 16.0 GB, 16027484160 bytes
255 heads, 63 sectors/track, 1948 cylinders, total 31303680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00054760

  Device Boot      Start        End      Blocks  Id  System
/dev/sdd1            2048    29927423    14962688  83  Linux
/dev/sdd2        29929470    31301631      686081    5  Extended
/dev/sdd5        29929472    31301631      686080  82  Linux swap / Solaris

Disk /dev/mapper/udisks-luks-uuid---------------------------------------------: 159.3 GB, 159271354368 bytes
255 heads, 63 sectors/track, 19363 cylinders, total 311076864 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/udisks-luks-uuid--------------------------------- doesn't contain a valid partition table

Maybe some advice or links please?? I appreciate any help.
Thx.

kilgoretrout 08-12-2014 02:41 PM

You are following that excellent HowTo a little to literally. From what you describe and the fdisk output, Mint is probably installed on a single partition, sdc1. That's the only partition listed on the 160GB drive. To test if this is a LUKS encrypted partition you should run as root:

# cryptsetup -v luksDump /dev/sdc1

Try it and see what output you get.

kulfon 08-12-2014 03:27 PM

Thx for reply.
I forget to paste before what I got from # cryptsetup -v luksDump /dev/sdc3
With /dev/sdc1 and sdc2 i get "its not a proper LUKS device" (it should be sounds smth like that in a translation from my language)

Code:

LUKS header information for /dev/sdc3

Version:              1
Cipher name:          aes
Cipher mode:          xts-plain64
Hash spec:            sha1
Payload offset:        4096
MK bits:              512
MK digest:            d1 d2 51 a3 12 d3 12 74 c5 b4 3b 8e 5b 62 2a 1e ab 09 0e c5
MK salt:              37 3f 47 cf 8b 0e b8 7e 90 5d 2d 4f 39 35 1d 36
                      17 b2 77 fe 21 95 f6 2b 82 4c 5a b4 74 d8 93 5c
MK iterations:        63875
UUID:                  ---------------------------------------
Key Slot 0: ENABLED
        Iterations:                255813
        Salt:                      e8 97 60 93 da 7c bd 77 7b 8a 6e 22 9a 4a a8 ed
                                      ff 62 e5 11 83 bf b6 98 00 84 6c aa 81 40 cd e7
        Key material offset:        8
        AF stripes:                    4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED


kilgoretrout 08-12-2014 05:23 PM

That's great. You've identified the encrypted partition as sdc3. Apparently, fdisk couldn't make sense out of your GPT partition structure on the 160GB sdc drive.

From here you should run the following:

# cryptsetup luksOpen /dev/sc3 enc-disk

You will be prompted to enter your LUKS password. Do so when prompted and you should get output something like this indicating you were successful:

key slot 0 unlocked.
Command successful.

That unlocks the partition; now you have to mount it. Create a mount point directory in /media called "enc-disk"

# mkdir /media/enc-disk

And finally, mount the encrypted partition on /media/enc-disk:

# mount /dev/mapper/enc-disk /media/enc-disk

That's it. If everything went OK, if you navigate to /media/enc-disk you should see the contents of your encrypted sdc3 partition.

When your done, unmount the encrypted partition and close it with:

# umount /media/enc-disk
# cryptsetup luksClose enc-disk

kulfon 08-13-2014 02:14 PM

After
Code:

# cryptsetup luksOpen /dev/sdc3 enc-disk
as a root i got
Code:

key slot 0 unlocked. Command successful
but after creating directory and type
Code:

# mount /dev/mapper/enc-disk /media/enc-disk
i got
Code:

mount: special device /dev/mapper/enc-disk does not exist
Any idea? I losing hope :/

P.S. Why I can't get access to hdd through file manager after entering password in terminal??

kilgoretrout 08-13-2014 09:27 PM

What files are in /dev/mapper?

You can check unlocking the partition with luksOpen again:

# cryptsetup luksOpen /dev/sdc3

Enter the password when prompted. After getting a successful response, run:

# ls /dev/mapper

Also, just to make sure you have the right modules loaded, post the output of:

# lsmod | grep dm-crypt

The dm-crypt module must be loaded for this to work. sdc3 is probably being mapped to some other device file in /dev/mapper than "enc-disk". The original setup may have mapped it to /dev/mapper/home or something like that. Since you successfully unlocked the partition, it must be mapped somewhere in /dev/mapper. Once you know where, you can mount the partition through that device file in /dev/mapper.

kulfon 08-14-2014 06:29 AM

So lets move on.
First I type # sudo cryptsetup luksOpen /dev/sdc3 sdc3_crypt and then I've to enter password. Pass is correct and then # ls /dev/mapper witch shows me two files: control sdc3_crypt. And then I type # lsmod | grep dm-crypt, nothing happens (or probably everything is correct and something happens in background), so I type # mount /dev/mapper/sdc3_crypt /media/enc-disk and i get an information # mount: unknown filesystem type 'LVM2_member. How can I check that dm-crypt module is loaded?

kilgoretrout 08-14-2014 10:25 AM

The encryption module is loaded or you wouldn't get as far as you did. It's probably called "dm_crypt" instead of "dm-crypt". There are slight variations in the module naming conventions with different kernels and distros. To check:

# lsmod | grep crypt

which will list all loaded modules with "crypt" in their name.

The mount error reveals that you do not have a standard encrypted single partition but setup LVM which I normally wouldn't use for a home desktop. I'll have to research how to get at an encrypted LVM volume but I'm sure it's doable.

Edit:
I'm following this guide and trying to adapt it to your situation:

http://blog.nowherelan.com/2011/04/1...lvm-partition/

First thing, you have to make sure the LVM package "lvm2" is installed. Install it with:

# apt-get install lvm2

If it's already installed, no harm done.

Next, you run:

# vgscan

Post the output you get when you run this command. What you do next will depend on that output.

kulfon 08-16-2014 06:40 AM

After # vgscan terminal shows
Code:

Reading all physical volumes.  This may take a while...
  Found volume group "mint-vg" using metadata type lvm2

I tried accomplish with http://blog.nowherelan.com/2011/04/1...lvm-partition/ and after all I have access to mint system partition but /home catalog is still encrypted and I can't read it.

crunchbang@crunchbang:~$ ls /mnt/mint/home/piekar
Access-Your-Private-Data.desktop README.txt


All times are GMT -5. The time now is 08:26 AM.