13

I am using the minimum install of CentOS 7 with command line access only (no graphic support installed).

After spending hours reading online about editing grub files, installing guest additions, and setting VB options, absolutely nothing is working for me.

First, guest additions is installed. Secondly, the only grub file I have is /boot/grub2/grub.cfg, and it says not to edit it as it's dynamically generated. Finally, editing the Display under VB's > Machine > settings to automatic, none, or hint with the resolution I want does not make a difference.

Step by step, what exactly do I have to do in order to get my screen resolution to be larger than 640 x 400 as well as provide for a buffer (currently there is no buffer)?

1
  • 1
    This doesn't solve the screen size issue, but a work around maybe just to SSH into the vm if you don't need the console all the time
    – Fegnoid
    Commented Sep 25, 2014 at 8:15

3 Answers 3

24

CentOS 7 still uses the deprecated vga parameter. You wanted step-by-step, you get it:

  1. Make yourself root: sudo su
  2. vi /etc/default/grub
  3. In Vi, press i or Insert-key on your keyboard to enter the edit mode.
  4. Add vga=792 inside the "-quotes for GRUB_CMDLINE_LINUX, f.ex. GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet vga=792"
  5. Press Esc and type :wq and hit Enter to save and exit Vi.
  6. grub2-mkconfig -o /boot/grub2/grub.cfg
  7. reboot

This procedure applies not just Mac, but all host operating systems running Virtualbox: Windows, Linux.

@garethTheRed's answer might work in some versions of some Linux distros, but the trick is to find the correct parameters for your environment. At least with some Red Hat distros you need to fall back to old, deprecated habits.

2
  • Works. So CentOS 7 still uses vga param.. BTW vga=792 will give you a 1024x768 resolution.
    – A.D.
    Commented Nov 2, 2016 at 0:23
  • 2
    pierre.baudu.in/other/grub.vga.modes.html has other codes for this. 795 is 1280x1024 at 24bit depth. Here is the chart from that without formatting... sorry Colour depth 640x480 800x600 1024x768 1280x1024 1400x1050 1600x1200 8 (256) 769 771 773 775 15 (32K) 784 787 790 793 16 (65K) 785 788 791 794 834 884 24 (16M) 786 789 792 795
    – flickerfly
    Commented Mar 1, 2017 at 21:23
8

Above all, I followed in @John Mayor's steps and made up a specific way. hope it helps to someone.


[Tested Environment]

CentOS 7.4.1708 on VMWARE Workstation 12 Player (kernel 3.10.0-693.21.1.el7.x86_64)


  1. Edit GRUB_CMDLINE_LINUX value in /etc/default/grub file

    Before :GRUB_CMDLINE_LINUX="crashkernel=auto ... rhgb quiet"
    After    :GRUB_CMDLINE_LINUX="crashkernel=auto ... rhgb quiet vga=ask"

  2. Grub Update

    grub2-mkconfig -o /boot/grub2/grub.cfg   ( CentOS, Tested )
    grub2-mkconfig -o /boot/grub2/grub.conf ( Fedora, Not Tested )

  3. Reboot

  4. A message is displayed like below, press <ENTER>

    Press <ENTER> to see video modes available. <SPACE> to continue. or wait 30 sec

  5. Choose one of the out values and note it Display example

    example row ) z 342 1152x864x32 VESA

  6. Type z and press <ENTER> for test

  7. Boot continues. after boot, confirm the resolution is changed.

  8. Edit GRUB_CMDLINE_LINUX value in /etc/default/grub file again change vga value from ask to 0x0342 what you memoized value previous step.
    ※ Display mode number must be hexadecimal. or not, it would be undefined video mode number 342 printed

    Before :GRUB_CMDLINE_LINUX="crashkernel=auto ... rhgb quiet vga=ask"
    After    :GRUB_CMDLINE_LINUX="crashkernel=auto ... rhgb quiet vga=0x0342"

  9. Grub Update again

    grub2-mkconfig -o /boot/grub2/grub.cfg ( CentOS )
    grub2-mkconfig -o /boot/grub2/grub.conf ( Fedora )

  10. Reboot and confirm it.

2
  • Great. Now I know why I set 792 but in grub I see different values.
    – WesternGun
    Commented Mar 8, 2019 at 13:05
  • Any chance to get greater resolution than 1152x864?
    – Maxim
    Commented Mar 7, 2021 at 7:19
2

You need to inform the guest's kernel of the required size of your terminal.

At the grub prompt, use the cursor keys to move to the kernel that you are intending to boot and press the E key to edit. Use the cursor key to move to the line that starts linux and at the end of the line add:

video=800x600-24

for 800 x 600 resolution with 24 bit colour.

Press whatever key combination grub needs to boot.

If that works, you'll need to make this permanent:

Modify /etc/default/grub and append the stanza above to the GRUB_CMD_LINE line.

Next run:

# grub2-mkconfig -o /boot/grub2/grub.cfg

which will make 800x600@24 the default for all current and future kernels.

1
  • good test approach.
    – WesternGun
    Commented Mar 8, 2019 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .