Pages

2013-06-14

Grub 1.99 in Debian 7. Part 1

Debian Wheezy netinstall and Grub 1.99 tweaking 
Part 1: Facelift

With Debian stable comes Grub 1.99. It is not especially nice-looking and/or handy:
- it has useless wallpaper
- there are a lot of entries without submenus (I have 4-way multiboot, currently)
- menu is a bit too black and white... and other little things.
So I decided to change it. Research took enormous time. Versions and tutorials differ... there are no place to find everything together... tips might work, or not... a lot is simply old...
See here: Ubuntu, more Ubuntu, and this one, and Arch, and my own puny paragraph.
Before tweaking anything, we do backups, of course - like this, for example:
sudo cp /etc/grub.d/05_debian_theme /etc/grub.d/05_.debian_theme.bak 
# ... and all others in /grub.d we happen to hack. Then we make baks un-executable: 
sudo chmod -x /etc/grub.d/*.bak
Also, do backup files: /etc/default/grub and /boot/grub/grub.cfg
Here we go, with multiboot system, one Grub in MBR, one in root, one distro without Grub, and Windows XP.

What I did:
(Let's remember - ALL changes has to be written in with update-grub.)
1. /etc/default/grub
- I wanted my Vsido to be the default boot-choice.
grep menuentry /boot/grub/grub.cfg shows all listed menuentries. First one is 0, second is 1 and so on - simple, but it's more complicated when dealing with submenus. Fortunately I do not have them... unfortunately I would like to - menu looks a lot more tidy when bunch of different kernels are hidden.
So, third item in list means GRUB_DEFAULT=2 and highlight is on Vsido entry now.

- Default console size is GRUB_GFXMODE=640x480. Text is therefore big and longer lines end behind screen edge. We change it like that:
Reboot, and when in Grub, press 'C' to get command line, set pager=1 (because there are probably 2 pages of text coming, then vbeinfo. Correct/supported resolutions are displayed, pick one, write it down, 'esc', boot to desktop and replace old resolution with new and bigger one. Mine is GRUB_GFXMODE=1280x768.
After that line add a new one: GRUB_GFXPAYLOAD_LINUX=keep
That keeps resolution the same for whole boot process (no jumping back to big letters).
NB! 'Keep' doesn't work when booting another distro with its own Grub. Probably gfxmode should be changed there also.
Edit 06.07.2013: Changing the resolution in local Grub doesn't help -  no change. Also - resolution doesn't change for distros without Grub too. So, it seems that whole thing works only for grub-mastering distro. Edit ends.

- If you do not need your machine searched for additional OS-es (for whatever reason), disable 30_os-prober, by adding this line:
GRUB_DISABLE_OS_PROBER=true

- If you do not want bunch of Recovery Modes hanging around, then remove comment from line #GRUB_DISABLE_LINUX_RECOVERY="true".
But, there is interesting twist: IF there is Grub also installed for some other distro, then you have to disable recovery mode there also. Otherways master-Grub reads them from there, and displays.
Other weird thing I encountered: I unpacked my Xubuntu (from archive) to another partition, fixed fstab, and removed Grub complitely. Now, when I ran master 'update-grub', it found whole pile of 'Ubuntus'. It appeared that not only current .img, but also symlinks and '.img.old' kernels were listed... I simply deleted links and .olds - and problem was solved and only one Ubuntu was left in list.

2. /etc/grub.d/05_debian_theme
- Wallpaper. This file has very nicely commented sequence how wallpapers are searched for... not that it helped me very much. I deleted wallpaper-line from /usr/share/desktop-base/grub-background.sh and changed also colors. No cookie. Nothing changed.
Then I checked what's in /boot/grub/grub.cfg. There I found certain png as wallpaper. After some pondering I resolved thing in inelegant and nasty way - I simply renamed joy-grub.png to joy-grub.png.outcomment. Update-grub! No wallpaper was found AND Grub defaulted to 'set_default_theme', which is quite at the beginning of the file (05_debian_theme) AND which can be now edited (with results):

- Colors. See also: Here and here and here.
Default is 'Debian blue', update-grub, reboot and take a look. I found it a bit too bright, so my tweak ended like this:
set_default_theme(){
 # Set the traditional Debian blue theme.
 echo "${1}set menu_color_normal=white/black"
 echo "${1}set menu_color_highlight=yellow/dark-gray"
 echo "${1}set color_normal=white/dark-gray"
}
Menu text is white, background black, higlighted menu-items' text is yellow and under that is gray background. Outside of menu-box is gray with white text (and this last line I added).

That's it. I'm quite satisfied how things look now (errr... no, still can't be bothered with screenshots).
Now, if not terminally lazy, I might produce also a part 2, dealing with hacking of files 10_, 30_ and 40_custom. Means, how to change menuentries themselves.

No comments: