Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to change the GRUB2 background in Kali Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to change the GRUB2 background in Kali Linux. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Kali Linux is an open source penetration testing tool that contains more than 300 penetration software. Kali Linux has both 32-bit and 64-bit images. Can be used for x86 instruction sets. There are also mirrors based on the ARM architecture, which can be used for raspberry pie and Samsung ARM Chromebook.

This is usually the first problem that everyone will encounter. Where is it set up? There are many ways to find GRUB settings. Everyone may have their own way, but I find that update-grub is the easiest. If you execute update-grub in VMWare or VirtualBox, you will see something like this:

Root@kali:~# update-grubGenerating grub configuration file... Found background image: / usr/share/images/desktop-base/desktop-grub.pngFound linux image: / boot/vmlinuz-4.0.0-kali1-amd64Found initrd image: / boot/initrd.img-4.0.0-kali1-amd64 No volume groups founddoneroot@kali:~# if you have two or three systems, you will see GRUB and other operating system entrances. However, what we are interested in is the background image, which I see here (you will see exactly the same content):

Found background image: / usr/share/images/desktop-base/desktop-grub.pngGRUB launch image search order in grub-2.02, for Debian-based systems, it searches the startup background in the following order:

The GRUB_BACKGROUND line in / etc/default/grub

The first image found in / boot/grub/ (if more than one is found, it will be sorted alphabetically)

Specified in / usr/share/desktop-base/grub_background.sh

Listed in the WALLPAPER row in / etc/grub.d/05_debian_theme

Now leave this information here and we will re-check it as soon as possible.

Kali Linux GRUB Startup Image when I use Kali Linux (because I like to do things with it), I will find that Kali is using the background image here: / usr/share/images/desktop-base/desktop-grub.png

To be sure, let's check the properties of this .png file.

Root@kali:~# root@kali:~# ls-l / usr/share/images/desktop-base/desktop-grub.pnglrwxrwxrwx 1 root root 30 Oct 8 00:31 / usr/share/images/desktop-base/desktop-grub.png-> / etc/alternatives/desktop-grubroot@kali:~#

Change GRUB background in Kali Linux-blackMORE OPs-1

What? Is it just a symbolic link to / etc/alternatives/desktop-grub? But / etc/alternatives/desktop-grub is not a picture file. Looks like I'm going to check its properties, too.

Root@kali:~# root@kali:~# ls-l / etc/alternatives/desktop-grublrwxrwxrwx 1 root root 44 Oct 8 00:27 / etc/alternatives/desktop-grub-> / usr/share/images/desktop-base/kali-grub.pngroot@kali:~#

Change GRUB background in Kali Linux-blackMORE OPs-3

Well, it's puzzling. / etc/alternatives/desktop-grub is also a symbolic link that points to / usr/share/images/desktop-base/kali-grub.png, from the same folder in the beginning. Ugh! Speechless. But now we can at least replace the file and resolve it.

Before replacing, we need to check the properties of / usr/share/images/desktop-base/kali-grub.png to ensure that files of the same type and size are downloaded.

Root@kali:~# root@kali:~# file / usr/share/images/desktop-base/kali-grub.png/usr/share/images/desktop-base/kali-grub.png: PNG image data, 640 x 480, 8-bit/color RGB, non-interlacedroot@kali:~# can determine that this is an PNG image file with a pixel size of 640 x 480.

The GRUB background image properties can use PNG, JPG/JPEG, and TGA image files as the background for GRUB 2. The following specifications must be met:

JPG/JPEG image must be 8-bit (256colors)

Images should be non-indexed, RGB

By default, if the desktop-base package is installed, images that conform to the above specifications will be placed in the / usr/share/images/desktop-base/ directory. It's easy to find similar files on Google. I found one, too.

Root@kali:~# root@kali:~# file Downloads/wallpaper-1.png Downloads/wallpaper-1.png: PNG image data, 640 x 480, 8-bit/color RGB, non-interlacedroot@kali:~#

Change GRUB background in Kali Linux-blackMORE OPs-6

Method 1: replace the image now we simply replace / usr/share/images/desktop-base/kali-grub.png with the new file. It is worth noting that this is the easiest way to do this without modifying the grub-config file. If you are familiar with GRUB, it is recommended that you simply modify the default configuration file of GRUB, and then execute update-grub.

