[CentOS] Issues booting centos7 [dracut is failing to enable centos/root, centos/swap LVs]

Mon Jul 30 15:53:56 UTC 2018
Simon Matter <simon.matter at invoca.ch>


> Hello,
> I'm having a strange problem booting a new centos7 installation. Below
> some
> background on this. [I have attached the tech details at the bottom of
> this
> message]
> I started a new CentOS7 installation on a VM, so far all good, o/s boots
> fine. Then I decided to increase VM disk size (initially was 10G) to 13G.
> Powered off the VM, increased the vhd via the hypervisor, booted from
> CentOS livecd, selected "recover my centos installation". Then I used the
> following sequence of commands to make the new vhd size "visible" to the
> o/s ...
> - ran fdisk /dev/sda and deleted partition 2. (This is the LVM partition
> where the o/s is stored. The first partition is /boot [xfs] partition *non
> lvm*.)
> - created a new partition with same starting sector as before deleting it,
> but a different ending sector (to reflect to the increased space).
> - set partition type to 8e (lvm), saved settings and exit.

At this point I usually reboot and do the following steps while the system
is running. I don't say how you do it is wrong, it's just easier/faster to
do things while the system is online if downtime matters.

I don't really know what causes your issues. The reason may be that I have
more and more problems understanding the whole boot process and all the
variants we used to have over more than two decades...

But, what happens if you let the kernel post install scripts do the work
or setting up the initrd things? If you reinstall the latest kernel, does
it change anything?


> - ran pvresize and lvresize to make new space visible to the o/s.All good,
> I can see the space increase on 'lvdisplay centos/root'.
> - ran 'mount /dev/mapper/centos-root /mnt/root' to temporarily mount the
> o/s partition.
> - ran 'xfs_growfs /mnt/root' to resize the o/s fs to the new size. It was
> successful and I could actually chroot to the o/s and verify new disk
> size.
> - rebooted  and tried to boot from hdd this time. Grub menu shows up and
> loads default kernel (3.10.0-862.9.1.el7.x86_64).
> - after initial kernel boot up process, booting continues to initrd and
> then it's where the problem starts...
> - looks like dracut has issues locating/enabling /dev/mapper/centos-root
> (lv) and as a result it cannot boot to the 'real' root fs (/).
> - while in dracut shell, I execute the following command sequence:
>       1. lvm lvchange -ay /dev/centos/root
>       2. lvm lvchange -ay /dev/centos/swap
>       3. ln -s /dev/mapper/centos-root /dev/root
>       4. exit
> ...and the o/s boots fine...so looks like the pv,vg,lv is detected
> properly
> while in initrd, but somehow dracut has difficulties enabling the
> root,swap
> LVs ?
> - While in o/s, I rebuild initrd by using: 'dracut -f -v -a lvm'
> Note, I have to use '-a lvm' as for some reason, if don't, the lvm utils
> (lvm,lvm_scan) are not being included to the initrd, not sure why this
> happens.
> After rebooting, same thing happens, I have to manually boot the system
> via
> dracut shell.
> I'm a bit stuck at this point, any clues what I'm doing wrong in here ?
> As I previously said, this is a new installation, so I could simply
> reinstall the whole thing, but I would rather try to find out some answer
> to why is this happening ... :-) [curiosity]
> Some additional details:
> ==================
> I've attached /run/initramfs/rdsosreport.txt file [generated while in
> inird] here:
> https://privatebin.net/?fdc4052c0c402884#gdB/QYR3IeR55SxUbjfrkZPQfJ7jMxiUxq5DWhTVbWc=
> o/s ver=CentOS Linux release 7.5.1804 (Core)
> [root at localhost ~]# lsblk
> sda               8:0    0   13G  0 disk
> ├─sda1            8:1    0  500M  0 part /boot
> └─sda2            8:2    0 12.5G  0 part
>   ├─centos-root 253:0    0 11.5G  0 lvm  /
>   └─centos-swap 253:1    0    1G  0 lvm  [SWAP]
> [root at localhost ~]# cat /etc/default/grub
> GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
> GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rd.shell
> rhgb"
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos