Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fstab cant mount my encrypted /home partition
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
picarica
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2018
Posts: 139

PostPosted: Sat Nov 02, 2019 1:19 pm    Post subject: fstab cant mount my encrypted /home partition Reply with quote

ill try to put as much information i can here but here is whole sotry discusser

here is the video i'll be mentioning throughout this post

so the problem is that fstabk cannot moun /dev/mapper/vg0-home it saus that its possibly non existent, even tho it's opened with dmcrypt before
after this failes i have to CTRL+ALT+F2 sign in as root and write
Code:
mount /dev/mapper/vg0-home /home
which somehow exists now :/
i tried labeing it as 'home' in dmcrypt but still i have vg0-home in mapper,

i cannot mount 'home' in ampper because i get wrong fs error

here is my fstab
here is my dmcrypt config, you see it labeled as 'home'
here is my lvm config but i dont things its used :/
here is my blkid you see home mounted as LVM2 memebr? which i dont know what is and vg0-home as ext4 which is correct
here is df -h command, 'home' isnt even listed here
here is my fdisk -l also dev/sda/3 is the /home encrypted partition
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43972
Location: 56N 3W

PostPosted: Sat Nov 02, 2019 2:51 pm    Post subject: Reply with quote

picarica,

I think its a timing issue. Here is a test. Its not a fix, even if it appears to be.

Make a new file is /etc/local.d/ call it mnt_home.start
Inside that file put
Code:
#!/bin/bash/
mount /dev/mapper/vg0-home /home


Once it exists. chmod +x it as it will be run as root.

localmount which reads /etc/fstab runs quite early is the boot process. Mounting home will still fail here.
local is the last process started before login, after everything else starts, so if its a timing thing, it should work here.

lvm2 is involved as device mapper provides the 'container' for your encrypted volume.
You donate one or more block devices to a LVM volume group. Then you create Logical Volumes inside that volume group.
Your volume group is called vg0 and the logical volume inside it is called home. Hence vg0-home.

Try the commands pvdisplay and lvdisplay.

If your logical volumes are not available before localmount is run, then fstab cannot mount any logical volumes.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14270

PostPosted: Sat Nov 02, 2019 4:26 pm    Post subject: Reply with quote

Please don't use videos or Firefox Send for error messages. It expires too quickly, and requires Javascript. Instead, post inline or pastebin text of the relevant errors, so that they are searchable and quotable.

