LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 09-25-2018, 10:27 PM   #31
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957

Quote:
Originally Posted by LUKShelp View Post
However, when I try to mount it using cryptsetup - it prompts for the password, but when I type the password, it returns: "no key available for this passphrase". I'm pretty sure I'm entering the password correctly because I used the same password before to unlock and auto-mount the previous failed partitions, that was on the GUI though. I'm not sure why it's not working with cryptsetup.
That unfortunately suggests that the key material in the LUKS header might have been partially overwritten. What tool did you use to make the resized partition? Some versions of gparted have been known to write a garbage sector in the area where LUKS key material for the first key slot is stored. Did you make a backup of that LUKS header? It should be a ~1 MB or ~2 MB file, depending on the key size.

There is a tool that checks for damaged key slots. Is just looks for "non-random looking" data in the key material. For some reason it is not normally compiled and installed, but exists only in the source code for cryptsetup-1.6.0 and later versions. It's mentioned briefly in the Cryptsetup FAQ, but it's been a long time since I tried to build or use it. The output from "cryptsetup luksDump" shows the "Key material offset" (in 512-byte sectors) where that "random-looking" material should start. If you look with at hex editor and see anything that looks decidedly non-random there or in the next few sectors (the key material actually goes on for far more sectors than you would care to look), you know you have a problem.
 
Old 09-26-2018, 11:23 AM   #32
LUKShelp
LQ Newbie
 
Registered: Sep 2018
Posts: 18

Original Poster
Rep: Reputation: Disabled
Ok, after restoring the LUKS header, and again entering the right password, it finally works, however, it now outputs: "Cannot use device /dev/sda2 which is already in use (already mapped or mounted)". I used the command
Code:
sudo cryptsetup luksOpen /dev/sda2 myfs
Holy crap... so after that error, I had another cloned disk, so I restored the LUKS header to that disk as well, and now I have "myfs" and "ubuntu-gnome-vg-root" under /dev/mapper. What should I do now?

After looking around, I found /dev/ubuntu-gnome-vg/root in gnome disks and mounted it, says structure needs cleaning.

Last edited by LUKShelp; 09-26-2018 at 12:18 PM.
 
Old 09-26-2018, 01:00 PM   #33
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Now it seems that LVM is involved. Since I'm not looking over your shoulder, I'm a bit lost as to what is where and the filesystem(s) involved. With the LUKS container(s) unlocked, please run "lsblk -f" and post the output.
 
Old 09-26-2018, 03:08 PM   #34
LUKShelp
LQ Newbie
 
Registered: Sep 2018
Posts: 18

Original Poster
Rep: Reputation: Disabled
Code:
sda                                                                   
├─sda1
│                                                                     
└─sda2
     crypto                    7d2c9f84-813c-4da4-a62f-5cfac9b88b67   
sdb                                                                   
sdd                                                                   
├─sdd1
│    ext2                      78569fbf-ea75-4fa0-b3d2-248360e84ec2   
└─sdd2
     crypto                    7d2c9f84-813c-4da4-a62f-5cfac9b88b67   
  └─myfs
     LVM2_m                    c0HXY1-1evm-Bz9n-ZkcY-HkjX-A7OX-b3020l 
    └─ubuntu--gnome--vg-root
       ext4                      3f9695f9-ac18-41d7-b195-35b82c48b4f3   
sr0  iso966 Ubuntu-MATE 18.04.1 LTS amd64
                               2018-07-25-03-37-28-00                 /cdrom
sr1                                                                   /media/ubu
ubuntu-mate@ubuntu-mate:~$
Sorry, looks like things got a little cut off there. Is that good enough?
 
Old 09-26-2018, 10:26 PM   #35
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Good enough. Apparently the system was happy with the ubuntu-gnome-vg-root logical volume fitting within the sdd2 partition and found the ext4 filesystem within. Since you do have a backup of all this, running "fsck -fy /dev/mapper/ubuntu--gnome--vg-root" should clean up the filesystem so that it can be mounted.

Last edited by rknichols; 09-27-2018 at 08:23 AM.
 
Old 09-29-2018, 10:15 AM   #36
LUKShelp
LQ Newbie
 
Registered: Sep 2018
Posts: 18

Original Poster
Rep: Reputation: Disabled
Ok, so I ran the command. How do I mount the filesystem? When I try to mount "myfs" I get "unknown filesystem type 'LVM2_member'".

I looked it up and found the command:
Code:
udisks -b /dev/mapper/ubuntu--gnome--vg-root
It mounted, but I wasn't able to find anything I was trying to find, the /home folder was empty, etc. Starting to wonder if this was a fruitless endeavor.

Last edited by LUKShelp; 09-29-2018 at 10:38 AM.
 
Old 09-29-2018, 01:01 PM   #37
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Did you run the "fsck -fy /dev/mapper/ubuntu--gnome--vg-root" command I suggested? I'd also like to see the output from the "vgs" and "lvs" commands.

Perhaps the /home directory in that root filesystem is just a mount point for another volume. Does the /etc/fstab in that filesystem show anything for /home?
 
Old 09-30-2018, 05:15 AM   #38
LUKShelp
LQ Newbie
 
Registered: Sep 2018
Posts: 18

Original Poster
Rep: Reputation: Disabled
I'll check once I'm back home but yes I did run the command.

sudo vgs:

Code:
ubuntu-mate@ubuntu-mate:~$ sudo vgs
  WARNING: Device /dev/mapper/myfs has size of 244033536 sectors which is smaller than corresponding PV size of 245276672 sectors. Was device resized?
  One or more devices used as PVs in VG ubuntu-gnome-vg have changed sizes.
  VG              #PV #LV #SN Attr   VSize   VFree
  ubuntu-gnome-vg   1   2   0 wz--n- 116.95g    0 
ubuntu-mate@ubuntu-mate:~$
sudo lvs:

Code:
  WARNING: Device /dev/mapper/myfs has size of 244033536 sectors which is smaller than corresponding PV size of 245276672 sectors. Was device resized?
  One or more devices used as PVs in VG ubuntu-gnome-vg have changed sizes.
  LV     VG              Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   ubuntu-gnome-vg -wi-a----- <103.80g                                                    
  swap_1 ubuntu-gnome-vg -wi-s-----  <13.16g                                                    
ubuntu-mate@ubuntu-mate:~/test$
Weird, but now the "udisks" command is not working anymore. Is that the correct way to mount the filesystem?

Last edited by LUKShelp; 09-30-2018 at 07:33 AM.
 
Old 09-30-2018, 10:39 AM   #39
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by LUKShelp View Post
Code:
ubuntu-mate@ubuntu-mate:~$ sudo vgs
  WARNING: Device /dev/mapper/myfs has size of 244033536 sectors which is smaller than corresponding PV size of 245276672 sectors. Was device resized?
  One or more devices used as PVs in VG ubuntu-gnome-vg have changed sizes.
  VG              #PV #LV #SN Attr   VSize   VFree
  ubuntu-gnome-vg   1   2   0 wz--n- 116.95g    0 
ubuntu-mate@ubuntu-mate:~$
Well that's the problem, or at least one problem. Your partition is 607 MiB too small (1243136 sectors). You need to adjust the partition table again.

What did fsck report when you ran it? I would be surprised if it didn't detect the size problem and refuse to run.

Regarding udisks, I've never used it, and the Ubuntu-16.04 I have available doesn't have it available. I just use the mount command directly (as root).
 
Old 09-30-2018, 11:48 AM   #40
LUKShelp
LQ Newbie
 
Registered: Sep 2018
Posts: 18

Original Poster
Rep: Reputation: Disabled
Hmm.... Ok.

So I repartitioned the disk and ran "sudo vgs/lvs" commands again, no complains. However, I mounted the disk via gnome disks, and again, nothing in the /home folder.

Ran fsck on "/dev/mapper/ubuntu--gnome--vg-root" and it came back clean.

I will try this with my second disk.

BTW, nothing was mapped to my /home folder in fstab. So weird, because I'm positive this is the disk I was using.

Last edited by LUKShelp; 09-30-2018 at 03:49 PM.
 
Old 09-30-2018, 09:39 PM   #41
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
By any chance, have you looked in the lost+found directory in that filesystem?

What does the disk partitioning look like now? Is there still any large block of unallocated space?

It really doesn't make any sense that the filesystem would come back with no errors but with an empty /home if that's where your data had been. That sort of thing "just doesn't happen".
 
Old 09-30-2018, 10:54 PM   #42
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,143

Rep: Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935
It does if something else was mounted to /home. And yes, I saw the comment about nothing being in fstab for /home. In truth, with the root that big I wouldn't expect a separate lv for /home. Very odd.
 
Old 10-01-2018, 06:34 AM   #43
LUKShelp
LQ Newbie
 
Registered: Sep 2018
Posts: 18

Original Poster
Rep: Reputation: Disabled
There aren't any unallocated spaces except for a small space before the encrypted partition.

I havent looked in the lost+found directory, where would that be found?

@syg00: what does it mean for something else to be mounted to /home?

Ugh... this sucks...
 
Old 10-01-2018, 07:37 AM   #44
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,143

Rep: Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935
It is common to have a separate partition created for /home. For this to be accessed the separate partition has to be "mounted" - /home is then the mount-point, and all sub-directories (like Documents say) can then be referenced. The mount is usually automated by an entry in /etc/fstab.
This separate partition (or lv) can be on the same disk, or another, it matters not.
 
Old 10-01-2018, 08:01 AM   #45
LUKShelp
LQ Newbie
 
Registered: Sep 2018
Posts: 18

Original Poster
Rep: Reputation: Disabled
Would that be something a user would set up themselves, or an automated process during installation?

Mine was just a regular install so I don't get why the /home folder wouldn't be there.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Recovering a deleted partition table of a LUKS encrypted flash drive b92kvmomim Linux - Newbie 11 05-18-2017 09:35 AM
[SOLVED] Moving LUKS-encrypted USB-disk to new machine Yalla-One Linux - Software 4 12-28-2016 02:16 PM
Adding a second disk to lum luks encrypted setup? chytraeus Slackware 3 05-15-2016 11:44 PM
Recovering deleted file from a LUKS encrypted partition knowing its passhprase Karimo Linux - Security 2 05-28-2012 03:48 PM
[SOLVED] Automount LUKS encrypted USB disk as regular user gargamel Slackware 11 10-31-2009 05:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration