This one bugged me for a while. Whenever I would reboot my CentOS 7 server with Xen kernel, my console/framebuffer resolution would be terribly low. Since we live in 2016 and have huge monitors, there is no reason to use 800x600 for your screen resolution. Yes, it's nice to keep your text editing to 79 columns, but these days we just do more than edit text in terminals (see tmux).

Anyway, to set a new console resolution in CentOS 7 with Xen kernel (on a dom0 of course), head over to /etc/default/grub.

sudo vim /etc/default/grub

If you are using Xen kernel, your grub config will will look like this:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=vg_centos/lv_root net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"
GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=1024M,max:1024M cpuinfo loglvl=all guest_loglvl=all console=tty0 console=ttys0,115200,8n1"
GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT="earlyprintk=xen nomodeset"

Edit the file so it looks like this:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=vg_centos/lv_root net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"
GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=1024M,max:1024M cpuinfo loglvl=all guest_loglvl=all"
GRUB_GFXMODE=1280x1024x24
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT="earlyprintk=xen xvga=1280x1024x24"

In this case we added the following lines:

GRUB_GFXMODE=1280x1024x24
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT="earlyprintk=xen xvga=1280x1024x24"

Generate the new grub config file in /boot:

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

You should see something like this:

 Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.18.34-20.el7.x86_64
Found initrd image: /boot/initramfs-3.18.34-20.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.18.34-20.el7.x86_64
Found initrd image: /boot/initramfs-3.18.34-20.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.18.34-20.el7.x86_64
Found initrd image: /boot/initramfs-3.18.34-20.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.18.34-20.el7.x86_64
Found initrd image: /boot/initramfs-3.18.34-20.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.18.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.18.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-6fd2512a035a4833ad4f450045344e92
Found initrd image: /boot/initramfs-0-rescue-6fd2512a035a4833ad4f450045344e92.img
done

Now what we've done is remove the console handling stuff (I don't use a serial console on my home hypervisor, but in a datacenter? Yes please!) and added the GRUB_GFXMODE and GRUB_GFXPAYLOAD settings. After rebooting the machine, you should see everything in a higher, crisper resolution on your monitor.


Comments

comments powered by Disqus