From init scripts here:
  • /etc/init.d/dmcrypt:
    depend() {
            before checkfs fsck
  • /etc/init.d/localmount:
    depend()
    {
            need fsck
As I read this, dmcrypt must be before fsck. localmount must be after fsck, since localmount needs fsck. Thus, dmcrypt must run before localmount, so the device must be ready.

Since you have LVM inside LUKS, you need to run LVM discovery after the LUKS unlock and before mount. This bold qualifier is likely what is missing for you. Change the dependency relations so that openrc starts components in the right sequence.
Back to top
View user's profile Send private message
picarica
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2018
Posts: 139

PostPosted: Sun Nov 03, 2019 7:02 pm    Post subject: Reply with quote

NeddySeagoon wrote:
picarica,

I think its a timing issue. Here is a test. Its not a fix, even if it appears to be.

Make a new file is /etc/local.d/ call it mnt_home.start
Inside that file put
Code:
#!/bin/bash/
mount /dev/mapper/vg0-home /home


Once it exists. chmod +x it as it will be run as root.

localmount which reads /etc/fstab runs quite early is the boot process. Mounting home will still fail here.
local is the last process started before login, after everything else starts, so if its a timing thing, it should work here.

lvm2 is involved as device mapper provides the 'container' for your encrypted volume.
You donate one or more block devices to a LVM volume group. Then you create Logical Volumes inside that volume group.
Your volume group is called vg0 and the logical volume inside it is called home. Hence vg0-home.

Try the commands pvdisplay and lvdisplay.

If your logical volumes are not available before localmount is run, then fstab cannot mount any logical volumes.


i found out very intresting things
Code:

doas lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg0/home
  LV Name                home
  VG Name                vg0
  LV UUID                nMgTrk-Pn12-ldjH-Zajs-Kzfg-ExTG-rqG5K5
  LV Write Access        read/write
  LV Creation host, time xubuntu, 2019-10-15 18:49:11 +0200
  LV Status              available
  # open                 1
  LV Size                457.79 GiB
  Current LE             117195
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1

if my real home is /dev/vg0/home should i mount this ?

also my VG is correct as vg0
Code:

doas vgdisplay
  --- Volume group ---
  VG Name               vg0
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               457.79 GiB
  PE Size               4.00 MiB
  Total PE              117195
  Alloc PE / Size       117195 / 457.79 GiB
  Free  PE / Size       0 / 0
  VG UUID               nlTc0k-J0Rf-IIgo-KUbz-i3iV-UAXO-hJztgI



what does this means ?
Back to top
View user's profile Send private message
picarica
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2018
Posts: 139

PostPosted: Sun Nov 03, 2019 7:03 pm    Post subject: Reply with quote

Hu wrote:
Please don't use videos or Firefox Send for error messages. It expires too quickly, and requires Javascript. Instead, post inline or pastebin text of the relevant errors, so that they are searchable and quotable.

From init scripts here:
  • /etc/init.d/dmcrypt:
    depend() {
            before checkfs fsck
  • /etc/init.d/localmount:
    depend()
    {
            need fsck
As I read this, dmcrypt must be before fsck. localmount must be after fsck, since localmount needs fsck. Thus, dmcrypt must run before localmount, so the device must be ready.

Since you have LVM inside LUKS, you need to run LVM discovery after the LUKS unlock and before mount. This bold qualifier is likely what is missing for you. Change the dependency relations so that openrc starts components in the right sequence.


not sure if wrong i edited localmount and put in need dmcrypt, but it still failed to mount :/
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43972
Location: 56N 3W

PostPosted: Sun Nov 03, 2019 7:38 pm    Post subject: Reply with quote

picarica,

Did you try my test?
What does
Code:
rc-update show -v
output?

I suspect that your install uses LVM as a container for your LUKS volume.
That means the LUKS volume is not any physical block device as it will only appear once the physical block device is unlocked.

Its not quite that straight forward as LUKS inside LVM works as does LVM inside LUKS.
We don't know which you have. The ordering of the layers matters, since they must be started in the right order.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
picarica
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2018
Posts: 139

PostPosted: Sun Nov 03, 2019 7:54 pm    Post subject: Reply with quote

yall will mind if i upload my whole /etc ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43972
Location: 56N 3W

PostPosted: Sun Nov 03, 2019 8:00 pm    Post subject: Reply with quote

picarica,

Not with 7z and not with Firefox send.
Most of it is not useful ether.

Answer the questions and post the things we ask for on a pastebin site if they are too big for a post.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
picarica
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2018
Posts: 139

PostPosted: Sun Nov 03, 2019 8:18 pm    Post subject: Reply with quote

NeddySeagoon wrote:
picarica,

Did you try my test?
What does
Code:
rc-update show -v
output?

I suspect that your install uses LVM as a container for your LUKS volume.
That means the LUKS volume is not any physical block device as it will only appear once the physical block device is unlocked.

Its not quite that straight forward as LUKS inside LVM works as does LVM inside LUKS.
We don't know which you have. The ordering of the layers matters, since they must be started in the right order.


well i did put the file where u said and chmodded it, rebooted and i have this as rc-update show -v
seems pretty normal to me, and how can i show how i have those layers ordered?

now i notcied too that i have lvm in boot runlevel and default, could that be making any problems ?


what's next?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43972
Location: 56N 3W

PostPosted: Sun Nov 03, 2019 10:53 pm    Post subject: Reply with quote

picarica,

You have
Code:
localmount | boot
Good thats normal and you have
Code:
lvm | boot default
only boot matters and
Code:
dmcrypt | boot
looks good too.
I was also expecting to see device-mapper in the boot runlevel but it may be started by one of the other things.

Did my test appear to fix /home mounting?
It does the same thing as you logging in and running the command by hard.

I don't know how to determine the layer order except by trial and error and you can only do that once it works.
Then you can start all the layers one at a time. There are only two orders to try.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
picarica
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2018
Posts: 139

PostPosted: Mon Nov 04, 2019 10:24 am    Post subject: Reply with quote

NeddySeagoon wrote:
picarica,

You have
Code:
localmount | boot
Good thats normal and you have
Code:
lvm | boot default
only boot matters and
Code:
dmcrypt | boot
looks good too.
I was also expecting to see device-mapper in the boot runlevel but it may be started by one of the other things.

Did my test appear to fix /home mounting?
It does the same thing as you logging in and running the command by hard.

I don't know how to determine the layer order except by trial and error and you can only do that once it works.
Then you can start all the layers one at a time. There are only two orders to try.


and your test doesnt do anything for me, i still have to manually mount it like before :/

also what exacly do you mean by changing orders ? like editing files in init.d and changin need dependencies ?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7193

PostPosted: Mon Nov 04, 2019 2:26 pm    Post subject: Reply with quote

picarica wrote:
also what exacly do you mean by changing orders ? like editing files in init.d and changin need dependencies ?

No, this will vanish as soon as the init.d is update

To do that, create a /etc/conf.d/nameofservice or update the file and add needed stuff you wish modify within it
ie:
Code:
cat /etc/conf.d/lvm
rc_need="udev"
rc_after="dmcrypt"
...
Back to top
View user's profile Send private message
picarica
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2018
Posts: 139

PostPosted: Fri Nov 08, 2019 1:48 pm    Post subject: Reply with quote

fixed it by adding
Code:

mount /dev/mapper/vg0-home /home



in /etc/local.d/mnt_home.start
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43972
Location: 56N 3W

PostPosted: Fri Nov 08, 2019 7:15 pm    Post subject: Reply with quote

picarica,

That's a hack, not a fix. :)
The real fix is to address the service start up order.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
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