Sunday, January 14, 2024

dual boot CentOS 7 & Kali linux 2023

 Let we have two HDDs 1st for Centos 7 and 2nd of Kali linux.

Boot in Centos and go to root prompt.

# cd /opt

# grub2-mkconfig -o grub.cfg

# cp grub.cfg /boot/grub2/grub.cfg.new

# cd /boot/grub2/

# mv grub.cfg grub.cfg.original.backup 

# mv grub.cfg.new grub.cfg

# gedit grub.cfg

search for timeout=5 and change it to your timeout at boot menu of centos.

As I changed it to timeout=60 ( for 60 seconds ).

Again you can change title ( menuentry ) for kali linux, because it is set as Debian...  

you may change it to  'Kali Linux 2023'.

# reboot 

and you will have dual boot  of CentOS 7 and Kali.

If you want to change default boot OS high lighting in boot menu, open file as :-

# gedit /boot/grub2/grubenv & ( in background mode of gedit )

change to for CentoOS as here :

saved_entry=CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)

or  for kali linux :-

saved_entry=Kali Linux 2023 (on /dev/sda3)

These are obtained from line in "grub.cfg" as here :-

menuentry 'Kali Linux 2023 (on /dev/sda3)'

copy text between both single quotes, of course without quotes and paste in file "grubenv" without single quotes. And that will be the default boot option in boot menu. There is entry like :-

# GRUB Environment Block
saved_entry=CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)

or 

 saved_entry=Kali Linux 2023 (on /dev/sda3)

Change it as your wish.

If there is any mismatch between menyentry text and saved_entry text and even you add double quots or space in last or before then default boot option will be high lighted.

No comments:

Post a Comment