Bug 1189217

Summary: grubby is unnecessarily terse -- provide better diagnostic message
Product: Red Hat Enterprise Linux 7 Reporter: R P Herrold <herrold>
Component: grubbyAssignee: Peter Jones <pjones>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-12 19:15:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description R P Herrold 2015-02-04 17:17:33 UTC
Description of problem:

grubby has too many opaque failure conditions under a single error message; the admin needs more help; start to help

see also https://bugzilla.redhat.com/show_bug.cgi?id=124246

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

8.28-8.el7

How reproducible:

run updates via yum, and have a grubby failure


Steps to Reproduce:

yum -y upgrade 

(from an initial media install)


Actual results:

the unhelpful message:  
   grubby fatal error: unable to find a suitable template

is seen, and the kernels present do not match the kernels known to grub2
kernel-3.10.0-123.13.2.el7.x86_64 and kernel-3.10.0-123.13.1.el7.x86_64  are NOT reflected to grub2


addressed locally by inventorying and removing the two failed kernels

 cat /boot/grub2/grub.cfg | grep vmlinuz

to see the 'installed' kernels , and so by a process of elimination, identifying failed ones

then:

[root@vm010004029 ~]# rpm -e kernel-3.10.0-123.13.2.el7.x86_64 kernel-3.10.0-123.13.1.el7.x86_64                                                                
warning: file /lib/modules/3.10.0-123.13.1.el7.x86_64/weak-updates: remove failed: No such file or directory                                                    
warning: file /lib/modules/3.10.0-123.13.1.el7.x86_64/modules.softdep: remove failed: No such file or directory                                                 
warning: file /lib/modules/3.10.0-123.13.1.el7.x86_64/modules.devname: remove failed: No such file or directory                                                 
warning: file /lib/modules/3.10.0-123.13.2.el7.x86_64/weak-updates: remove failed: No such file or directory                                                    
warning: file /lib/modules/3.10.0-123.13.2.el7.x86_64/modules.softdep: remove failed: No such file or directory
warning: file /lib/modules/3.10.0-123.13.2.el7.x86_64/modules.devname: remove failed: No such file or directory
[root@vm010004029 ~]#

as well as then re-building the effective grub.cfg file

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

thus:

[root@vm010004029 grub2]# grub2-mkconfig -o  /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.20.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.20.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.9.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.9.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-16290318d1874648e91e93d3be661d78
Found initrd image: /boot/initramfs-0-rescue-16290318d1874648e91e93d3be661d78.img
done




Expected results:

better diagnostic availability -- adding the ''debug is a start -- obviously more by way of succestions is useful as well


Additional info:

This was suggested years ago in a horror story of a bug: 
https://bugzilla.redhat.com/show_bug.cgi?id=723626

Comment 101 Eric Sandeen 2012-09-23 11:01:02 EDT

but I do not find that his patch ever made it into grubby.c

simple patch (inlined as it is a single line:

[herrold@centos-6 grubby]$ git diff
diff --git a/grubby.c b/grubby.c
index 3ee6c98..1347d13 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2151,7 +2151,7 @@ struct singleEntry * findTemplate(struct grubConfig * cfg,
        index++;
     }

-    fprintf(stderr, _("grubby fatal error: unable to find a suitable template\n
+    fprintf(stderr, _("grubby fatal error: unable to find a suitable template;

     return NULL;
 }

=============

environment:
vmlinuz-3.10.0-123.13.1.el7.x86_64                     
vmlinuz-3.10.0-123.13.2.el7.x86_64                     
vmlinuz-3.10.0-123.20.1.el7.x86_64                     
vmlinuz-3.10.0-123.9.3.el7.x86_64                      
vmlinuz-3.10.0-123.el7.x86_64                          
[root@vm010004029 ~]# rpm -qa kernel                   
kernel-3.10.0-123.9.3.el7.x86_64                       
kernel-3.10.0-123.13.2.el7.x86_64                      
kernel-3.10.0-123.20.1.el7.x86_64                      
kernel-3.10.0-123.el7.x86_64                           
kernel-3.10.0-123.13.1.el7.x86_64                      
[root@vm010004029 ~]# uname -a                         
Linux vm010004029.first.owlriver.net 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Comment 2 Peter Jones 2015-03-12 19:05:35 UTC
There's debug information for what the template candidates are and such in /var/log/grubby , including the output from the patch you reference from Eric Sandeen.

Comment 3 RHEL Program Management 2015-03-12 19:15:53 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.