Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Error with encrypted setup.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 248
Location: Toronto, Canada

PostPosted: Wed Jun 17, 2020 1:47 am    Post subject: Error with encrypted setup. Reply with quote

I get the following error right after installing Gentoo: https://ibb.co/sV0ghBC

here is how Iencrypted it:

Code:
cryptsetup luksFormat /dev/sda2
cryptsetup luksOpen --allow-discards /dev/sda2 hive
mkfs.ext4 /dev/mapper/hive


Here is my /etc/fstab:

Code:
/dev/sda1                     /boot       vfat    defaults,noatime 0 2
/dev/mapper/hive                    /               ext4    noatime              0 1




Here is my /etc/default/grub:

Code:
GRUB_CMDLINE_LINUX="crypt_root=/dev/sda2 root=/dev/mapper/hive"
GRUB_CMDLINE_LINUX_DEFAULT=”root_trim=yes”


Should I Use UUIDs ?
Back to top
View user's profile Send private message
mslt
n00b
n00b


Joined: 24 Oct 2017
Posts: 8
Location: Germany

PostPosted: Wed Jun 17, 2020 9:33 am    Post subject: Reply with quote

I do not use an encrypted setup at the moment, so this could be wrong...
But as far as I remember /etc/default/grub should look something like this.

Code:

...
GRUB_CMDLINE_LINUX="crypt_root=/dev/sda2 rootfstype=ext4 real_root=/dev/mapper/hive"
...

_________________
Thinkpad T480
Core i5-8250U
16GB RAM
i3wm, zsh, nvim, spaces > tabs
gentoo - Obviously
Back to top
View user's profile Send private message
coderanger
Apprentice
Apprentice


Joined: 19 Sep 2018
Posts: 150

PostPosted: Wed Jun 17, 2020 10:20 am    Post subject: Reply with quote

Enter the shell and check what is inside /dev/mapper. It it possible that the disk was mapped to different name.
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 248
Location: Toronto, Canada

PostPosted: Wed Jun 17, 2020 1:20 pm    Post subject: Reply with quote

coderanger wrote:
Enter the shell and check what is inside /dev/mapper. It it possible that the disk was mapped to different name.


I don't quite get what you mean...

I do:

Code:
cryptsetup luksOpen --allow-discards /dev/sda2 hive
mount /dev/mapper/hive /mnt/gentoo


and the rootfs files are in there...
Back to top
View user's profile Send private message
coderanger
Apprentice
Apprentice


Joined: 19 Sep 2018
Posts: 150

PostPosted: Wed Jun 17, 2020 1:26 pm    Post subject: Reply with quote

On the screenshot, type "shell" for a shell
then
Code:
ls -al /dev/mapper
Back to top
View user's profile Send private message
pietinger
Guru
Guru


Joined: 17 Oct 2006
Posts: 350
Location: Bavaria

PostPosted: Wed Jun 17, 2020 4:57 pm    Post subject: Reply with quote

LegionOfHell wrote:
I do:
Code:
cryptsetup luksOpen --allow-discards /dev/sda2 hive
mount /dev/mapper/hive /mnt/gentoo
and the rootfs files are in there...

You do: Please "open" it with my invented name "hive" and then you mount it with this name. But this name isnt store anywhere ...
LegionOfHell wrote:
I don't quite get what you mean...

It means, some scripts dont "open" it with "hive", it is "/dev/mapper... " (and this is also only a link to the real /dev/dm-0 or /dev/dm-1)
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 248
Location: Toronto, Canada

PostPosted: Wed Jun 17, 2020 5:34 pm    Post subject: Reply with quote

ok I messed things up badly...now when I turn my laptop on it doesn't find any bootable device...here is what I did:

Code:
cryptsetup luksOpen /dev/sda2 hive
mkdir /mnt/gentoo
mount /dev/mapper/hive /mnt/gentoo
cd /mnt/gentoo
mount -o bind /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"
mount /dev/sda1 /boot

genkernel --luks initramfs

nano -w /etc/default/grub
GRUB_CMDLINE_LINUX="crypt_root=/dev/sda2 rootfstype=ext4 real_root=/dev/mapper/hive"

grub-mkconfig -o /boot/grub/grub.cfg
------

exit
cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -R /mnt/gentoo
reboot or poweroff


I also get this error when grub-mkconfiging:

Code:
WARNING: Failed to connect to lvmetad.


Quote:
It means, some scripts dont "open" it with "hive", it is "/dev/mapper... " (and this is also only a link to the real /dev/dm-0 or /dev/dm-1)

so, this is the correct line? :

Code:
GRUB_CMDLINE_LINUX="crypt_root=/dev/sda2 rootfstype=ext4 real_root=/dev/mapper..."
Back to top
View user's profile Send private message
pietinger
Guru
Guru


Joined: 17 Oct 2006
Posts: 350
Location: Bavaria

PostPosted: Wed Jun 17, 2020 5:58 pm    Post subject: Reply with quote

LegionOfHell wrote:
Code:
GRUB_CMDLINE_LINUX="crypt_root=/dev/sda2 rootfstype=ext4 real_root=/dev/mapper..."

Oh, no. I wrote "..." as meaning the rest of the directory.
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 248
Location: Toronto, Canada

PostPosted: Wed Jun 17, 2020 8:35 pm    Post subject: Reply with quote

coderanger wrote:
On the screenshot, type "shell" for a shell
then
Code:
ls -al /dev/mapper


ok, here is what its showing:

https://ibb.co/G2nMBZk

so the line should be this:
GRUB_CMDLINE_LINUX="crypt_root=/dev/sda2 rootfstype=ext4 real_root=/dev/mapper/root"

can someone confirm ?
Back to top
View user's profile Send private message
coderanger
Apprentice
Apprentice


Joined: 19 Sep 2018
Posts: 150

PostPosted: Wed Jun 17, 2020 8:50 pm    Post subject: Reply with quote

LegionOfHell wrote:
so the line should be this:
GRUB_CMDLINE_LINUX="crypt_root=/dev/sda2 rootfstype=ext4 real_root=/dev/mapper/root"

can someone confirm ?


Yes, that should be enough.
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 248
Location: Toronto, Canada

PostPosted: Wed Jun 17, 2020 9:05 pm    Post subject: Reply with quote

ok, it works now...

I have another question:

when I do grub-mkconfig, I get the following warning:

Code:
WARNING: Failed to connect to lvmetad.


I am not using lvm but I created my initramfs with

Code:
genkernel --microcode --luks --lvm initramfs


how do i get rid of this warning ?
Back to top
View user's profile Send private message
coderanger
Apprentice
Apprentice


Joined: 19 Sep 2018
Posts: 150

PostPosted: Wed Jun 17, 2020 9:14 pm    Post subject: Reply with quote

LegionOfHell wrote:
when I do grub-mkconfig, I get the following warning:
Code:
WARNING: Failed to connect to lvmetad.

It's just a warning and can be ignored.
Or you can find the string in /etc/lvm/lvm.conf and set it to zero:
Code:
        use_lvmetad = 0

Also you can start lvmetad manually, but for system with a single disk the running lvmetad is redundant
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum