Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LVM Install - Trying to understand it to document it
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
Box293
n00b
n00b


Joined: 12 May 2017
Posts: 9

PostPosted: Sun Oct 22, 2017 9:52 am    Post subject: LVM Install - Trying to understand it to document it Reply with quote

I've a bit of a novice at Gentoo and after playing around with the handbook a few times I've wanted to get LVM added to the documentation.

I've almost got all the steps but I'm getting stuck, for some reason I need to do this twice:
Code:
genkernel --lvm --install initramfs


I need to re-do it before I do this step:
Code:
emerge --ask --verbose sys-boot/grub:2


If I don't then:
Code:
grub-install /dev/sda

and
Code:
grub-mkconfig -o /boot/grub/grub.cfg

don't work, grub-mkconfig doesn't detect the linux image.

If I do the genkernel command the second time then everything works and it detect the linux image and gub boots successfully.

I've done a lot of test with VM's and snapshots, rolling back trying to pinpoint what is going on.

Here is the steps I've documented:

Code:

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Media
passwd

service sshd start

Now SSH to the VM

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Networking

ping -c 3 www.gentoo.org

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks

parted -a optimal /dev/sda
mklabel gpt
mkpart primary 1 3
name 1 grub
set 1 bios_grub on
mkpart primary 3 131
name 2 boot
set 2 boot on
mkpart primary 131 -1
name 3 lvm01
set 3 lvm on
print

Model: VMware Virtual disk (scsi)
Disk /dev/sda: 17.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name   Flags
 1      1049kB  3146kB  2097kB               grub   bios_grub
 2      3146kB  131MB   128MB                boot   boot, esp
 3      131MB   17.2GB  17.0GB               lvm01  lvm

pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created.

vgcreate vg01 /dev/sda3
  Volume group "vg01" successfully created

lvcreate -L 512M -n swap vg01
  Logical volume "swap" created.

lvcreate -l 100%VG -n rootfs vg01
  Logical volume "rootfs" created.

mkfs.ext2 /dev/sda2

mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 124928 1k blocks and 31232 inodes
Filesystem UUID: 0014a5f5-3292-4aaf-8b2f-56265c532bae
Superblock backups stored on blocks:
   8193, 24577, 40961, 57345, 73729

Allocating group tables: done                           
Writing inode tables: done                           
Writing superblocks and filesystem accounting information: done


mkfs.ext4 /dev/vg01/rootfs

mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 4030464 4k blocks and 1007616 inodes
Filesystem UUID: a22d5428-fd8a-46a1-b204-9e4232b99335
Superblock backups stored on blocks:
   32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done                           
Writing inode tables: done                           
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

mkswap /dev/vg01/swap

Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=65b0efcb-be33-4295-bcb9-2b359cfa6d86

swapon /dev/vg01/swap

mount /dev/vg01/rootfs /mnt/gentoo


https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage

cd /mnt/gentoo

wget http://mirror.internode.on.net/pub/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20171012.tar.bz2

tar xvjpf stage3-*.tar.bz2 --xattrs --numeric-owner


https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base

mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf

mkdir /mnt/gentoo/etc/portage/repos.conf

cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf

cp -L /etc/resolv.conf /mnt/gentoo/etc/

mount -t proc /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
source /etc/profile
export PS1="(chroot) $PS1"

mkdir /boot
mount /dev/sda2 /boot

emerge-webrsync

##### I'm not changing the profile so the default is OK
#####eselect profile list

emerge --ask --update --deep --newuse @world

echo "Australia/Victoria" > /etc/timezone

emerge --config sys-libs/timezone-data

nano -w /etc/locale.gen

locale-gen

eselect locale list

eselect locale set 5

env-update && source /etc/profile && export PS1="(chroot) $PS1"


https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel

emerge --ask sys-kernel/gentoo-sources

cd /usr/src/linux

make menuconfig

Processor type and features > Linux Guest Support
Device Drivers > Misc devices > VMware VMCI Driver
Device Drivers > Misc devices > VMware Balloon Driver
Device Drivers > SCSI device support > SCSI low-level drivers > VMware PVSCSI driver support
Device Drivers > Fusion MPT device support > Fusion MPT ScsiHost drivers for SPI
Networking support > Networking options > Virtual Socket protocol

make && make modules_install

make install

emerge --ask sys-kernel/genkernel

emerge --ask sys-fs/lvm2

genkernel --lvm --install initramfs


https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/System

nano -w /etc/fstab

/dev/sda2          /boot        ext2    defaults,noatime     0 2
/dev/vg01/swap     none         swap    sw                   0 0
/dev/vg01/rootfs   /            ext4    noatime              0 1
 
/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0


nano -w /etc/conf.d/hostname