As usual, I will rename the original file to kali-grub.png.bkp for backup.

Root@kali:~# root@kali:~# mv / usr/share/images/desktop-base/kali-grub.png / usr/share/images/desktop-base/kali-grub.png.bkproot@kali:~#

Change GRUB background in Kali Linux-blackMORE OPs-4

Now let's rename the downloaded file to kali-grub.png.

Root@kali:~# root@kali:~# cp Downloads/wallpaper-1.png / usr/share/images/desktop-base/kali-grub.pngroot@kali:~#

Change GRUB background in Kali Linux-blackMORE OPs-5

Finally, execute the command update-grub:

Root@kali:~# update-grubGenerating grub configuration file... Found background image: / usr/share/images/desktop-base/desktop-grub.pngFound linux image: / boot/vmlinuz-4.0.0-kali1-amd64Found initrd image: / boot/initrd.img-4.0.0-kali1-amd64 No volume groups founddoneroot@kali:~#

Change GRUB background in Kali Linux-blackMORE OPs-7

The next time you restart your Kali Linux, you will see that the GRUB background becomes your own image (GRUB startup interface).

Here is the background of the new GRUB startup that I am using now. What about you? Would you like to try this?

Change GRUB background in Kali Linux-blackMORE OPs-9

This is the easiest and safest way to do this, and the worst-case scenario is to see a blue background on GRUB, but you can still log in and fix them. Now if you are confident, let's try a better way (a little complicated) to change the GRUB settings. The next steps are more interesting and can be used on any Linux that uses GRUB boot.

Now recall where GRUB looked for a boot background image? Watch it again:

The GRUB_BACKGROUND line in / etc/default/grub

The first image found in / boot/grub/ (if more than one is found, it will be sorted alphabetically)

Specified in / usr/share/desktop-base/grub_background.sh

Listed in the WALLPAPER row in / etc/grub.d/05_debian_theme

So let's try a new option on Kali Linux (or any Linux system that uses GRUB2).

Method 2: define the image path in GRUB_BACKGROUND so you can use any of the above according to the above search priority and change the GRUB background image to your own. The following is the content of / etc/default/grub on my own system.

Root@kali:~# vi / etc/default/grub adds a line in the format of GRUB_BACKGROUND= "/ root/World-Map.jpg", where World-Map.jpg is the image file you want to use as the background for GRUB.

# 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=0GRUB_TIMEOUT=15GRUB_DISTRIBUTOR= `lsb _ release-I-s 2 > / dev/null | | echo Debian`grub _ CMDLINE_LINUX_DEFAULT= "quiet" GRUB_CMDLINE_LINUX= "initrd=/install/gtk/initrd.gz" GRUB_BACKGROUND= "/ root/World-Map.jpg" once the change is completed using the above method Be sure to execute the update-grub command, as shown below.

Root@kali:~# update-grubGenerating grub configuration file... Found background: / root/World-Map.jpgFound background image: / root/World-Map.jpgFound linux image: / boot/vmlinuz-4.0.0-kali1-amd64Found initrd image: / boot/initrd.img-4.0.0-kali1-amd64 No volume groups founddoneroot@kali:~# now restart the machine, and you will see a custom image in GRUB.

Method 3: put the image file in the / boot/grub/ folder. If the GRUB_BACKGROUND item is not specified in the / etc/default/grub file, GRUB should theoretically use the first image file found in the / boot/grub/ folder as the background. If GRUB finds more than one image file in / boot/grub/, it sorts alphabetically and uses the first image file.

Mode 4: specify the image path in grub_background.sh if the GRUB_BACKGROUND entry is not specified in the / etc/default/grub file, and there is no image file in the / boot/grub/ directory, GRUB will start searching in the image path specified in the / usr/share/desktop-base/grub_background.sh file. Kali Linux is specified here. Each Linux distribution has its own characteristics.

Method 5: specify the image on the WALLPAPER line of the / etc/grub.d/05_debian_theme file, which is the last location where GRUB searches for the background image. If it is not found in any other part, it will look here.

The above is the editor for you to share how to change the GRUB2 background in Kali Linux, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report