You are not logged in.
What I am trying to do:
Boot Arch Linux where the boot and root partition are within an LVM.
Platform:
I have tried this on 3 different platforms. 2 Laptop and 1 VM. No dual boot scenario and no UEFI.
What happens:
I get the following error:
ERROR: device 'UUID=<snip>' not found. Skipping fsck.
ERROR: Unable to find root device 'UUID=<snip>'.
You are being dropped to a recovery shell
Type 'exit' to try and continue booting
sh: can't access tty: job control turned off
Note: I have been trying to get this working for weeks now. I am reading the Wikis, searching Google and consulted my friends with the same love of learning Linux.
Here is the list of commands that I used to replicate this issue:
I suspect I am missing a concept. Hence I must have skipped step or have done one incorrectly.
# lsblk
# modprobe -a dm_mod
# fdisk /dev/sda
-- Creating MBR
Command (m for help) o
-- Creating LVM Partition
Command (m for help) n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): default
Partition number (1-128, default 1): default
First sector (34-234441614, default = 2048) or {+-}size{KMGTP}: default
Last sector (2048-234441614, default = 234441614) or {+-}size{KMGTP}: default
Current type is 'Linux'
Command (m for help) t
Hex code for LVM: 8e
Command (m for help) w
-- Setup LVM
# pvdisplay
# pvcreate /dev/sda1
# pvdisplay
# vgcreate vol00 /dev/sda1
# vgdisplay
# lvcreate -L 500MB vol00 -n lvol_boot
# lvcreate -C y -L 4GB vol00 -n lvol_swap
# lvcreate -l +100%FREE vol00 -n lvol_root
# vgscan
# vgchange -ay
-- Format the LVM logical volumes
# mkfs.ext4 /dev/mapper/vol00-lvol_root
# mkfs.ext4 /dev/mapper/vol00-lvol_boot
# mkswap /dev/mapper/vol00-lvol_swap
-- Mount File Systems
# mount /dev/mapper/vol00-lvol_root /mnt
# mkdir /mnt/boot
# mount /dev/mapper/vol00-lvol_boot /mnt/boot
# swapon /dev/mapper/vol00-lvol_swap
-- Refresh packages
# pacman -Syy
-- Install base system
# pacstrap -i /mnt base base-devel
-- Generate and verity fstab
# genfstab -U -p /mnt >> /mnt/etc/fstab
# vi /mnt/etc/fstab
# arch-chroot /mnt /bin/bash
# vi /etc/locale.gen
-- Uncomment en_US.UTF-8 UTF-8
# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8
-- Time zone (City replace with my timezone city)
# ln -s /usr/share/zoneinfo/America/City /etc/localtime
-- Hardware clock
# hwclock --systohc --utc
-- Hostname
# echo myhostname > /etc/hostname
# vi /etc/hosts
-- Change the following with your chosen hostname
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost myhostname
::1 localhost.localdomain localhost
-- Configure the network
Find the name of the network adapter
# ip link
-- Above ip link gave interface name is enp9s0
# systemctl enable dhcpcd@enp9s0.service
# vi /etc/mkinitcpio.conf
-- add lvm2 between block and filesystems
HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"
# vi /etc/lvm/lvm.conf
-- change use_lvmetad = 1 to use_lvmetad = 0
# cd /boot
# mkinitcpio -p linux
-- Create users and set passwords
-- if root password has not been set do so now.
# passwd
-- Install GRUB2 and a few other packages
-- Install packages
# pacman -S fuse grub lvm2 os-prober
-- Install the bootloader
# grub-install --target=i386-pc --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
# exit
# reboot
Last edited by zubalea (2015-06-14 23:45:58)
Offline
Did you check your /etc/default/grub. Maybe you need to add a line indicating the root there.
From https://wiki.archlinux.org/index.php/LVM
"If the root file system resides in a logical volume, the root= kernel parameter must be pointed to the mapped device, e.g /dev/mapper/vg-name-lv-name."
Last edited by kkat (2015-06-11 16:58:51)
Offline
I had tried that before and tried it again. No luck.
I decided to simply things a lot. Just trying to boot directly from Grub interface and not dealing with any missing configs.
At the boot screen I press c to go in Grub command line interface
grub> ls
(hd0) (hd0,msdos1) (lvm/vol00-lvol_root)
grub> ls (lvm/vol00-lvol_root)/
-- Result: I see all the folders such as /usr /boot /root etc
-- So I know I am talking to the partition
grub> linux /boot/vmlinuz-linux root=/dev/mapper/vol00-lvol_root
-- I am not 100% confident in the root part of this command. Documentation seems to indicate that is how to set it up.
grub> initrd /boot/initrd-linux.img
grub> boot
Results from boot console:
early console in decrompress_kernel
Decompressing Linux... Parsing ELF... Done.
Booting the kernel.
:: running early hook [udev]
starting version 219
:: running early hook [lvm2]
:: running hook [udev]
:: Triggering uevents....
Waiting 10 seconds for device /dev/mapper/vol00-lvol_root ...
ERROR: device '/dev/mapper/vol00-lvol_root' not found. Skipping fsck.
ERROR: unable to find root devce '/dev/mapper/vol00-lvol_root'.
You are being dropped to a recovery shell
Offline
Not sure if it is needed anymore - but I usually add dm_mod to MODULES in mkinitcpio.conf and recreate initrams.
MODULES="dm_mod"
Offline
Thank you @TheSgtBilko and @kkat. I tried you suggestions. Still not working.
Last edited by zubalea (2015-06-12 19:37:03)
Offline
Grub should have picked an UUID for the root= when you let it generate the grub.cfg. Did it not or did you change that?
From within recovery you should be able to boot following:
# vgscan
# vgchange -ay
# exit
If that works, let grub re-generate its config (grub-mkconfig -o /boot/grub/grub.cfg).
Offline
For me the idea of the booting schema described in the first post is purely educational. They are so many other ways to implement a successful boot with Arch but I wanted to get this one working strictly using LVM
I finally found the issue.
Everything works when I don't update /etc/lvm/lvm.conf and leave "use lvmetab" parameter as the default "use_lvmetab = 1"
I will mark this thread as solved when I or someone else can explain why this parameter made a difference. Because when "use_lvmetab" is set to 1 there is a bunch of warnings during the grub building process. Putting "lvmetab = 0" removes those errors.
I suspect "lvmetab=1" loads something that my script requires to boot properly. I suspect there is another way to load what is required, but I don't have that knowledge yet.
Hoping someone with a more knowledgeable soul can enlighten me on this one.
Thank you
Offline
After more testing I have found the exact steps that caused my issue:
Before code change: where I get "Unable to find root device" on boot.
# vi /etc/mkinitcpio.conf
-- add lvm2 between block and filesystems
HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"
# vi /etc/lvm/lvm.conf
-- change use_lvmetad = 1 to use_lvmetad = 0
# cd /boot
# mkinitcpio -p linux
After code change: where it boots with no issues.
# vi /etc/mkinitcpio.conf
-- add lvm2 between block and filesystems
HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"
# cd /boot
# mkinitcpio -p linux
# vi /etc/lvm/lvm.conf
-- change use_lvmetad = 1 to use_lvmetad = 0
Notice in the after code change I built the initial ramdisk environment before I disabled use_lvmetad.
I suspect the initial ramdisk environment requires lvmetab enabled to see the LVM drives on boot up. Disabling lvmetad in the lvm.conf after the inital ramdisk environment removes the errors when building the grub.cfg.
I will make this thread as solved now. However, if someone with more in-depth knowledge read this, please feel free to add your expert opinions.
Thank you
Hope this helps someone else.
Offline