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

Upgrade postgres 9.4 to 9.6 at Debian linux

I'm using virtual server based on Debian Linux for some my free projects.  One of them is based on Postgres with PostGIS extension.   This windy rainy day is a good time for executing some upgrade. Also I would like to add partman extension for partituoning.
Checking new version. Update package list :
aptitude update Get: 1 http://ftp.debian.org/debian jessie-updates InRelease [145 kB] Get: 2 http://security.debian.org stretch/updates InRelease [62.9 kB] Get: 3 http://security.debian.org jessie/updates InRelease [63.1 kB]
 Check for new version:


dpkg-query -l postgresql* Desired=Unknown/Install/Remove/Purge/Hold| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)||/ Name Version Ar…

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]: Stopped postfix.service.чер 13 15:…

Small python script for monitoring MySQL performance

I have few services which use MySQL as database server. I would like to have information about load in PNG  image  or  in Cacti app.
MySQL   has  performance information at 'SHOW STATUS' command.

Values  which  are monitored : 
 threads_running, threads_connected, thread_cached, slow_queries
 Of course,  it is really easy to add more variables.

Connection to MySQL is accomplished by MySQLdb  module. Typical example of usage is below :
import MySQLdb mydb = MySQLdb.connect(host = 'hostname', user = 'username', password = 'secret', database = 'mysatabase' ) mycursor = mydb.cursor() mycursor.execute('SQL command') sqlresult = cur.fetchall()
Storing data in rrd file is aviable via rrdtools package. This one is present in debian and Centos OS. example of creating file is below: import rrdtool rrdtool.create("myfile.rrd" , "DS:value1:datatype:hea…