Home » Headline, Linux » 6 August 2019 » 167 supporters » No Comment »

Enable network in rescue boot environment Centos 7

6 August 2019 167 supporters No Comment

One of our server have a boot loop issue and our last option is to change hardware based on recommendation by software vendor.

The issue when changing hardware is the server sometimes cannot boot even using the same hardware specification. We suspect it is something to do with the device UUID because of hardware change.

So to solve the issue we need to boot in rescue environment to repair boot and try to reinstall grub first. Our server using software raid. If during rescue mode if you cannot mount the disk using option 1 and 2 you still be able to mount the raid. Just list the hardisk using command;

fdisk -l

We can possible to assemble and mount the raid device using below command;

mdadm --assemble --run /dev/md0 /dev/sda1 
mdadm --assemble --run /dev/md1 /dev/sda2 

*No need to mount/assemble swap device

Let assume md1 is / and md0 /boot device

mount /dev/md1 /mnt/sysimage
mount /dev/md0 /mnt/sysimage/boot
mount -o bind /dev /mnt/sysimage/dev
mount -o bind /dev/pts /mnt/sysimage/pts *if required
mount -o bind /proc /mnt/sysimage/proc
mount -o bind /sys /mnt/sysimage/sys
mount -o bind /dev/shm /mnt/sysimage/dev/shm 

Next step may or may not required depending on situation. In our case we need it because we need to reinstall kernel. The next step is try to bring up the network but using local ip since the server is in the office and not using public IP.

If you fire command

ip route show

it supposed to be empty because you not set any setting in the network. Run ;

ifconfig -a

to know the network device name.

Command to add IP to the network is:

ip addr add dev enp6s0 192.168.0.22/24 *enp6s0 is your device name

Then add gateway

ip route replace default via 192.168.0.1 dev enp6s0
ip route show *to show current status of network

Now we are ready to login to our problem server. Command below executed:

chroot /mnt/sysimage

Now we are in the server environment and no longer in rescue environment.

We fixed our server by reinstall kernel again. Reinstall kernel require Internet connection.

If this step failed after reboot server, repeat the step again but no need Internet but rather fix the grub by reinstall grub.




Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.