setting grub 2 and console gfx mode
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3786
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
As usual, everything in grub is just a bit harder than it should be.

UPDATE (2013-11-05): Some things changed from early grub2 days, so use this method instead:

The real way to set console size during boot

Add this to /etc/default/grub
:: Code ::
GRUB_GFXMODE=1024x768
GRUB_GFXPAYLOAD_LINUX=1024x768

that's assuming you want 1024x768

GRUB_GFXMODE=1024x768

covers the actual size of the grub boot screen itself, and:
GRUB_GFXPAYLOAD_LINUX=1024x768

To add an image, say:
:: Code ::
GRUB_BACKGROUND=/usr/share/images/grub/debian-smxi-1280-1024.jpg
to /etc/default/grub as well.

To get your supported resolutions, either use this command:

:: Code ::
hwinfo --framebuffer

which is VERY slow but will eventually give you your screen resolution, or, at the grub prompt, hit 'c' I think and enter: vbeinfo

which should also show the available screen resolutions.

Here's a useful grub2 tutorial from Arch Linux

Once you are done, save the /etc/default/grub file and run, as root:
:: Code ::
update-grub
and things should be more or less the way you want.

Important: do not use a resolution that is not supported by your card/monitor or you will have problems even seeing the grub boot screen.


Old way, legacy, do not use the following
Replacing the old linux kernel boot arg vga=791 (for example), which is grub/console gfx resolution: 1024x768
with the new harder and less user friendly grub2 method is done like this

src 1: forums.debian.net/viewtopic.php?f=5&t=41881
src 2: harrison3001.blogspot.com/2009/09/grub-2-graphical-boot-tips-to-set.html

In Debian, that means:
Open as root in editor: /etc/default/grub
change, uncomment, or add:
GRUB_GFXMODE=1024x768
that only covers the actual grub boot screen.

One of those articles said you can also add:
GRUB_GFXPAYLOAD=1024x768
to cover the actual console size, but that didn't work for me, so I did what the first suggestions in those threads said:

Open /etc/grub.d/00_header as root in editor, find:
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
set gfxmode=${GRUB_GFXMODE}

add under that, so it's like this:
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
set gfxmode=${GRUB_GFXMODE}
set gfxpayload=keep
load_video
insmod gfxterm
fi

set gfxpayload=keep
make grub assign the same boot resolution grub had to console.

Why grub2 has to make all this so perversely complex when it was so siimply in grub 1 is absolutely beyond me, no users are interested in such headaches, so it's really unclear who the target audience was for grub 2 'improvements'.

Anyway, that's life, so it goes.
Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
Thanks for that.

I am not a programmer but it might be useful to have font "set" so it can be changed with themes?

I am thinking set font to A ...do something
set font to B ....do something
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3786
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
yes, you can set the font but I didn't get into that, I tried it before and it didn't work, and sadly, mastering grub2 is just not something I want to spend time on, at least until it stabilizes enough to make online how-tos for Debian actually work, which neither of the ones I linked to above actually fully did.

By the way, to get a different console resolution than the grub screen, you do this;
set gfxpayload=1280x1024
for example.

I tried that by the way and it didn't work, the monitor framebuffer is wrong and was too far to the left, with 1024 it is correct, another example of just incomplete/beta/alpha level code in grub and the linux kernel with kms.

Anyway, we do what we can do, when this stuff stabilizes a bit I'll add some pieces to smxi to help format grub 2 stuff easily, just the basics, that's a to-do, a new grub2 section.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3786
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
GRUB_FONT_PATH
I imagine is set in /etc/default/grub like the other grub globals, but this stuff is so inconsistent and unreliable I'm reluctant to even post such notions for fear of creating even more soon to be obsolete and wrong online grub2 data sources.
Back to top
jiro
Status: Interested
Joined: 11 Jul 2009
Posts: 36
Reply Quote
my /etc/default/grub file contains the following custom settings, which works fine for me:

:: Code ::
GRUB_GFXMODE=1920x1080
GRUB_GFXPAYLOAD_LINUX=keep
# user-defined background image
GRUB_BACKGROUND=/usr/share/images/grub/Dark-Forest-10914.jpg


just remember to run "update-grub" afterwards.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3786
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
thanks, looks like grub has already changed their syntax / methods from the tutorials I found, I'll try that and confirm/deny it works, since it's simpler.

Please show this: apt-cache policy grub-pc

so people can compare their versions for functionalities.
Back to top
jiro
Status: Interested
Joined: 11 Jul 2009
Posts: 36
Reply Quote
here you go:

:: Code ::
inspiron:/home/jiro# apt-cache policy grub-pc
grub-pc:
  Installed: 1.99~rc1-3
  Candidate: 1.99~rc1-3
  Version table:
 *** 1.99~rc1-3 0
        100 /var/lib/dpkg/status

I have been using the above config setup, in the /etc/default/grub file, for a few months now. With each update, I have to manually copy the settings back, using the default backup file.

I used to be able to set menu colors there as well, but that no longer works and I have better things to do with my time than to fix it.

Maybe migrating the custom settings to /etc/grub.d/41_custom will do this, in a permanent way. otherwise, you would have to put the custom colors into the debian_theme file.
Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
hi

the arch wiki refers to the resol issue under
Setting the framebuffer resolution

https://wiki.archlinux.org/index.php/GRUB2

if that helps anyone

nice wiki BTW
Back to top
Display posts from previous:   

All times are GMT - 8 Hours