Bug 1108498 - ks_meta "grubport=" is ignored on UEFI-based system
Summary: ks_meta "grubport=" is ignored on UEFI-based system
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: lab controller
Version: 0.16
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 0.18
Assignee: Dan Callaghan
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-12 07:01 UTC by Jun'ichi NOMURA
Modified: 2018-02-06 00:41 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-04 05:40:30 UTC
Embargoed:


Attachments (Terms of Use)

Description Jun'ichi NOMURA 2014-06-12 07:01:15 UTC
Description of the problem:
ks_meta "grubport=" is expected to be translated into "--port=" option of grub. However, it does not happen on UEFI-based systems.
"grubport=" is used for systems where "--port=" grub option is necessary for reliable specification of serial port.

Version-Release number of selected component (if applicable):
beaker-0.16.1-1.el6eng.noarch

How reproducible:
Always on UEFI-based system

Steps to Reproduce:
1. Add "grubport=0x2f8" for systems's "Kickstart Metadata"
2. Provision the system
3. Check grub configuration

Actual behavior:
grub config file (*) does not contain "--port=0x2f8" option
(*) config file path
    - /boot/efi/EFI/redhat/grub.conf (grub1, e.g. RHEL6)
    - /boot/efi/EFI/redhat/grub.cfg (grub2, e.g. RHEL7)

Expected behavior:
grub config file should contain "--port=0x2f8" option


Additional Information:

rhts_post snippet handles "grubport=". The snippet tries to apply the "--port=" change to appropriate grub config file. However, it misses the fact that the config file location is different on legacy BIOS system and UEFI system.

The problem can be fixed by the following patch.
Tested on RHEL6.5 and RHEL7.0, for both legacy BIOS system and UEFI system.

--- a/rhts_post	2014-03-26 00:16:45.000000000 -0400
+++ b/rhts_post	2014-06-11 21:04:08.000000000 -0400
@@ -70,11 +70,21 @@ fi
 {#
 #/bin/sed -i 's/^serial.*/serial --port={{ grubport }} --speed=115200/' /boot/grub/grub.conf
 #}
-if [ -e "/boot/grub/grub.conf" ]; then
-    /bin/sed -i 's/^\(serial.*\)--unit=\S\+\(.*\)$/\1--port={{ grubport }}\2/' /boot/grub/grub.conf
+if [ -e "/boot/grub/grub.conf" -o -e "/boot/efi/EFI/redhat/grub.conf" ]; then
+    if [ -d "/sys/firmware/efi" ]; then
+        GRUBCONF="/boot/efi/EFI/redhat/grub.conf"
+    else
+        GRUBCONF="/boot/grub/grub.conf"
+    fi
+    /bin/sed -i 's/^\(serial.*\)--unit=\S\+\(.*\)$/\1--port={{ grubport }}\2/' $GRUBCONF
 elif [ -e "/etc/default/grub" ]; then
+    if [ -d "/sys/firmware/efi" ]; then
+        GRUBCONF="/boot/efi/EFI/redhat/grub.cfg"
+    else
+        GRUBCONF="/boot/grub2/grub.cfg"
+    fi
     /bin/sed -i '/^GRUB_SERIAL_COMMAND="serial/ {s/--unit=[0-9]\+//; s/"$/ --port={{ grubport }}"/}' /etc/default/grub
-    /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
+    /sbin/grub2-mkconfig -o $GRUBCONF
 fi
 {% endif %}

Comment 2 Dan Callaghan 2014-08-08 02:11:17 UTC
Thanks for the patch, Jun'ichi!

I used a slightly different, more brute force approach here (sed every GRUB config we can find). Also split into a new snippet for convenience, and added some docs.

http://gerrit.beaker-project.org/3238

Comment 7 Dan Callaghan 2014-09-04 05:40:30 UTC
This bug fix was applied to the release-0.17 branch, but we are not doing any more maintenance releases of the 0.17.x series. So this bug is fixed in Beaker 0.18.0.


Note You need to log in before you can comment on or make changes to this bug.