Grub2 and framebuffer

Kernels & Hardware, configuring network, installing services

Grub2 and framebuffer

Postby stoffepojken » 2009-07-19 19:36

Hi

I cant get my framebuffer to work in the console with grub2. The framebuffer work with the grub boot screen but as son as the boot process start it no longer work. I have changed the values in /etc/default/grub and runned update-grub. I am running Sid fully updated. Any ideas?

/etc/default/grub:
Code: Select all
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet vga=0x0365"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=1440x900@32

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true


/boot/grub/grub.cfg:
Code: Select all
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,2)
search --no-floppy --fs-uuid --set 8536ee88-26ed-409d-9dff-e0d74c26e47a
if loadfont /usr/share/grub/ascii.pf2 ; then
  set gfxmode=1440x900@32
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, Linux 2.6.30-1-amd64" {
        set root=(hd0,2)
        search --no-floppy --fs-uuid --set 8536ee88-26ed-409d-9dff-e0d74c26e47a
        linux   /boot/vmlinuz-2.6.30-1-amd64 root=UUID=8536ee88-26ed-409d-9dff-e0d74c26e47a ro  quiet vga=0x0365
        initrd  /boot/initrd.img-2.6.30-1-amd64
}
menuentry "Debian GNU/Linux, Linux 2.6.30-1-amd64 (recovery mode)" {
        set root=(hd0,2)
        search --no-floppy --fs-uuid --set 8536ee88-26ed-409d-9dff-e0d74c26e47a
        linux   /boot/vmlinuz-2.6.30-1-amd64 root=UUID=8536ee88-26ed-409d-9dff-e0d74c26e47a ro single
        initrd  /boot/initrd.img-2.6.30-1-amd64
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file is an example on how to add custom entries
### END /etc/grub.d/40_custom ###
User avatar
stoffepojken
 
Posts: 707
Joined: 2007-01-25 01:21
Location: Stockholm, Sweden

Re: Grub2 and framebuffer

Postby toto » 2009-07-21 09:51

Hi,

At the moment there's no configuration support for gfxpayload in /etc/default/grub. See Debians bugreport: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=536453.

But you can edit /boot/grub/grub.cfg directly.

Code: Select all
set gfxpayload=1440x900x32


Add the above line below 'set gfxmode=1440x900x32' in your /boot/grub/grub.cfg, here's mine:

Code: Select all
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,1)
search --no-floppy --fs-uuid --set 43061a27-132b-46e8-ae0a-702cd6c2f3e2
if loadfont /usr/share/grub/ascii.pf2 ; then
  set gfxmode=640x480
  set gfxpayload=1024x768x16
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, Linux 2.6.30-1-686" {
   set root=(hd0,1)
   search --no-floppy --fs-uuid --set 43061a27-132b-46e8-ae0a-702cd6c2f3e2
   linux   /boot/vmlinuz-2.6.30-1-686 root=UUID=43061a27-132b-46e8-ae0a-702cd6c2f3e2 ro  quiet
   initrd   /boot/initrd.img-2.6.30-1-686
}
menuentry "Debian GNU/Linux, Linux 2.6.30-1-686 (recovery mode)" {
   set root=(hd0,1)
   search --no-floppy --fs-uuid --set 43061a27-132b-46e8-ae0a-702cd6c2f3e2
   linux   /boot/vmlinuz-2.6.30-1-686 root=UUID=43061a27-132b-46e8-ae0a-702cd6c2f3e2 ro single
   initrd   /boot/initrd.img-2.6.30-1-686
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file is an example on how to add custom entries
### END /etc/grub.d/40_custom ###


The only drawback is that everytime you update grub or run update-grub these settings are overwritten.
BTW 'vga=' still works but it gives a little warning about it being deprecated and that you should use gfxpayload instead.
toto
 
Posts: 16
Joined: 2007-07-25 01:06

Re: Grub2 and framebuffer

Postby stoffepojken » 2009-07-25 18:10

Thank you very much toto!

It works. Now my console is usable again :D
User avatar
stoffepojken
 
Posts: 707
Joined: 2007-01-25 01:21
Location: Stockholm, Sweden

Re: Grub2 and framebuffer

Postby m_l » 2009-08-07 09:39

Code: Select all
set gfxpayload=1024x768x16


Worked for me also. Thank You :)
User avatar
m_l
 
Posts: 58
Joined: 2008-04-27 11:28

Re: Grub2 and framebuffer

Postby jheaton5 » 2009-09-24 00:26

It worked for me too. But I would like to know how to add it with the grub-mkconfig series of files. /etc/default/grub sets gfxmode, but I can't find a file that sets gfxpayload. It has to be something simple. I have read that modifying /etc/grub.d/00_header will do the trick, but I don't know enough about bash scripting for the edit to be apparent. It would be nice if anyone who does bash scripting could help us out.
debian sid with kernel img 3.8.10 lxde no dm
User avatar
jheaton5
 
Posts: 1475
Joined: 2008-08-20 01:40
Location: Sharpsburg, GA, USA

Re: Grub2 and framebuffer

Postby bugsbunny » 2009-09-24 03:58

It is simple :)
Simply modify /etc/grub.d/00_header as follows:
On approximately line 77 you should see:
Code: Select all
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
  set gfxmode=${GRUB_GFXMODE}
  insmod gfxterm

Insert one line as follows:
Code: Select all
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
  set gfxmode=${GRUB_GFXMODE}
  set gfxpayload=keep
  insmod gfxterm


That will cause the console size to be the same as the grub screen size. The grub screen size is obtained from GRUB_GFXMODE, which is set in /etc/default/grub.
Code: Select all
GRUB_GFXMODE=1600x1200x32

works here. You do, of course, have to run update-grub.

Taking this a step further if you want to set your own background for the grub boot screen:
Modify 05_debian_theme. The line to modify is (approx) line 16. Mine currently looks as follows:
Code: Select all
  for i in {/boot/grub,/boot/grub2-background}/serenity.{png,tga,jpg,jpeg} ; do

This will search /boot/grub and /boot/grub2-background (a directory I created) for a file called serenity with an extension of png, tga, jpg, or jpeg If found this image will be used as the grub background image.

I had to stick the image directory onto the boot device due to the fact that lvm isn't active at that point yet, so anything else isn't yet available (on my system) (remember this is before you even select a system to boot). I think that you can somehow configure grub to boot off an lvm drive, but I haven't gotten that far yet :)
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04

Re: Grub2 and framebuffer

Postby jheaton5 » 2009-09-24 09:50

I have GFXMODE set to 640x480 which gives me a full screen menu. I wanted GFXPAYLOAD set to 1440x900 so using your solution I changed GFXPAYLOAD=keep to GFXPAYLOAD=1440x900x32 in /etc/grub.d/00_header. Then I ran update-grub and the /boot/grub/grub.cfg was changed to
Code: Select all
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  set gfxpayload=1440x900x32
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
Success!
Thanks bugsbunny
debian sid with kernel img 3.8.10 lxde no dm
User avatar
jheaton5
 
Posts: 1475
Joined: 2008-08-20 01:40
Location: Sharpsburg, GA, USA

Re: Grub2 and framebuffer

Postby Modo » 2009-10-24 19:11

Unfortunately I had no success with that method. grub.cfg - header looks now like this:
Code: Select all
### BEGIN /etc/grub.d/00_header ###
set default=0
insmod ext2
set root=(hd0,2)
search --no-floppy --fs-uuid --set d3b9e534-2907-4ae2-a390-d1761066dcc0
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  set gfxpayload=1400x1050x16
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod ext2
set root=(hd0,2)
search --no-floppy --fs-uuid --set d3b9e534-2907-4ae2-a390-d1761066dcc0
insmod png
if background_image /boot/grub/moreblue-orbit-grub.png ; then
  set color_normal=black/black
  set color_highlight=magenta/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###
....


but my grub still has a resolution of 640x480 and no background-image. And the same resolution on the console. I use Squeeze with some apt-pinning packes from Sid.

Thank you

Christian
User avatar
Modo
 
Posts: 2
Joined: 2009-10-22 21:27
Location: Mainz, Germany

Re: Grub2 and framebuffer

Postby Smjert » 2009-11-04 12:43

Now i didn't tried what you did, but i have a previous issue: where GRUB_FONT_PATH is taken?

Since my grub.cfg header it's:
Code: Select all
### BEGIN /etc/grub.d/00_header ###
set default=0
insmod ext2
set root=(hd0,6)
search --no-floppy --fs-uuid --set 1cea2dc6-e7b9-42b9-9d6c-cccf38ebceaa
if loadfont /share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
set timeout=5
### END /etc/grub.d/00_header ###


As you can see the path is wrong, but when i fix it directly in the grub.cfg, adding /usr, then at the reboot it don't uses anymore the png but it switch the theme to the old grub!?!?
I think that this issue is to be fixed first since otherwise the bash will never read what's inside that if..
Smjert
 
Posts: 8
Joined: 2009-11-04 00:39

Re: Grub2 and framebuffer

Postby Smjert » 2009-11-05 11:09

Well i have recompiled a custom version of the debian kernel and now it shows the right resolution even with the older kernels.
The only problem is that at the start the res and the fonts is ok.. but then it runs a console script that says "Setting up console fonts" or something like that and the font type change.. how to avoid this?
Smjert
 
Posts: 8
Joined: 2009-11-04 00:39

Re: Grub2 and framebuffer

Postby josephg » 2009-11-06 00:04

Not working for me either! I get the frame buffer with a nice font at the grub boot screen, but the boot process starts with the ugly screen/font. What am I missing?

I am running debian stable with a stock kernel from the repository
Code: Select all
$ uname -srv
Linux 2.6.26-2-686 #1 SMP Wed Nov 4 20:45:37 UTC 2009

My grub.cfg contains
Code: Select all
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=2
set timeout=5
set root=(hd0,2)
search --fs-uuid --set b131478c-f3db-4e03-9bfe-9c94ca72bb78
if font /usr/share/grub/ascii.pff ; then
  set gfxmode=640x480
  set gfxpayload=800x600x16
  insmod gfxterm
  insmod vbe
  terminal gfxterm
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
#set menu_color_normal=cyan/blue
#set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.26-2-686" {
        set root=(hd0,2)
        search --fs-uuid --set b131478c-f3db-4e03-9bfe-9c94ca72bb78
        linux   /boot/vmlinuz-2.6.26-2-686 root=/dev/hda2 ro
        initrd  /boot/initrd.img-2.6.26-2-686
}
menuentry "Debian GNU/Linux, linux 2.6.26-2-686 (single-user mode)" {
        set root=(hd0,2)
        search --fs-uuid --set b131478c-f3db-4e03-9bfe-9c94ca72bb78
        linux   /boot/vmlinuz-2.6.26-2-686 root=/dev/hda2 ro single
        initrd  /boot/initrd.img-2.6.26-2-686
}
### END /etc/grub.d/10_linux ###
josephg
 
Posts: 39
Joined: 2009-01-03 14:01
Location: Surrey, England.

Re: Grub2 and framebuffer

Postby Modo » 2009-11-24 23:28

@Smjert: at my grub.cfg the font-path is complete:
Code: Select all
if loadfont /usr/share/grub/unicode.pf2 ; then

so this doesn't cause any problems. Do you have a "prefix=/usr"-line in your /etc/grub.d/00_header? I think this is responsible for prober path?
User avatar
Modo
 
Posts: 2
Joined: 2009-10-22 21:27
Location: Mainz, Germany

Re: Grub2 and framebuffer

Postby ColdStar » 2009-11-29 21:28

It doesn't work for me. Im using ubuntu studio 9.10, grub version is GNU GRUB 1.97~beta4. When pressed Ctrl+Alt+F1, the console font is too small. I changed the /etc/grub.d/00_header and /etc/default/grub, then run update-grub. I checked the /boot/grub/grub.cfg, I got these two lines:

set gfxmode=640x480
set gfxpayload=800x600x16

The boot is right in 640x480 mode, but the console doesn't change. Is that sign between 640 and 480 is lower case of "X"? Or it just not work for ubuntu studio? What did I miss?
ColdStar
 
Posts: 1
Joined: 2009-11-29 20:53

Re: Grub2 and framebuffer

Postby jheaton5 » 2009-11-30 19:26

GFXPAYLOAD is supported by grub 1.97

Do not edit /boot/grub/grub.cfg.

In /etc/default/grub find the line:
Code: Select all
GRUB_GFXMODE=1440x900@32
underneath that line insert:
Code: Select all
GRUB_GFXPAYLOAD=1440x900x32


then in /etc/grub.d/00_header find the line:
Code: Select all
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=1440x900x32 ; fi

then insert
Code: Select all
if [ "x${GRUB_GFXPAYLOAD}" = "x" ] ; then GRUB_GFXPAYLOAD=1440X900x32 ; fi
below it.
In the same file, but farther down the page, find the line:
Code: Select all
set gfxmode=${GRUB_GFXMODE}
insert below that line:
Code: Select all
set gfxpayload=${GRUB_GFXPAYLOAD}


Now run
Code: Select all
 # update-grub2


Substitute your own screen resolution for mine.
debian sid with kernel img 3.8.10 lxde no dm
User avatar
jheaton5
 
Posts: 1475
Joined: 2008-08-20 01:40
Location: Sharpsburg, GA, USA

Re: Grub2 and framebuffer

Postby m_l » 2009-12-22 00:50

Thank you for the update, bugsbunny and jheaton5.
User avatar
m_l
 
Posts: 58
Joined: 2008-04-27 11:28

Next

Return to System configuration

Who is online

Users browsing this forum: jrubins and 5 guests

fashionable