Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LUKS + LVM2 - /usr not mounting
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Wizumwalt
Guru
Guru


Joined: 20 Aug 2006
Posts: 547

PostPosted: Thu Aug 22, 2013 1:34 am    Post subject: LUKS + LVM2 - /usr not mounting Reply with quote

I'm doing an LVM2 + LUKS install and when I boot my system. Here is the error I'm seeing when I boot. Note that the root fs does mount.

Code:

>> Scanning for and activating Volume Groups
6 logical volume(s) in volume group "vg1" now active
Enter passphrase for /dev/vg1/root:
>> LUKS device /dev/vg1/root opened
>> Determining root device ...
>> Mounting /dev/mapper/root as root ...
>> Using mount -t ext4 -o ro
>> Mounting /dev/mapper/crypt-usr as /usr: mount -t ext4 -o noatime,ro /dev/mapper/crypt-usr /newroot/usr
mount: mounting /dev/mapper/crypt-user on /newroot/usr failed: No such file or directory
!! Unable to mount /dev/mapper/crypt-usr for /usr
>> Booting (initramfs)
INIT: version 2.88 booting


And here is the contents of /dev/vg1 ...
Code:

dev
  `- vg1
      |- home -> /dev/mapper/vg1-home
      |- opt -> /dev/mapper/vg1-opt
      |- root -> /dev/mapper/vg1-root
      |- tmp -> /dev/mapper/vg1-tmp
      |- usr -> /dev/mapper/vg1-usr
      `- var -> /dev/mapper/vg1-var

... and in /dev/mapper ...
Code:

dev
  `- mapper
      |- root
      |- vg1-home
      |- vg1-opt
      |- vg1-root
      |- vg1-tmp
      |- vg1-usr
      `- vg1-var


So I compare the above with the contents of the same directories after booting with a livecd (after mounting and chroot'ing over) ...
Code:

dev
  `- mapper
      |- crypt-home -> ../dm-7
      |- crypt-opt -> ../dm-10
      |- crypt-root -> ../dm-6
      |- crypt-tmp -> ../dm-11
      |- crypt-usr -> ../dm-8
      |- crypt-var -> ../dm-9
      |- vg1-home -> ../dm-1
      |- vg1-opt -> ../dm-4
      |- vg1-root -> ../dm-0
      |- vg1-tmp -> ../dm-5
      |- vg1-usr -> ../dm-2
      `- vg1-var -> ../dm-3


dir listing of /dev/vg1 also in livecd:
Code:

dev
  `- mapper
      |- vg1-home -> ../dm-1
      |- vg1-opt -> ../dm-4
      |- vg1-root -> ../dm-0
      |- vg1-tmp -> ../dm-5
      |- vg1-usr -> ../dm-2
      `- vg1-var -> ../dm-3


It would seem I'm missing the symbolic links in the /dev/mapper directory. And I'm wondering how those links ( --> ../dm-N) get created.
I do have the folling device files in /dev.
Code:

dev
  |- dm0
  |- dm1
  |- dm2
  |- dm3
  |- dm4
  |- dm5
  |- dm6
  |- ...


Here's /etc/fstab
Code:

/dev/sda1              /boot    ext2    noauto,noatime 1 2
/dev/sda2              none     swap    sw             0 0
/dev/mapper/crypt-root /        ext2    noauto,noatime 1 2
/dev/mapper/crypt-home /home    ext4    noatime       0 0
/dev/mapper/crypt-usr  /usr     ext4    noatime       0 1
/dev/mapper/crypt-var  /var     ext4    noatime       0 1
/dev/mapper/crypt-opt  /opt     ext4    noatime       0 1
/dev/mapper/crypt-tmp  /tmp     ext4    noatime       0 1


And /etc/conf.d/dmcrypt
Code:


swap=swap
source='/dev/sda2'

target=crypt-home
source='/dev/mapper/crypt-home'

target=crypt-usr
source='/dev/mapper/crypt-usr'

target=crypt-var
source='/dev/mapper/crypt-var'

target=crypt-opt
source='/dev/mapper/crypt-opt'

target=crypt-tmp
source='/dev/mapper/crypt-tmp'


Also, I'm using genkernels initramfs (3.8.13).

Any ideas much appreciated.
Back to top
View user's profile Send private message
grey_dot
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jul 2012
Posts: 142

PostPosted: Thu Aug 22, 2013 4:56 pm    Post subject: Reply with quote

I've had a similiar problem, although my system mounts /usr after exiting initrd. If your system doesnt run systemd, which requires /usr premounted, you could remove usrmount from initrd and mount it with fstab. Also try adding lvm to boot runlevel, since udev sometimes doesnt create symlinks for lvm nodes.

p.s. why did you create a separate luks container for each lvm volume? It's usually done the other way around - a single luks container with lvm inside. Just interested.
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Thu Aug 22, 2013 5:21 pm    Post subject: Reply with quote

Might be of little help, but why do you use genkernel?

I have a similar set up with a very simple initramfs and no problems:
Code:
#!/bin/busybox sh

rescue_shell () {
   echo "something went wrong... dropping you in a shell.."
   busybox --install -s
   exec /bin/sh
}

mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

# quiet kernel
echo 0 > /proc/sys/kernel/printk

# enter password
/sbin/cryptsetup -T 3 luksOpen /dev/sda1 cypher

# enable kernel messages
echo 1 > /proc/sys/kernel/printk

# activate lvm

/sbin/lvm.static vgscan --mknodes
/sbin/lvm.static vgchange -a y

mount -o ro /dev/mapper/vg-root /mnt/root || rescue_shell

# clean up
umount /proc
umount /sys
umount /dev

exec switch_root /mnt/root /sbin/init

_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
Wizumwalt
Guru
Guru


Joined: 20 Aug 2006
Posts: 547

PostPosted: Thu Aug 22, 2013 6:46 pm    Post subject: Reply with quote

grey_dot wrote:
I've had a similiar problem, although my system mounts /usr after exiting initrd. If your system doesnt run systemd, which requires /usr premounted, you could remove usrmount from initrd and mount it with fstab. Also try adding lvm to boot runlevel, since udev sometimes doesnt create symlinks for lvm nodes.

p.s. why did you create a separate luks container for each lvm volume? It's usually done the other way around - a single luks container with lvm inside. Just interested.


I'm not running systemd.I do have /usr in fstab, though its obviously not working. And I do have LVM in the boot runlevel.

About the container, not sure. Mainly because I was following some tutorials and didn't quite understand it for myself. I'll look at it.
Back to top
View user's profile Send private message
Wizumwalt
Guru
Guru


Joined: 20 Aug 2006
Posts: 547

PostPosted: Thu Aug 22, 2013 6:47 pm    Post subject: Reply with quote

LoTeK wrote:
Might be of little help, but why do you use genkernel?

I use genkernel just to have an initramfs built for me. Guess I'll try rolling my own and use something similar to yours.
Back to top
View user's profile Send private message
Wizumwalt
Guru
Guru


Joined: 20 Aug 2006
Posts: 547

PostPosted: Fri Aug 23, 2013 5:16 pm    Post subject: Reply with quote

Still can't see what I'm doing wrong. What I did was create a small partition for boot, a separate partition for swap and another for the physical LVM. Then I encrypted the volumes. Then I opened the containers and formatted with a filesystem.

# fdisk -l /dev/sda
Code:

/dev/sda1   *   2048   133119   65536      83   Linux
/dev/sda2     133120   2181119   1024000      82   Linux swap / Solaris
/dev/sda3    2181120 156301487   77060184   8e   Linux LVM


# vgscan
Code:

VG   #PV   #LV   #SN   Attr   VSize   VFree
vg1   1   6   0   wz--n--   73.49g   1.49g


# lvscan
Code:

ACTIVE      '/dev/vg1/root' [10.00 GiB] inherit
ACTIVE      '/dev/vg1/home' [20.00 GiB] inherit
ACTIVE      '/dev/vg1/usr'  [20.00 GiB] inherit
ACTIVE      '/dev/vg1/var'  [10.00 GiB] inherit
ACTIVE      '/dev/vg1/opt'  [10.00 GiB] inherit
ACTIVE      '/dev/vg1/tmp'  [2.00 GiB] inherit


And after mounting all this form a livecd and chroot'ing over, I ran genkernel to get an initramfs (vers 3.8.13-gentoo). I've compiled manually as well and used only the initramfs from genkernel as well. Either way, I hear this initramfs should work fine for this.

/boot/grub/grub.conf
Code:

title Gentoo Linux 3.8.13
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-3.8.13-gentoo root=/dev/ram0 crypt_root=/dev/vg1/root rootfstype=ext4 init=/linux dolvm
initrd /boot/initramfs-genkernel-x86_64-3.8.13-gentoo


But I think I still have something wrong with either my fstab or dmcrypt.

/etc/fstab
Code:

/dev/sda1      /boot    ext2    noauto,noatime 1 2
/dev/sda2      none     swap    sw             0 0
/dev/vg1/root   /        ext2    noauto,noatime 1 2
/dev/vg1/home   /home    ext4    noatime       0 0
/dev/vg1/usr   /usr     ext4    noatime       0 1
/dev/vg1/var   /var     ext4    noatime       0 1
/dev/vg1/opt   /opt     ext4    noatime       0 1
/dev/vg1/tmp   /tmp     ext4    noatime       0 1


/etc/conf.d/dmcrypt
Code:

swap=swap
source='/dev/sda2'

target=home
source='/dev/mapper/vg1-home'

target=usr
source='/dev/mapper/vg1-usr'

target=var
source='/dev/mapper/vg1-var'

target=opt
source='/dev/mapper/vg1-opt'

target=tmp
source='/dev/mapper/vg1-tmp'


And here is the boot error I keep getting.
Code:

>> Scanning for and activating Volume Groups
6 logical volume(s) in volume group "vg1" now active
Enter passphrase for /dev/vg1/root:
>> LUKS device /dev/vg1/root opened
>> Determining root device ...
>> Mounting /dev/mapper/root as root ...
>> Using mount -t ext4 -o ro
>> Mounting /dev/mapper/crypt-usr as /usr: mount -t ext4 -o noatime,ro /dev/mapper/crypt-usr /newroot/usr
mount: mounting /dev/mapper/crypt-user on /newroot/usr failed: No such file or directory
!! Unable to mount /dev/mapper/crypt-usr for /usr
>> Booting (initramfs)
INIT: version 2.88 booting
Back to top
View user's profile Send private message
piewie
Guru
Guru


Joined: 26 Sep 2002
Posts: 489
Location: old Europe

PostPosted: Fri Aug 23, 2013 8:50 pm    Post subject: Reply with quote

you could try to use the UUID to prevent / exclude a /dev/mapper/vg1-usr or /dev/vg1/usr lvm naming problem

/etc/fstab:
UUID=xxxxxxxx-0000-aaa-yyyy-1111111111 /usr ext4 noatime,user_xattr,rw 0 1
Back to top
View user's profile Send private message
Wizumwalt
Guru
Guru


Joined: 20 Aug 2006
Posts: 547

PostPosted: Tue Aug 27, 2013 8:11 pm    Post subject: Reply with quote

Let me ask this. Should the initramfs generated by genkernel, is it setup to handle volume groups and whatnot the way I have configured? It certainly doesn't seem to mount my /usr, but should it?
Back to top
View user's profile Send private message
piewie
Guru
Guru


Joined: 26 Sep 2002
Posts: 489
Location: old Europe

PostPosted: Wed Aug 28, 2013 10:01 pm    Post subject: Reply with quote

Normally
Code:
genkernel --lvm --oldconfig --luks --menuconfig all
should do the job. But from what I have read around here, is that it is probably not that trivial with a separated /usr. Perhaps some additional binaries are necessary for initramfs.
Quote:
>> Mounting /dev/mapper/crypt-usr as /usr: mount -t ext4 -o noatime,ro /dev/mapper/crypt-usr /newroot/usr
mount: mounting /dev/mapper/crypt-user on /newroot/usr failed: No such file or directory
!! Unable to mount /dev/mapper/crypt-usr for /usr
looks not consistent to me, because of crypt-usr and crypt-user.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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