Can't apply GRUB theme

Asked by Costumed Manatee

I wan't to update the grub theme of my custom ISO file.
By followng the step of this question : https://answers.launchpad.net/cubic/+question/689127 , I was ebale to change some menu entry. But when I try to put a custom theme, this theme don't seem to load.
I've edit the boot/grub/grub.cfg file and put a "link" to my theme, I've also edit the /etc/default/grub and did the same thing, but the default ubuntu GRUB keep showing up when I boot from my ISO.

Note :
-1 : I'm using this cubic version : bionic 2021.04-50-release~202104202109~ubuntu18.04.1 .

-2 : I try to custom ubuntu 20.04.

-3 : I was able to put a custom theme from another distro (Zorin OS 15.3) by copying the

- /boot/isolinux
- /boot/grub
- /etc/default/grub
- /usr/share/grub

from the Zorin OS into my ubuntu project (I've used Cubic to "deconstruct" the Zorin iso); this method change the grub but I was not able to modify it as I wish even if I try to customised some file (for exemple, if a copy all those folder into my main project, and I edit the background, the default background from the Zorin theme will show up, not the modified one).

-4 : I also tried to run update-grub (from the cubic terminal), this is not working.

Due to what happened on note 3, I think there is a problem with the /boot/isolinux folder but I don't know what (I'm not sure about that).
Can you help me ?

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
Costumed Manatee
Solved:
Last query:
Last reply:
Revision history for this message
Costumed Manatee (costumedmanatee) said :
#1

Also, even when I try to add simple thing like showing the grub menu (which is not the case by default) by adding
set timeout=10
set timeout_style=menu
into /boot/grub/boot.cfg , the grub menu won't show up.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#2

To clarify:

Which Grub theme are you trying to modify?

1. The Grub menu displayed when you boot into the Live ISO

2. The Grub menu displayed *after* you've installed your installed OS?

Revision history for this message
Costumed Manatee (costumedmanatee) said :
#3

Right now the grub menu dipslay when I first boot from the ISO, but I would like to have the exact same theme for the "after" menu.
(By the way, thanks for quick response ! )

Revision history for this message
Cubic PPA (cubic-wizard) said :
#4

#2 will probably be easier, since you would simply make all of your configuration changes ~inside~ Cubic's Terminal environment.

For #1, these changes need to be made on Cubic's Options page, on the Boot tab (as you have been doing).

I recommend you download a copy of a Distro that already uses a customized ISO grub menu to see how they do it.

For example, linuxmint-20-xfce-64bit.iso has a custom grub menu.
They have a "themes" directory under <ISO>/boot/grub.
There is also a theme.txt configuration file in there.

Also, research what the correct syntax is for the grub.cfg file.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LINUX MINT XFCE grub.cfg EXAMPLE
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

if loadfont /boot/grub/font.pf2 ; then
 set gfxmode=auto
 insmod efi_gop
 insmod efi_uga
 insmod gfxterm
 terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

menuentry "Start Linux Mint 20 Xfce 64-bit" --class linuxmint {
 set gfxpayload=keep
 linux /casper/vmlinuz file=/cdrom/preseed/linuxmint.seed boot=casper iso-scan/filename=${iso_path} quiet splash --
 initrd /casper/initrd.lz
}
menuentry "Start Linux Mint 20 Xfce 64-bit (compatibility mode)" {
 linux /casper/vmlinuz file=/cdrom/preseed/linuxmint.seed boot=casper iso-scan/filename=${iso_path} noapic noacpi nosplash irqpoll nomodeset --
 initrd /casper/initrd.lz
}
menuentry "OEM install (for manufacturers)" {
 set gfxpayload=keep
 linux /casper/vmlinuz file=/cdrom/preseed/linuxmint.seed oem-config/enable=true only-ubiquity boot=casper iso-scan/filename=${iso_path} quiet splash --
 initrd /casper/initrd.lz
}
menuentry "Check the integrity of the medium" {
 linux /casper/vmlinuz boot=casper integrity-check iso-scan/filename=${iso_path} quiet splash --
 initrd /casper/initrd.lz
}

Revision history for this message
Cubic PPA (cubic-wizard) said :
#5