nano -w /etc/conf.d/net

dns_domain_lo="test.local"

emerge --ask --noreplace net-misc/netifrc

nano -w /etc/conf.d/net

config_eno16777728="dhcp"


cd /etc/init.d

ln -s net.lo net.eno16777728

rc-update add net.eno16777728 default

passwd



https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Tools

emerge --ask app-admin/sysklogd

emerge --ask sys-process/cronie

rc-update add cronie default

rc-update add sshd default

emerge --ask net-misc/dhcpcd


https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader

# This is the second time I've run this
genkernel --lvm --install initramfs


nano -w /etc/portage/package.use/package.use

sys-boot/grub:2 device-mapper


emerge --ask --verbose sys-boot/grub:2


nano -w /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="dolvm"


grub-install /dev/sda

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



Generating grub configuration file ...
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
Found linux image: /boot/vmlinuz-4.12.12-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.12.12-gentoo
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
done

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



If I don't run "genkernel --lvm --install initramfs" the second time then "grub-install /dev/sda" outputs this:
Code:
Installing for i386-pc platform.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
Installation finished. No error reported.


Here is what is reported by "grub-mkconfig -o /boot/grub/grub.cfg" if I don't run "genkernel --lvm --install initramfs" the second time:
Code:
Generating grub configuration file ...
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
done



When I run "genkernel --lvm --install initramfs" the second time then "grub-install /dev/sda" outputs this:
Code:
Installing for i386-pc platform.
Installation finished. No error reported.


And the linux image is found when running "grub-mkconfig -o /boot/grub/grub.cfg":[/code]
Code:
Generating grub configuration file ...
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
Found linux image: /boot/vmlinuz-4.12.12-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.12.12-gentoo
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
done
Back to top
View user's profile Send private message
nokilli
Apprentice
Apprentice


Joined: 25 Feb 2004
Posts: 195

PostPosted: Sun Oct 22, 2017 11:10 am    Post subject: Reply with quote

I'm just going to throw out a couple of things that stand out, not really knowing whether this is the source of your problem.

It's an amd64 system, so you probably want...
Code:
GRUB_PLATFORMS="efi-64"

... in your make.conf.

I think you need a link to your efi partition from boot so that grub-install finds it, or otherwise point grub-install to it via the command line. I also think you need to format it vfat. Either genkernel or grub-install may do this for you automatically but the order is somehow important which may explain why you need to run genkernel twice.
_________________
Today is the first day of the rest of your Gentoo installation.
Back to top
View user's profile Send private message
Box293
n00b
n00b


Joined: 12 May 2017
Posts: 9

PostPosted: Sun Oct 22, 2017 10:20 pm    Post subject: Reply with quote

Great, thanks for the ideas, I'll give them a try and report back.
Back to top
View user's profile Send private message
Box293
n00b
n00b


Joined: 12 May 2017
Posts: 9

PostPosted: Mon Oct 23, 2017 10:10 am    Post subject: Reply with quote

OK I worked it out and it was something simple I overlooked.

As I was working through each stage of the handbook I would shutdown the VM and taking a snapshot.

I completed the Kernel stage, shut it down and took a snapshot. When I powered it back on I used the following commands before continuing:
Code:
vgchange -ay vg01
swapon /dev/vg01/swap
mount /dev/vg01/rootfs /mnt/gentoo
mount -t proc /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
source /etc/profile
export PS1="(chroot) $PS1"


I had completely missed this command:
Code:
mount /dev/sda2 /boot


Obviously that is why I needed to run "genkernel" the second time when I was on the "Configuring the bootloader" stage, because nothing existed in /boot.

I certainly learnt a lot, now I can work on getting the specific LVM steps added to the handbook / LVM guides.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2614

PostPosted: Mon Oct 23, 2017 10:23 am    Post subject: Reply with quote

Box293 wrote:
Obviously that is why I needed to run "genkernel" the second time when I was on the "Configuring the bootloader" stage, because nothing existed in /boot.

I certainly learnt a lot, now I can work on getting the specific LVM steps added to the handbook / LVM guides.

For solution using custom initramfs instead of genkernel and EFI stub kernel instead of grub see topic 1068042
Back to top
View user's profile Send private message
Box293
n00b
n00b


Joined: 12 May 2017
Posts: 9

PostPosted: Mon Oct 23, 2017 12:09 pm    Post subject: Reply with quote

I added all the required steps to the LVM guide:

https://wiki.gentoo.org/wiki/LVM#Handbook

Hopefully this will save others time when wanting to install Gentoo using LVM.

Some of the formatting in the guide needs to be fixed, I tried to duplicate as much as possible looking at other guides but some things I couldn't figure out.


Thanks charles17 for your input as well.
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