Bug 755719

Summary: grub2-mkconfig fails if current kernel booted without initrd
Product: [Fedora] Fedora Reporter: Konstantin Svist <fry.kun>
Component: grub2Assignee: Peter Jones <pjones>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: dennis, mads, pjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-22 23:30:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
output of 10_linux
none
requested log none

Description Konstantin Svist 2011-11-21 21:04:06 UTC
Description of problem:
I have a modified entry in my grub.cfg to shorted the boot time (since my non-LVM partition is easily accessible without initrd):
linux ... root=/dev/sda2 rootfstype=ext4 ...
<removed initrd line>

When this kernel is booted, grub2-mkconfig fails with the following error:
/sbin/grub2-probe: error: cannot stat `/dev/root'.


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

How reproducible:
every time

Steps to Reproduce:
1. Alter grub.cfg to remove initrd, reboot
2. Try updating grub.cfg automatically (grub2-mkconfig or yum update/grubby)
3.
  
Actual results:
grub.cfg is not updated

Expected results:
grub.cfg should be updated

Additional info:
This makes it hard to run yum update -- new kernel is not added to the list of bootable choices


I realize this is pretty low priority since most users don't change their grub.cfg by hand, but it's probably pretty easy to fix

Comment 1 Mads Kiilerich 2011-11-22 19:56:44 UTC
Please attach the log from
  bash -x /etc/grub.d/10_linux > /dev/null 2> log

The grub2-mkconfig failure is one thing, but it is not involved in kernel updates.

The kernel installation script uses grubby to clone the latest good kernel entry. I think it is fair enough that grubby consider a kernel entry without initrd something special that it shouldn't look at.

Comment 2 Konstantin Svist 2011-11-22 21:39:35 UTC
Created attachment 535201 [details]
output of 10_linux

Right, I think grubby problem is a separate bug. When it runs, it says "no suitable template found" although there are plenty of suitable examples (it's just that the currently booted one is "not suitable"). But grub2-mkconfig doesn't/shouldn't care about those things. Near as I can tell it just inserts all available kernels into grub.cfg...

Anyway, the log is attached.
Note: I've modified 10_linux a little bit, to generate an extra line without initrd. Here's the diff:

diff 10_linux.orig /etc/grub.d/10_linux
197a198,205
>   ## Kostya: once more, with feeling [[[[
>   initrd=
>   initramfs=
>   linux_root_device_thisversion=${GRUB_DEVICE}
>   linux_entry "OPTIMIZED ${OS}" "${version}" false \
>       "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
>   ## ]]]]
>

Comment 3 Mads Kiilerich 2011-11-22 22:03:25 UTC
grubby is run on everything that looks like a boot loader, "no suitable template found" will usually come from that.

I requested a bad log. Instead please try to insert 'set -x' in 10_linux and run
  bash -x grub2-mkconfig 2> log

Comment 4 Konstantin Svist 2011-11-22 22:20:08 UTC
Created attachment 535214 [details]
requested log

diff 10_linux.orig /etc/grub.d/10_linux
1a2
> set -x
196a198,205
> 
>   ## Kostya: once more, with feeling [[[[
>   initrd=
>   initramfs=
>   linux_root_device_thisversion=${GRUB_DEVICE}
>   linux_entry "OPTIMIZED ${OS}" "${version}" false \
>       "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
>   ## ]]]]

Comment 5 Konstantin Svist 2011-11-22 23:20:53 UTC
Oops, looks like this is a known bug already: https://bugzilla.redhat.com/show_bug.cgi?id=737370

Comment 6 Mads Kiilerich 2011-11-22 23:30:50 UTC
Yes, I will mark this as a duplicate.

The error message come from a failing "/sbin/grub2-probe --target=device /"

*** This bug has been marked as a duplicate of bug 737370 ***