Skip to main content

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

Popular posts from this blog

  debian,  amavis,  virus inside archive   One my client asked informed me, that amavis skips some files types. mail server configuration is really simple: Postfix as SMTP server and  amavis working as context filter. Also amavis runs spamassasin and clamd antivirus. Amavis gets files from attachment and unpack it. lha file is not detected. short investigation First I deceided to run amavis  in debug mode and verify how virus passed postix+amavis.  root@newserver:/var/lib/amavis# /etc/init.d/amavis stop [ ok ] Stopping amavis (via systemctl): amavis.service. root@newserver:/var/lib/amavis# /etc/init.d/amavis debug Trying to run amavisd-new in debug mode. Debug mode inform about loaded plugins: ' Nov 13 22:07:23.335 newserver. /usr/sbin/amavisd-new[40334]: Found decoder for .cpio at /bin/pax Nov 13 22:07:23.336 newserver. /usr/sbin/amavisd-new[40334]: Found decoder for .tar at /bin/pax Nov 13 22:07:23.336 newserver. /usr/sbin/amavisd-new[40334]

Postfix can not start via systemd (simple fix)

Solving problem related to systemd process I like postfix.   This is really smart and secure mail server. I'm helping above  dozen clients around the world and  tunning  postfix is really fun task. This morning I was downgrading postfix  to the stable version for one of the my friends and come across interesting issue.  root@newserver:/etc/init.d# systemctl status postfix ● postfix.service Loaded: masked (/dev/null; bad) Active: inactive (dead) since вт 2017-06-13 14:35:41 EEST; 1h 48min ago Main PID: 25145 (code=exited, status=0/SUCCESS) чер 13 14:47:09 newserver systemd[1]: Stopped postfix.service. чер 13 14:47:29 newserver systemd[1]: Stopped postfix.service. чер 13 14:58:22 newserver systemd[1]: Stopped postfix.service. чер 13 14:58:23 newserver systemd[1]: Stopped postfix.service. чер 13 15:05:20 newserver systemd[1]: Stopped postfix.service. чер 13 15:29:06 newserver systemd[1]: Stopped postfix.service. чер 13 15:29:06 newserver systemd[1]: Stopp