From dd3ad7e0148d60e098698538b42bd525f1d27030 Mon Sep 17 00:00:00 2001 From: Abel Lopez Date: Fri, 22 Aug 2014 11:12:24 -0700 Subject: [PATCH] Changed serial console setup The previous method only configured serial console for Ubuntu or Fedora, I noticed this wasn't working when I built RedHat 7. After reading about how grub-mkconfig works, I realized that we shouldn't be using sed to modify grub.cfg, and set up the proper variables in /etc/default/grub Change-Id: I02b73dc5074cb48a716849cb8a8a9b2f054bea31 --- elements/vm/finalise.d/51-bootloader | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/elements/vm/finalise.d/51-bootloader b/elements/vm/finalise.d/51-bootloader index 20fc01b9..602c2dec 100755 --- a/elements/vm/finalise.d/51-bootloader +++ b/elements/vm/finalise.d/51-bootloader @@ -120,8 +120,10 @@ function install_grub2 { DIST=`lsb_release -is` [ -n "$DIST" ] - echo 'GRUB_TERMINAL=console' >>/etc/default/grub + echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub echo 'GRUB_GFXPAYLOAD_LINUX=text' >>/etc/default/grub + echo 'GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200"' >>/etc/default/grub + echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub GRUB_MKCONFIG="grub2-mkconfig -o $GRUB_CFG" case $DIST in 'Ubuntu'|'Debian') @@ -151,10 +153,6 @@ function install_grub2 { sed -i "s%$PART_DEV%LABEL=cloudimg-rootfs%" $GRUB_CFG sed -i "s%search --no-floppy --fs-uuid --set=root .*$%search --no-floppy --set=root --label cloudimg-rootfs%" $GRUB_CFG sed -i "s%root=UUID=[A-Za-z0-9\-]*%root=LABEL=cloudimg-rootfs%" $GRUB_CFG - if [ "$DIST" = 'Debian' ] || [ "$DIST" = 'Fedora' ]; then - # enable serial console - sed -i "s%LABEL=cloudimg-rootfs%LABEL=cloudimg-rootfs console=tty0 console=ttyS0,115200%" $GRUB_CFG - fi if [ "$DIST" = 'Fedora' ] ; then if [ $(lsb_release -rs) = '19' ]; then sed -i "s%UUID=[A-Za-z0-9\-]*%LABEL=cloudimg-rootfs%" /etc/fstab