Bug 1571621 - [RFE] Satellite-installer tftpboot/grub2/grub.cfg inconsistent with build pxe grub.cfg - please align
Summary: [RFE] Satellite-installer tftpboot/grub2/grub.cfg inconsistent with build pxe...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installer
Version: 6.3.1
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Perry Gagne
URL:
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2018-04-25 08:44 UTC by Nikola Kresic
Modified: 2019-06-10 13:06 UTC (History)
6 users (show)

Fixed In Version: foreman-installer-1.16.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-10 13:06:43 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Nikola Kresic 2018-04-25 08:44:42 UTC
Description of problem:
tftpboot/grub2/grub.cfg from Sat installer and the one from pxe are not the same

----------
 WARN 2018-03-05 10:28:57 verbose]  /Stage[main]/Apache::Service/Service[httpd]: Triggered 'refresh' from 2 events
[ WARN 2018-03-05 10:29:03 verbose]  /Stage[main]/Foreman_proxy::Tftp/File[/var/lib/tftpboot/grub2/grub.cfg]/content:
[ WARN 2018-03-05 10:29:03 verbose] --- /var/lib/tftpboot/grub2/grub.cfg        2018-03-02 07:49:31.981133811 +0000
[ WARN 2018-03-05 10:29:03 verbose] +++ /tmp/puppet-file20180305-10948-tlmddz   2018-03-05 10:29:03.482473496 +0000
[ WARN 2018-03-05 10:29:03 verbose] @@ -1,72 +1,8 @@
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -default=0
[ WARN 2018-03-05 10:29:03 verbose] -timeout=20
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -# On Debian/Ubuntu grub2 does not have patch for loading MAC-based configs. Also due to bug
[ WARN 2018-03-05 10:29:03 verbose] -# in RHEL 7.4 files are loaded with an extra ":" character at the end. This workarounds both
[ WARN 2018-03-05 10:29:03 verbose] -# cases, make sure "regexp.mod" file is present on the TFTP. For more info see:
[ WARN 2018-03-05 10:29:03 verbose] -# https://bugzilla.redhat.com/show_bug.cgi?id=1370642#c70
[ WARN 2018-03-05 10:29:03 verbose]  insmod regexp
[ WARN 2018-03-05 10:29:03 verbose] -regexp --set=1:m1 --set=2:m2 --set=3:m3 --set=4:m4 --set=5:m5 --set=6:m6 '^([[:xdigit:]]{1,2})\:([[:xdigit:]]{1,2})\:([[:xdigit:]]{1{1,2})\:([[:xdigit:]]{1,2})\:([[:xdigit:]]{1,2})' "$net_default_mac"
[ WARN 2018-03-05 10:29:03 verbose] -mac=${m1}-${m2}-${m3}-${m4}-${m5}-${m6}
[ WARN 2018-03-05 10:29:03 verbose] -configfile=/grub2/grub.cfg-01-$mac
[ WARN 2018-03-05 10:29:03 verbose] -source "$configfile"
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -menuentry "Chainload Grub2 EFI from ESP" {
[ WARN 2018-03-05 10:29:03 verbose] -  unset root
[ WARN 2018-03-05 10:29:03 verbose] -  echo Chainloading Grub2 EFI from ESP, available devices:
[ WARN 2018-03-05 10:29:03 verbose] -  ls
[ WARN 2018-03-05 10:29:03 verbose] -  echo -n "Probing ESP partition ... "
[ WARN 2018-03-05 10:29:03 verbose] -  search --file --no-floppy --set=root /EFI/BOOT/BOOTX64.EFI
[ WARN 2018-03-05 10:29:03 verbose] -  echo found $root
[ WARN 2018-03-05 10:29:03 verbose] -  sleep 2
[ WARN 2018-03-05 10:29:03 verbose] -  if [ -f ($root)/EFI/BOOT/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/BOOT/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -  elif [ -f ($root)/EFI/fedora/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/fedora/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -  elif [ -f ($root)/EFI/redhat/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/redhat/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -  elif [ -f ($root)/EFI/centos/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/centos/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -  elif [ -f ($root)/EFI/debian/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/debian/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -  elif [ -f ($root)/EFI/ubuntu/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/ubuntu/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -  elif [ -f ($root)/EFI/Microsoft/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/Microsoft/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -  elif [ -f ($root)/EFI/EFI/grubx64.efi ]; then
[ WARN 2018-03-05 10:29:03 verbose] -    chainloader ($root)/EFI/EFI/grubx64.efi
[ WARN 2018-03-05 10:29:03 verbose] -    else
[ WARN 2018-03-05 10:29:03 verbose] -    echo File grubx64.efi not found on ESP.
[ WARN 2018-03-05 10:29:03 verbose] -    echo Update 'pxegrub2_chainload' paths array with:
[ WARN 2018-03-05 10:29:03 verbose] -    ls ($root)/EFI
[ WARN 2018-03-05 10:29:03 verbose] -    echo The system will halt in 2 minutes or
[ WARN 2018-03-05 10:29:03 verbose] -    echo press ESC to halt immediately.
[ WARN 2018-03-05 10:29:03 verbose] -    sleep -i 120
[ WARN 2018-03-05 10:29:03 verbose] -    halt --no-apm
[ WARN 2018-03-05 10:29:03 verbose] -  fi
[ WARN 2018-03-05 10:29:03 verbose] -}
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -menuentry "Chainload into BIOS bootloader on first disk" {
[ WARN 2018-03-05 10:29:03 verbose] -  set root=(hd0,0)
[ WARN 2018-03-05 10:29:03 verbose] -  chainloader +1
[ WARN 2018-03-05 10:29:03 verbose] -}
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose] -menuentry 'Foreman Discovery Image' {
[ WARN 2018-03-05 10:29:03 verbose] -  linuxefi boot/fdi-image-rhel_7-vmlinuz rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=https://li-lc-1578.hag.hilti.com proxy.type=foreman BOOTIF=01-$mac
[ WARN 2018-03-05 10:29:03 verbose] -  initrdefi boot/fdi-image-rhel_7-img
[ WARN 2018-03-05 10:29:03 verbose] -}
[ WARN 2018-03-05 10:29:03 verbose] -
[ WARN 2018-03-05 10:29:03 verbose]
[ WARN 2018-03-05 10:29:03 verbose] +set net_pxe_mac=$net_default_mac
[ WARN 2018-03-05 10:29:03 verbose] +regexp --set=1:m1 --set=2:m2 --set=3:m3 --set=4:m4 --set=5:m5 --set=6:m6 '^([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a]{1,2})\:([0-9a-f]{1,2})' "$net_default_mac"
[ WARN 2018-03-05 10:29:03 verbose] +mac_dashed=${m1}-${m2}-${m3}-${m4}-${m5}-${m6}
[ WARN 2018-03-05 10:29:03 verbose]
[ WARN 2018-03-05 10:29:03 verbose] +mac_configfile=$prefix/grub.cfg-01-$mac_dashed
[ WARN 2018-03-05 10:29:03 verbose] +source "$mac_configfile"
[ INFO 2018-03-05 10:29:03 verbose]  Computing checksum on file /var/lib/tftpboot/grub2/grub.cfg
[ INFO 2018-03-05 10:29:03 verbose]  /Stage[main]/Foreman_proxy::Tftp/File[/var/lib/tftpboot/grub2/grub.cfg]: Filebucketed /var/lib/tftpboot/grub2/grub.cfg to puppet witc9647a23d2e03642815
[ WARN 2018-03-05 10:29:03 verbose]  /Stage[main]/Foreman_proxy::Tftp/File[/var/lib/tftpboot/grub2/grub.cfg]/content: content changed '{md5}20ede7cd73d96c9647a23d2e03642dc46ac4c66faadf356ce99114c0'
---------------

-----------
[crash/LI] root@li-lc-1578:~# sudo -u hoici hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml template build-pxe-default
PXE files for templates PXEGrub2 global default, HOI PXELinux menu, and PXEGrub global default have been deployed to all Capsules

[crash/LI] root@li-lc-1578:~# cat /var/lib/tftpboot/grub2/grub.cfg



default=0
timeout=20

# On Debian/Ubuntu grub2 does not have patch for loading MAC-based configs. Also due to bug
# in RHEL 7.4 files are loaded with an extra ":" character at the end. This workarounds both
# cases, make sure "regexp.mod" file is present on the TFTP. For more info see:
# https://bugzilla.redhat.com/show_bug.cgi?id=1370642#c70
insmod regexp
regexp --set=1:m1 --set=2:m2 --set=3:m3 --set=4:m4 --set=5:m5 --set=6:m6 '^([[:xdigit:]]{1,2})\:([[:xdigit:]]{1,2})\:([[:xdigit:]]{1,2})\:([[:xdigit:]]{1,2})\:([[:xdigit:]]{1,2})\:([[:xdigit:]]{1,2})' "$net_default_mac"
mac=${m1}-${m2}-${m3}-${m4}-${m5}-${m6}
configfile=/grub2/grub.cfg-01-$mac
source "$configfile"


menuentry "Chainload Grub2 EFI from ESP" {
  unset root
  echo Chainloading Grub2 EFI from ESP, available devices:
  ls
  echo -n "Probing ESP partition ... "
  search --file --no-floppy --set=root /EFI/BOOT/BOOTX64.EFI
  echo found $root
  sleep 2
  if [ -f ($root)/EFI/BOOT/grubx64.efi ]; then
    chainloader ($root)/EFI/BOOT/grubx64.efi

  elif [ -f ($root)/EFI/fedora/grubx64.efi ]; then
    chainloader ($root)/EFI/fedora/grubx64.efi

  elif [ -f ($root)/EFI/redhat/grubx64.efi ]; then
    chainloader ($root)/EFI/redhat/grubx64.efi

  elif [ -f ($root)/EFI/centos/grubx64.efi ]; then
    chainloader ($root)/EFI/centos/grubx64.efi

  elif [ -f ($root)/EFI/debian/grubx64.efi ]; then
    chainloader ($root)/EFI/debian/grubx64.efi

  elif [ -f ($root)/EFI/ubuntu/grubx64.efi ]; then
    chainloader ($root)/EFI/ubuntu/grubx64.efi

  elif [ -f ($root)/EFI/Microsoft/grubx64.efi ]; then
    chainloader ($root)/EFI/Microsoft/grubx64.efi

  elif [ -f ($root)/EFI/EFI/grubx64.efi ]; then
    chainloader ($root)/EFI/EFI/grubx64.efi
    else
    echo File grubx64.efi not found on ESP.
    echo Update 'pxegrub2_chainload' paths array with:
    ls ($root)/EFI
    echo The system will halt in 2 minutes or
    echo press ESC to halt immediately.
    sleep -i 120
    halt --no-apm
  fi
}

menuentry "Chainload into BIOS bootloader on first disk" {
  set root=(hd0,0)
  chainloader +1
}


menuentry 'Foreman Discovery Image' {
  linuxefi boot/fdi-image-rhel_7-vmlinuz rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=https://li-lc-1578.hag.hilti.com proxy.type=foreman BOOTIF=01-$mac
  initrdefi boot/fdi-image-rhel_7-img
}

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.
2.
3.

Actual results:
There is a difference between the files

Expected results:
Same content of the files

Additional info:
This has passed our testing because both files seem to work. We should still have the content aligned to avoid confusion.

Comment 1 Lukas Zapletal 2018-04-25 11:12:31 UTC
Fixed for Satellite 6.4: https://github.com/theforeman/puppet-foreman_proxy/pull/365

In 6.4 puppet will never replace this file, unless told via --foreman-proxy-tftp-replace-grub2-cfg true installer option.

Comment 3 Ewoud Kohl van Wijngaarden 2018-04-25 11:24:03 UTC
It's correct that https://github.com/theforeman/puppet-foreman_proxy/commit/077a72046553a8ca53fea7a92eea9ca8dd8b1735 (which is the merged commit from PR 365) does fix it.

Comment 5 Peter Vreman 2018-10-17 16:12:15 UTC
Confirming this is fixed in Sat6.4

Comment 6 Brad Buckingham 2018-10-17 16:27:09 UTC
Peter, you are correct.  The code changes referenced by comment 1 / 3 are included with the Satellite 6.4 release.

Comment 8 Perry Gagne 2019-02-14 16:06:31 UTC
Verified fix in Sat 6.4.2 GA 


Satellite installer does not replace grub.cfg file created by "Build PXE Defaults" unless told to by using --foreman-proxy-tftp-replace-grub2-cfg true

Comment 9 Peter Vreman 2019-03-12 14:56:50 UTC
The 6.4.2 is released Can this BZ not be closed?

Comment 10 Brad Buckingham 2019-06-10 13:06:43 UTC
Confirmed that fix is present in 6.4.2 and 6.5.0.


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