after reinstall cannot mount LUCS encrypted home partition any more

Hi, due to some inconsistencies I decided to reinstall LEAP 15.1 on following partitions:


/dev/nvme0n1p1     2048    1026047    1024000    500M System EFI
/dev/nvme0n1p2  1026048   42969087   41943040     20G Linux - system plików
/dev/nvme0n1p3 42969088 3907029134 3864060047    1,8T Linux - system plików
...
/dev/sda1             16065     273104     257040  125,5M 83 Linux
/dev/sda2            273105   19133414   18860310      9G 82 Linux swap / Solaris
/dev/sda3          19133415   61063064   41929650     20G 83 Linux
/dev/sda4          61063065 1953520064 1892457000  902,4G 83 Linux

which were originally mounted as:

/dev/nvme0n1p1       boot-uefi
/dev/nvme0n1p2       /                  root
/dev/nvme0n1p3       /home 
...
/dev/sda4           /backup

home and backup where LUCS encripted with the same passphrase. The installation asked for this passphrase, but could mount only /backup (It event offered to reformat the home partition, which I rejected. After the installation success the home partition was still engaged somehow and I could not do with it nothing more:


# p3=/dev/nvme0n1p3 
# udisksctl unlock -b $p3
Passphrase: 
Error unlocking /dev/nvme0n1p3: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Device /dev/nvme0n1p3 is already unlocked as /dev/dm-1

crypytsetup seemed to work here:

cryptsetup close $p3

but


#ls -l /dev/mapper                
crw------- 1 root root 10, 236 06-04 18:08 control
lrwxrwxrwx 1 root root       7 06-04 18:09 cr-auto-2 -> ../dm-0
lrwxrwxrwx 1 root root       7 06-04 18:23 myhome -> ../dm-1

after trying to mount it I still have:


# udisksctl mount -b /dev/mapper/myhome /h
Object /org/freedesktop/UDisks2/block_devices/dm_2d1 is not a mountable filesystem

I wonder how could I demage my important /home data. I’d be thankful if somebody sees any chance to recover it.

Surely a line

 # cryptsetup luksOpen $p3 myhome

is missing above.

Since “/dev/mapper/myhome” exists, that seems to have been done. Check if there is an appropriate entry in “/etc/crypttab”. Maybe post the content of “/etc/crypttab”).


**#** cat /etc/crypttab   
cr-auto-2  /dev/sda4
cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3  /dev/nvme0n1p3

This second entry is always there, undependantly of what I do. Should I whipe it by hand ?

Leave that there for the moment.

What’s the entry in “/etc/fstab” for your home file system?

I’m suspecting that there’s a mismatch between “/etc/fstab” and “/etc/crypttab”.

So let’s work on trying to straighten that out.


/dev/nvme0n1p2                             /                       btrfs  defaults                      0  0
/dev/mapper/cr-auto-2                      /backup                 ext4   data=ordered                  0  2
UUID=d6b3fb02-7189-4e56-bd3f-da4c1171b363  swap                    swap   defaults                      0  0
/dev/nvme0n1p2                             /var                    btrfs  subvol=/@/var                 0  0
/dev/nvme0n1p2                             /usr/local              btrfs  subvol=/@/usr/local           0  0
/dev/nvme0n1p2                             /tmp                    btrfs  subvol=/@/tmp                 0  0
/dev/nvme0n1p2                             /srv                    btrfs  subvol=/@/srv                 0  0
/dev/nvme0n1p2                             /root                   btrfs  subvol=/@/root                0  0
/dev/nvme0n1p2                             /opt                    btrfs  subvol=/@/opt                 0  0
/dev/nvme0n1p2                             /home                   btrfs  subvol=/@/home                0  0
/dev/nvme0n1p2                             /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
/dev/nvme0n1p2                             /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=C9B2-DCAF                             /boot/efi               vfat   codepage=437                  0  0

Let me remark too, that /backup and /home decription was always released together, so - this is my speculation - if /backup is mounted properly, than /home must be involved somehow too.
I see no inconsistences. /etc/crypttab says about it which partitions are encripted and fstab says, what is currently mounted.

Well, the installation made “home” a part of the second partition, so I used “/h” for my efforts to mount the third partition.

That mostly looks okay.

Can you post the output from:


blkid /dev/mapper/cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3

If that device does not exist, then try rebooting and then run that command. And, of course, you need to be root for that command.

Hi, should I be sad ?

