In this post we will learn how to enable network in rescue mode under Centos 7.
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;
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 ;
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:
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.
One thought on “Enable network in rescue boot environment Centos 7”
[…] local ip under rescue mode Centos because we need to reinstall kernel. It is basically the same as this article, just this time I create a simple bash script in toort directory. This is only for my […]