(In case you didn't already know, remember to click the "Show all files" button in the header bar on the Boot tab to see all the boot files).

Also, take a look at Linux Mint's <ISO>/isolinux/isolinux.cfg file.

Revision history for this message
Costumed Manatee (costumedmanatee) said :
#6

I was able to put the Linux Mint theme.

I try to do it by 3 differents ways (I started from a "fresh" iso everytime to be sure) :

-1 : I take the /boot/grub/grub.cfg , /boot/grub/loopback.cfg , /boot/grub/themes from linux mint (I edit it just to be compatible with the initrd archive). "Rebuilt" the ISO, try it on a VM, the boot menu didn't showed up.

-2 : I did the exact same thing as above, I also take all the isolinux folder from linux mint (once again edit it to be compatible with the initrd archive (the mint one was in .lz, mine was in .xz) ). "Rebuilt" the ISO, try it on a VM, and the boot menu showed up.

=======IMPORTANT=======

-3 : I didn't touch the /boot folder at all, I just take the isolinux folder from mint and put it on my distro. "Rebuilt" the ISO, try it on a VM, and the boot menu showed up.

Conclusion : I was able to modify my GRUB at first boot, by copying the isolinux folder from another distro and customised it as I wash (background, menu entry, ...)

Now, if I want to change the grub for the "after" how do I do it ?

Revision history for this message
Costumed Manatee (costumedmanatee) said :
#7

I still try to understand what's the use of the /boot/grub/grub.cfg file, I try multiple thing like adding a theme, changing the entries, etc; but those things never showed up.

I try to single boot the ISO, this showed me the boot menu that I was able to configure with the isolinux.cfg, but never show me the GRUB menu after.

I also try to dual boot the ISO, once again this first show me the boot menu from isolinux.cfg, but after compliting the install the GRUB menu is the default Ubuntu GRUB.

On the CustomOS that I dual boot, on my VM, I've check the /boot/grub/grub.cfg, and this file is clearly not the one I've made in cubic.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#8

Manatee,

I have a hunch...

You modify /boot/grub/grub.cfg, but it gets overwritten.

The following warning appears at the top of grub.cfg:

    DO NOT EDIT THIS FILE
    It is automatically generated by grub-mkconfig using templates
    from /etc/grub.d and settings from /etc/default/grub

Have you tried modifying /etc/default/grub instead ?

Revision history for this message
Costumed Manatee (costumedmanatee) said :
#9

Well, I've modified both, /boot/grub/grub.cfg and /etc/default/grub.

On those 2 files I've put a "link" to my theme (This link refer to /boot/grub/themes/MYTHEME/theme.txt

I also tried to refer /usr/share/grub/themes/MYTHEME/theme.txt

With those 2, the grub.cfg as been overwritten.

Revision history for this message
Costumed Manatee (costumedmanatee) said :
#10

I finally achieved what I wanted to do (at least, custom theme for boot and grub) !

Thanks a lot cubic-wizard for helping me.

I will explain what I did in case someone run into similar problem in the futur.

First, for the boot menu when you first launch your iso :
To achieve that part I modified the isolinux.cfg file, this file is in path_to_your_custom_distro/custom-disk/isolinux .

Note : when I "decompose" ubuntu using cubic, in this file, there was 2 cfg file, txt.cfg et isolinux.cfg, I just remove txt.cfg and edit the isolinux.cfg

Here is what my isolinux.cfg looks like :
NOTE : lines where there is " #MANATEE NOTE " are not read by the program and are just here to help you understand.

----------isolinux.cfg file start here--------------------

UI vesamenu.c32
PROMPT 0
timeout 100

#MANATEE NOTE : if you want a custom menu background, be careful, this file should be in png 8 or 16 deepth.
menu background splash.png

menu title Welcome to Manatee OS

MENU COLOR title * #ffbde6fb *
MENU COLOR border * #00000000 #00000000 none

MENU COLOR unsel * #ffbde6fb #00000000 none
MENU COLOR sel * #ffd0e0e8 #ff293a43 none
MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07 37;40 #90ffffff #a0000000 std
MENU COLOR tabmsg 31;40 #ffDEDEDE #00000000 std

MENU COLOR help 37;40 #ff6b828e #00000000 none
MENU VSHIFT 10

MENU WIDTH 78
MENU MARGIN 15
MENU ROWS 9
MENU HELPMSGROW 18

MENU CMDLINEROW 20
MENU TIMEOUTROW 17
MENU TABMSGROW -1
MENU TABMSG Press ENTER to boot or TAB to edit a menu entry

default live

#MANATEE NOTE : To change the entry on your boot menu, just change the line after "menu label"

label live-install
  menu label Install Manatee OS
  kernel /casper/vmlinuz
  append boot=casper file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/casper/initrd.xz quiet splash ---

MENU SEPARATOR

label live-install-nomodeset
  menu label Install Manatee OS (safe graphics)
  kernel /casper/vmlinuz
  append boot=casper file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/casper/initrd.xz quiet splash nomodeset ---

MENU SEPARATOR

label memtest
  menu label Test memory
  kernel /install/mt86plus

MENU SEPARATOR

LABEL power
  MENU LABEL Power Off
  COM32 poweroff.c32

----------isolinux.cfg file end here--------------------

Now, to had a custom theme to my GRUB menu (the menu that appear if I dual boot)

I download a grub theme on the internet (this one for exemple : https://www.gnome-look.org/p/1484785/ ) I modifed it as I wish (once again be careful with the png).

Once my theme was customised as I want, here is what I did :
- I create a directory called "themes" in this directory : path_to_your_custom_distro/custom-root/usr/share/grub
- I copy my custom theme folder into the path_to_your_custom_distro/custom-root/usr/share/grub/themes directory
-I modified the "grub" file in the path_to_your_custom_distro/custom-root/etc/default ; at the end of this file a put this line :

GRUB_THEME="/usr/share/grub/themes/MYCUSTOMTHEME/theme.txt"

Be careful to put the path to your theme.txt file between " " , it's important (I think that's why it didn't work at my first attempt).

Finally, since I call a preseed in my boot menu (the one that showed up when I first boot my iso), the preseed I call is ubuntu.seed (this is the line where this happen : file=/cdrom/preseed/ubuntu.seed ).
I add a command at the and of this preseed, this command will just update the grub near the end of the install. Here is the command :

d-i preseed/late_command string in-target bash -c 'update-grub'

Once again, thanks a lot cubic-wizard, for helping me and for your amazing software !

Revision history for this message
PJSingh5000 (pjsingh5000) said :
#11

Thanks for the complement and for sharing your solution.

This is excellent information!