# blkid /dev/mapper/cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3

returns NULL string.

With the question for passphrase on the graphical screen another question appears in the terxt mode reached with CTRL ALT F1. Possibly one ist for my /backup and another one for my /home . It is well possible, that such a situation appeared while installing the system. Then one question has been answered and the other not. Nevertheless the /home partition is beeing bound somehow - Could this be the explanation ?

What do you mean by re-install?
Were you expecting to re-use your encrypted partitions?
If so, I wouldn’t expect that to be possible, you’d have to decrypt your partitions before setting up encryption again after the re-install.

Unless someone comes up with something I wouldn’t expect…

TSU

Regarding all partitions I have now:


# lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda             8:0    0 931,5G  0 disk  
├─sda1          8:1    0 125,5M  0 part  
├─sda2          8:2    0     9G  0 part  [SWAP]
├─sda3          8:3    0    20G  0 part  
└─sda4          8:4    0 902,4G  0 part  
  └─cr-auto-2 254:1    0 902,4G  0 crypt /backup
sdb             8:16   1  59,6G  0 disk  
├─sdb1          8:17   1   3,8M  0 part  
└─sdb2          8:18   1   3,8G  0 part  
nvme0n1       259:0    0   1,8T  0 disk  
├─nvme0n1p1   259:1    0   500M  0 part  /boot/efi
├─nvme0n1p2   259:2    0    20G  0 part  /
└─nvme0n1p3   259:3    0   1,8T  0 part  
  └─myhome    254:0    0   1,8T  0 crypt 

with


# blkid /dev/mapper/cr-auto-2  /dev/mapper/cr-auto-2: LABEL="sda4" UUID="e1eaea48-6d26-4e58-be46-f7c54fb4f675" TYPE="ext4"
# blkid /dev/mapper/myhome
#

That means block id of myhome is empty now.

Another question is, what the following message appearing on the text screen while booting means:

cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J
request region for resource [mem 0x00c5fffc-0x00c5ffff]
 4.040724] KVM disabled by BIOS

which is shown the logfile as


Found device /dev/nvme0n1p3.
Starting Cryptography Setup for cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3...
Found device /dev/disk/by-uuid/C9B2-DCAF.
Found device ST31000528AS 4.
Starting Cryptography Setup for cr-auto-2...
Started Forward Password Requests to Plymouth.
Found device ST31000528AS 2.

I was wondering whether that would happen.

Can you give us the output from:

ls /dev/mapper

Preferably, do that just after reboot, and before you have done anything that might affect the crypto handling.

With the question for passphrase on the graphical screen another question appears in the terxt mode reached with CTRL ALT F1. Possibly one ist for my /backup and another one for my /home . It is well possible, that such a situation appeared while installing the system. Then one question has been answered and the other not. Nevertheless the /home partition is beeing bound somehow - Could this be the explanation ?

The installer asks separately for each encrypted partition. But, for normal boots, if both partitions use the same pass phrase, then you are normally only asked once.

The aim, for the moment, is to try to understand what is the situation with crypto just after booting.

Yes I installed LEAP 15.1 once more leaving my user data in /home and /backup partition as they were before. That means root partition has been formated once more. Ussually the SuSE installation script asks for a passphrase and manages everything else alone. Now for me it seems as if it has managed LUKS encription for one partition only, but the other is not quite left alone for a manual handling.

Those might be three independent messages (not related to one another).

I used to regularly see the “KVM disabled” message, until I enabled it in BIOS settings – I think BIOS setting showed it as CPU features. I often see a “request region for resource” message, and I ignore it. I think it’s is a debug message for kernel maintainers.

Now I have

# ls -l /dev/mapper
together 0
crw------- 1 root root 10, 236 06-05 00:29 control
lrwxrwxrwx 1 root root       7 06-05 00:32 cr-auto-2 -> ../dm-1
lrwxrwxrwx 1 root root       7 06-05 16:28 myhome -> ../dm-0

myhome has been put my myself with

# cryptsetup luksOpen $p3 myhome

Immediately after booting there is no third entry in /dev/mapper dir.

Well, something has changed. I booted only in the text mode. There was only one question for a passhprase for /backup and now i have

ls -l /dev/mapper
razem 0
crw------- 1 root root 10, 236 06-05 17:20 control
lrwxrwxrwx 1 root root       7 06-05 17:20 cr-auto-2 -> ../dm-0
lrwxrwxrwx 1 root root       7 06-05 17:20 cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3 -> ../dm-1

What to do now ? I ussually tried to mount /home with yast->partitioner

And there is only root and backup mounted


...
/dev/nvme0n1p2 on /root type btrfs (rw,relatime,ssd,space_cache,subvolid=265,subvol=/@/root)
/dev/nvme0n1p2 on /opt type btrfs (rw,relatime,ssd,space_cache,subvolid=266,subvol=/@/opt)
/dev/mapper/cr-auto-2 on /backup type ext4 (rw,relatime,data=ordered)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=3276596k,mode=700,uid=1000,gid=100)
...

no /dev/nvme0n1p3 entry !

Excellent. That’s what I was looking for.

When at that stage, I would like to see the output from “blkid”. You could use:


blkid /dev/mapper/cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3
 ## or
blkid /dev/dm-1

I’m looking for the UUID, so that we can use that to add an entry to “/etc/fstab” to mount it.

Now trying to mount home shows

# mount /dev/dm-1 /h
mount: /h: wrong file system, wrong option, wrong superblok on /dev/mapper/cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3, lack of code page or a help program or another error
# blkid /dev/mapper/cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3
# blkid /dev/dm-1
#
# blkid /dev/dm-0
/dev/dm-0: LABEL="sda4" UUID="e1eaea48-6d26-4e58-be46-f7c54fb4f675" TYPE="ext4"

lsblk -o name,mountpoint,size,type,ro,label,uuid
NAME     MOUNTPOINT   SIZE TYPE  RO LABEL                        UUID
sda                 931,5G disk   0                              
├─sda1              125,5M part   0 sda1                         280b1f40-6248-490c-96da-5c0d03ea9b6d
├─sda2   [SWAP]         9G part   0                              d6b3fb02-7189-4e56-bd3f-da4c1171b363
├─sda3                 20G part   0 sda3                         bc77b587-5f1f-4131-a268-83081b8d6ce3
└─sda4              902,4G part   0                              833bfaa4-bb3c-454c-b5ad-34955e4b2d91
  └─cr-auto-2
         /backup    902,4G crypt  0 sda4                         e1eaea48-6d26-4e58-be46-f7c54fb4f675
sdb                  59,6G disk   0 openSUSE-Leap-15.1-DVD-x86_64470
│                                                                2019-05-15-02-27-46-05
├─sdb1                3,8M part   0                              5939-BB66
└─sdb2                3,8G part   0 openSUSE-Leap-15.1-DVD-x86_64470
                                                                 2019-05-15-02-27-40-83
nvme0n1               1,8T disk   0                              
├─nvme0n1p1
│        /boot/efi    500M part   0 boot-efi                     C9B2-DCAF
├─nvme0n1p2
│        /             20G part   0 root                         6258ce31-70ee-4453-8af6-7ded4638e769
└─nvme0n1p3
                      1,8T part   0                              dc3763d9-fce5-4537-81a6-967e83a93e82
  └─cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3
                      1,8T crypt  0                              
#

that means UUID your are looking for is dc3763d9-fce5-4537-81a6-967e83a93e82 . Should I append the line


UUID=dc3763d9-fce5-4537-81a6-967e83a93e82  /h  ext4   defaults   0  0

to /etc/fstab now ?

Not better:

 cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3   /h   ext4   data=ordered   0  2

?

That’s troubling. Perhaps the file system is messed up.

UUID=dc3763d9-fce5-4537-81a6-967e83a93e82  /h  ext4   defaults   0  0

Yes, try that. Bot change that last “0” to “2”. Otherwise there won’t be an “fsck” run on that file system.

Maybe change that “defaults” to “nofail” so that errors won’t prevent booting. Then let’s see what happens.

In /var/log/messages:

kernel:     4.516387] EXT4-fs (nvme0n1p3): VFS: Can't find ext4 filesystem

:frowning:
Nearly each filesystem can be repaired. I assume /dev/dm-1 is now a raw partition without any LUKS and the task is to repair it as a filesystem, am I right ?

# lsblk -o name,mountpoint,size,type,ro,label,uuid
...
nvme0n1               1,8T disk   0                              
...
└─nvme0n1p3
                      1,8T part   0                              dc3763d9-fce5-4537-81a6-967e83a93e82
  └─cr_nvme-Samsung_SSD_970_EVO_2TB_S464NB0M401155J-part3
                      1,8T crypt  0