2

This is my setup,

  • I Have installed grub on the usb using grub-install command in the /boot directory.
  • I copied 3 iso's on the usb
  • Manually created a grub.cfg file to boot into the iso's.

So I want to use the starfield theme that comes by default installed with grub.

Now, using the GRUB_THEME variable in /etc/default/grub does not work as I am unable to run the grub-update(update-grub) command. Is there any way I can use the theme?

  • Why are you unable to run the update command? – Jesse K Aug 27 '15 at 15:47
  • @JesseKeilson Because the update command is installed on the computer and it update the cfg file for computer. How would i make it update cfg file for usb? – Registered User Aug 31 '15 at 4:59
3
+100

first install Strafield theme, remember to copy font, ... files from your /usr/share/grub/ directory to the /boot/grub/ directory on the usb.

vi /etc/default/grub

add this:

GRUB_THEME="/boot/grub2/themes/starfield/theme.txt" 

or "/usr/share/grub/themes/starfield/theme.txt"

then :

sudo grub2-mkconfig -o /media/boot/grub2/grub.cfg

check following files in the /boot/grub/ directory on the usb:

  • unicode.pf2
  • png.mod
  • vbe.mod
  • vga.mod
  • gfxterm.mod
  • part_msdos.mod
  • fat.mod
  • the image image (bg.png)

Delete the file /boot/grub/grubenv from the stick

put this code in /boot/grub/grub.cfg file:

insmod part_msdos
insmod fat
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set <your usb UUID>
loadfont /boot/grub/unicode.pf2
set gfxmode=1024x768
insmod vbe
insmod vga
insmod gfxterm
terminal_output gfxterm
insmod png
if background_image /boot/grub/bg.png ; then
  set color_normal=white/black
  set color_highlight=magenta/black
else
  set menu_color_normal=white/black
  set menu_color_highlight=black/light-gray
fi

check the following:

  • the USB should have a msdos MBR insmod part_msdos
  • the USB should have a FAT32 file-system > insmod fat
  • the /boot/grub/ is in the first partition > set root='(hd0,msdos1)'.
  • your graphics card supports the 1024x768 mode > set to your needs
  • 2
    Welcome to U&L. When answering please look at how to format code ( select and click {} above the edit box, and leave an empty line before a list of bullet items. You can see how I changed your code to look somewhat better by selecting the link edited above the last editors name (mine in this case). – Anthon Aug 27 '15 at 17:56
  • This answer almost worked. the only problem was that using /etc/default/grub doesn't work because one cannot update grub using grub-mkconfig as that command would update the computers grub and not usb's grub. I ended using the set theme= /foo/theme.txt and export theme commands directly in grub.cfg file. – Registered User Sep 4 '15 at 13:43
  • I have awarded the bounty as this answer helped, but I can't accept the answer until it is edited so that it works. – Registered User Sep 4 '15 at 13:44
  • the grub-mkconfig should be used for the /media/boot/grub2/grub.cfg not the /boot I edited it . – F.sb Sep 4 '15 at 17:22
  • Are you sure this works? For me, it simply overwrites the USB grub.cfg file with a cfg file for my computer. the -o flag simply provides the output destination, the grub-mkconfig command would still look at where it is installed(which is the computer) – Registered User Sep 8 '15 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.