Hide your dual boot Grub

I am using Windows as default OS but I always wanted to have Kali Linux as my secondary OS. So, I can run some tests. I planned to try Kali Linux Live and made live USB stick but problem raised when i had to format the USB for copying other files. Then, i decided to dual boot my PC and I did. Now, I have two OS installed in my computer, Windows and Kali.

image: docs.kali.org

As you noticed the grub loader, it takes you to Kali Linux if you don't choose windows before timeout. Here, i wanted to boot windows as default. I searched for this,  and i found the solutions too.  Somehow I set windows as default, just by modifying a configuration file and i also found that the grub loader can be hidden and shown by pressing some specified button. I was wondering if i could do that and gave a try to mess up with the configuration file. And ta-da...



What I did?
  1. Installed Kali Linux as Dual boot
  2. Set Windows as Default boot
  3. Removed the grub background
  4. Hide the Grub
  5. Update timeout


Dual Boot:
I followed the Kali official documentation for dual boot installation.


Find windows entry:
fgrep menuentry /boot/grub/grub.cfg

Alternatively, you can open the grub.cfg as a text. I found 'Windows 8 (on /dev/sda4)'.

Set Windows as Default:
I updated /etc/default/grub



- GRUB_DEFAULT=0 

+ GRUB_DEFAULT='Windows 8 (on /dev/sda4)'


Background Image:
GRUB_BACKGROUND=""


Hide Grub during Boot and set timeout:
+ GRUB_HIDDEN_TIMEOUT_QUIET=true

+ GRUB_TIMEOUT_STYLE=hidden

+ GRUB_TIMEOUT=1



And the final Grub looks like:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT='Windows 8 (on /dev/sda4)'
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=1
GRUB_BACKGROUND=""


GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="initrd=/install/gtk/initrd.gz"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

And then, update Grub:
sudo update-grub

If you want to boot Linux, you need to press "RIGHT Shift" during startup within the timeout, here i set to 1 sec. You may want to change this 1 to other integer value.

Resources:

  1. https://askubuntu.com/questions/52963/how-do-i-set-windows-to-boot-as-the-default-in-the-boot-loader
  2. https://askubuntu.com/questions/618169/hide-grub-on-computer-start

Comments

Popular Posts