Update grub using dracut

Fixing grub using dracut

Last kernel update was not successful to me. Centos can not boot with next messages: 

[  180.098802] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
[  180.610167] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
[  181.121619] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
[  181.633093] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
[  182.144831] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
[  182.656146] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
[  183.167306] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
[  183.678755] dracut-initqueue[376]: Warning: dracut-initqueue timeout - starting timeout scripts
 Of course simples way  is creating  linux  usb stick  and fix it. But dracut shell is present and  look likes I can do a lot using it.
First step is mounting   root  and boot partitions.  Dracut has  fdisk, lvm,  vi and  few commands for file system navigation.  I think i dont need a more.  First step is detecting  root partition:

drucat# fdisk -l  | more

Диск /dev/sda: 73,4 ГБ, 73369497600 байтів, 143299800 секторів
Одиниці = секторів з 1 * 512 = 512 байтів
Розмір сектора (логічного/фізичного): 512 байтів / 512 байтів
Розмір введення-виведення (мінімальний/оптимальний): 512 байтів / 512 байтів
Тип мітки диска: dos
Ідентифікатор диска: 0x000c76c3

Пристрій Завант  Початок     Кінець     Блоків  Ід  Система
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   143298559    71136256   8e  Linux LVM
I have boot partition and root somewhere inside Linux LVM. vgscan command is not accessible, but it is possible to do most of this task using lvm:
 lvm vgscan
  Reading all physical volumes.  This may take a while...
    Found volume group "centos" using metadata type lvm2
I have noticed that LVM directory is not created under /dev/ and rerun vgscan:
vgscan --mknodes -v
and activate partitions:
lvm lvchange  -ay /dev/centos/root
lvm lvchange  -ay /dev/centos/swap

lvm lvscan
  ACTIVE            '/dev/centos/swap' [6,84 GiB] inherit
  ACTIVE            '/dev/centos/root' [40,95 GiB] inherit
after this it is possible to mount root and chroot into it:
mkdir /drive
mount /dev/centos/root /drive
mount /dev/sda1 /drive/boot   
mount -o bind /proc /drive/proc
mount -o bind /sys /drive/sys
mount -o bind /dev /drive/dev
chroot /drive
After this, you have access to your system and can fix it easily. In my case issue was related to the wrong option in grub.cfg and start without delay

Comments