Code Monkey home page Code Monkey logo

grub-shusher's Introduction

What is this?

On most systems, GRUB shows a message like

GRUB loading.
Welcome to GRUB!

at boot, just before loading the boot menu. Current versions of GRUB do not provide any mechanism to disable this message without patching and recompiling GRUB itself.

This process is cumbersone, as it requires expertise and forces you to recompile / repatch every time you update grub.

grub-shusher contains two tiny .c files that instead of patching the grub source code, they patch the grub binaries or installed master boot record to disable those messages.

The software is generally safe: it looks for a specific set of patterns, and if not all are found, it stops processing. It has been tested on a few machines, and works as expected.

However, I only have access to a handful of machines, and the code will modify your master boot record.

USE IT AT YOUR OWN RISK - YOU ARE RESPONSIBLE FOR BACKING UP AND RESTORING YOUR DATA

At this point, it has been tested on systems with:

  • EFI
  • GPT
  • Standard partition table

If you have success / failure stories to tell, please email me directly (ccontavalli AT gmail.com) or open issues on github (https://github.com/ccontavalli/grub-shusher/issues).

How to use grub-shusher

REPLACE /dev/sda with your GRUB PARTITION, used with grub-setup or grub-install

On Debian Systems with normal partition table (no EFI, no GPT)

# ./setup-debian.sh /dev/sda

... and go read configuring grub.

If you want to setup grub-shusher automatically after each upgrade, you can edit /etc/apt/apt.conf, and add a section like:

DPkg
{
    Post-Invoke {"/opt/projects/grub-shusher/setup-debian.sh /dev/sda >/dev/null 2>/dev/null || true;";};
}

where /opt/projects/grub-shuser is the directory where you downloaded grub-shusher, and /dev/sda is the partition or disk where grub is installed.

On Any Other System (TM) with normal partition table (no EFI, no GPT)

$ make
$ sudo -s
# ./grub-kernel /boot/grub/kernel.img
# ./grub-kernel /usr/lib/grub/i386-pc/kernel.img
# grub-install /dev/sda
# ./mbr /dev/sda

... and done. Note that the order is important:

  1. make will compile the code, you need to have GCC installed.
  2. grub-kernel ... will remove the 'Welcome to GRUB!' message from the kernel.img file.
  3. grub-install /dev/sda will create a new compressed image (by merging several other files, including kernel.img) and install it on your disk.
  4. mbr /dev/sda will remove a few other messages from the installed mbr.

... and go read configuring grub.

On Any System (TM) with EFI

$ make
$ sudo -s
# ./grub-kernel /boot/efi/EFI/***/grubx64.efi

... and done. Important:

  • make always sure that you have made a backup of grubx64.efi

  • replace *** with the distribution name, for example /boot/efi/EFI/manjaro/grubx64.efi.

... and go read configuring grub.

On Any System (TM) with GPT

$ make
$ sudo -s
# ./mbr -g /dev/sda
# ./mbr -g /dev/bios-boot-partition

Note:

  • You must provide the -g flag, this is important for GPT partitions.

  • You must run mbr twice:

    1. With the partition GRUB was told to use (/dev/sda, in this document).
    2. With the GPT partition, the one marked with the EF02 type. You can find this partition by running something like:
# parted /dev/sda print

Configuring GRUB

To make GRUB entirely quiet, my /etc/defaults/grub has:

GRUB_DEFAULT=0
GRUB_TIMEOUT=0
 
GRUB_HIDDEN_TIMEOUT=5
GRUB_HIDDEN_TIMEOUT_QUIET=true

Note that once you have those lines, you need to run update-grub, and on next reboot, you will have to press 'ESC' or keep 'shift' pressed to get into the grub menu. I suggest you try this before you shush grub.

If something goes wrong, you can:

# apt-get install --reinstall grub2
# grub-install /dev/sda

to clean up after yourself.

You can read more about grub-shusher on this blog post.

Getting back into GRUB

Once you change /etc/defaults/grub and run update-grub, grub will no longer show up at boot. To get into the menu, you can try two things:

  • Keep shift pressed during boot. This is the documented mechanism, did not work for me.
  • Press ESC at boot. This is a bit tricky, as if you press it too early, most BIOSes will bring you in the BIOS menu. If you press it too late, well, the operating system will have booted already. The rule of thumb is to press it at the time the GRUB menu would have showed up, had it been enabled. If you use the settings above, you have 5 seconds of window to press the button. On my laptopt, this is right after the screen is cleared.

Contributors and THANKS!

Thanks go to:

grub-shusher's People

Contributors

ccontavalli avatar cyberboss avatar jontes-tech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

grub-shusher's Issues

Also still works in 2024 (on Arch on legacy boot) - thank you!

I'm eternally grateful for this neat and well-documented program

I wanted to remove the ugly messages but keep the formattable GRUB menu

grub-shusher makes more sense to me than the Arch wiki's recommended method of replacing grub with grub-silent: which shows me many thousands of lines of output for me to remove only 2 lines from the screen. grub-silent is a hammer to crack a walnut where this program is tight and specific

Some more ReadMe explanation would have helped me understand better but anyone running such a venerable program should hopefully read through these comments in case this helps anyone

The screens the "Welcome to Grub" message appears on flash up very quickly.
"Welcome to Grub" is hardcoded into the kernel.img but at the same time in the boot sequence there is also "GRUB loading." which is in the MBR (I guess it is generated an instant later, after a screen-refresh). This is one of the messages the second program removes. I'd have liked the ReadMe to have listed what "MBR" (the second program) does as thoroughly as it does for grub-kernel. Since I was conscious I only wanted part of what the program was designed for.

In Arch the method to get pacman to auto-apply the changes will be different from the instructions for Debian+apt. I didn't try that yet.

hide cursor blinking

echo 0 > /sys/class/graphics/fbcon/cursor_blink
echo 1 > /sys/class/graphics/fbcon/cursor_blink

we need to add this somehow
because when the pc start the cursor still blinking

FLICKER_FREE_BOOT and rebuild debian package

For those around here knowing how to properly rebuild a debian package,
it's worth knowing that inserting in debian/rules

FLICKER_FREE_BOOT := yes

before

ifeq ($(FLICKER_FREE_BOOT),yes)

will achieve a better result.

Error remove welcome grub

I have arch linux on my pc. I want delete Welcome Grub, but have error
make: cc: No such file or directory
make: *** [: mbr.o] Error 127

Thank you! You have saved me from an awful bug!

THANK YOU! My HP Elitebook kept freezing up on the "Welcome to GRUB!" message, great little script you've got here!

One question though, my system is UEFI with GPT, must I apply this script after every grub or kernel update, or does it apply to the EFI file somehow? I read your http://rabexc.org/posts/grub-shush but not all of it :P

My system wouldn't boot Linux via UEFI through the original EFI directory, so I am happy you have made it so we can specify the EFI file!

Grub message not removed

Weclome to GRUB! Still shows but the "loading grub" has been removed

Grub version : grub 1:2.02.beta2-6
OS : arch x86_x64
DE : gnome-shell

Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 3146kB 2097kB bios_grub
2 3146kB 240GB 240GB ext4

sh-4.3# ./mbr -g /dev/sda
opened: /dev/sda
read: 2048 bytes from /dev/sda
match[0]: NOT FOUND
match[1]: NOT FOUND
match[2]: found at 384, "GRUB ", 'G'
Found mbr header of gpt disk.
Make sure to also run this on the ef02 partition of this drive.
PATCHED SUCCESSFULLY!
(the message should be gone next time you reboot, good luck!)

sh-4.3# ./mbr -g /dev/sda1
opened: /dev/sda1
read: 2048 bytes from /dev/sda1
match[0]: found at 283, "loading", 'l'
match[1]: found at 291, ".", '.'
match[2]: NOT FOUND
Found ef02 header of gpt grub partition.
Make sure to also run this on full drive.
PATCHED SUCCESSFULLY!
(the message should be gone next time you reboot, good luck!)

Still works in 2023

Works perfectly in Debian 11 / Grub 2.06

GRUB maintainers should really add an option to natively deactivate this, it's really ugly, especially if you hide the GRUB menu : the Welcome to GRUB flashes for a fraction of a second, and only on a portion of the screen :
welcome-to-grub_FLICKR

Changing "Welcome to GRUB!", not removing it.

Your idea is really great. But I would like to use your scripts not for quieting GRUB, but to change "Welcome to GRUB!" message to my own. Do you think it will be possible with your script? Could you give me a clue, what should I change in your scripts to allow changing GRUB message to my own? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.