-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use grub2-install --no-nvram on PowerNV system #1742
Conversation
# Do not update nvram when system is running in PowerNV mode (BareMetal). | ||
# grub2-install will failed if not run with the --no-nvram option on a PowerNV system. | ||
# see https://github.com/rear/rear/pull/1742 | ||
if [[ $(awk '/platform/ {print $NF}' < /proc/cpuinfo) == PowerNV ]] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot reproduce this condition on my x86_64 system (there is no 'platform' in /proc/cpuinfo)
but what I can reproduce there is e.g.:
# awk '/vendor_id/ {print $NF}' < /proc/cpuinfo GenuineIntel GenuineIntel GenuineIntel GenuineIntel GenuineIntel GenuineIntel GenuineIntel GenuineIntel
I get 8 lines because I have a 2 CPUs with 4 cores each
but when there is more than one line found
the condition does no longer result true:
# if [[ $( awk '/vendor_id/ {print $NF}' < /proc/cpuinfo ) == GenuineIntel ]] ; then echo Y ; else echo N ; fi N
Bottom line:
The current condition is not fail-safe against multiple 'platform' lines.
Usually I use an artificial bash array to get a field at a know position
out of the first line of possibly several output lines like:
# vendor_id_lines=( $( grep '^vendor_id' /proc/cpuinfo ) ) # for element in "${vendor_id_lines[@]}" ; do echo "'$element'" ; done 'vendor_id' ':' 'GenuineIntel' 'vendor_id' ':' 'GenuineIntel' 'vendor_id' ':' 'GenuineIntel' 'vendor_id' ':' 'GenuineIntel' 'vendor_id' ':' 'GenuineIntel' 'vendor_id' ':' 'GenuineIntel' 'vendor_id' ':' 'GenuineIntel' 'vendor_id' ':' 'GenuineIntel' # if test "${vendor_id_lines[2]}" = "GenuineIntel" ; then echo Y ; fi Y
But this only works when the wanted value
is at a known fixed position/index in the array.
E.g. it cannot be used to test for one of the many CPU flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsmeix ,
on Power, platform is printed only one time at the end:
processor : 0
cpu : POWER8 (raw), altivec supported
clock : 2061.000000MHz
revision : 2.0 (pvr 004d 0200)
[...]
processor : 152
cpu : POWER8 (raw), altivec supported
clock : 2061.000000MHz
revision : 2.0 (pvr 004d 0200)
timebase : 512000000
platform : PowerNV
model : 8001-22C
machine : PowerNV 8001-22C
firmware : OPAL v3
We can also protect it by checking only the first line returned:
if [[ $(awk '/platform/ {print $NF}' < /proc/cpuinfo | head -n1 ) == PowerNV ]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schabrolles
feel free to implement it as you like.
When it can appear at most one time it is also o.k. as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except my generic comment where I cannot know
if it may actually matter in this case
it looks o.k. from plain looking at the code.
Relax-and-Recover (ReaR) Pull Request Template
Please fill in the following items before submitting a new pull request:
Pull Request Details:
Type: Bug Fix
Impact: Normal
Reference to related issue (URL): Rescue system start hangup for RHEL 7.4 on PPC 64 LE Power8 BareMetal (Petitboot v1.4.4) #1710
https://www.suse.com/fr-fr/support/update/announcement/2017/suse-ru-20170617-1/
How was this pull request tested?
Tested on RHEL 7 BareMetal (PowerNV) [ReaR Backup + restore with NFS+PXE]
Tested on RHEL 7 KVM Guest for non-regression test [ReaR Backup + restore with NFS+PXE]
Tested on RHEL 7 LPAR (PowerVM) for non-regression test [ReaR Backup + restore with NFS+PXE]
Brief description of the changes in this pull request:
Problem description: grub2-install failed on PowerNV (BareMetal System).
grub2-install for power (ppc64le) always try to update firmware boot order during grub2-install by using
ofpathname
command. Unfortunatly, thisofpathname
command is not supported on BareMetal system (PowerNV). (https://www.suse.com/fr-fr/support/update/announcement/2017/suse-ru-20170617-1/).Using
--no-nvram
grub2-install option is a workaround for PowerNV system.