[Bug 859361] New: incorrect kernel-xen entries in grub.cfg
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c0 Summary: incorrect kernel-xen entries in grub.cfg Classification: openSUSE Product: openSUSE Factory Version: 13.2 Milestone 0 Platform: x86-64 OS/Version: Linux Status: NEW Severity: Major Priority: P5 - None Component: Bootloader AssignedTo: jsrain@suse.com ReportedBy: ohering@suse.com QAContact: jsrain@suse.com Found By: Outsourced Testing Blocker: --- Created an attachment (id=574881) --> (http://bugzilla.novell.com/attachment.cgi?id=574881) factory-bootloader-bug.tar.xz With current Factory grub.cfg gets bogus kernel-xen entries. kernel-xen is somehow the default, but can not be booted as such because the xen.xz entry is missing in cfg.cfg. There are additional correct entries for xen which can be booted. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c Jiri Srain <jsrain@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|jsrain@suse.com |mchang@suse.com -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c1 Charles Arnold <carnold@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |carnold@suse.com Olaf Hering <ohering@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|Major |Critical --- Comment #1 from Charles Arnold <carnold@suse.com> 2014-02-03 16:55:52 CET --- Same problem with SLE12 Alpha3 if the Xen pattern is selected. --- Comment #2 from Olaf Hering <ohering@suse.com> 2014-02-05 11:58:51 CET --- And I wonder why /etc/grub.d/20_linux_xen exists at all. All the work must be done in /etc/grub.d/10_linux. If a given vmlinu* is capable of being a dom0 then /boot/xen.gz must be added. If its pvops then perhaps the given file should be offered as native and (if xen.gz exists) also as dom0. Also, /boot/xen.gz is written again as /boot/xen-dbg-4.4.0_03-301.2.gz. which will break once xen.rpm is updated. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c Michael Chang <mchang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c4 --- Comment #4 from Michael Chang <mchang@suse.com> 2014-02-07 08:26:26 UTC --- (In reply to comment #2)
And I wonder why /etc/grub.d/20_linux_xen exists at all. All the work must be done in /etc/grub.d/10_linux. If a given vmlinu* is capable of being a dom0 then /boot/xen.gz must be added. If its pvops then perhaps the given file should be offered as native and (if xen.gz exists) also as dom0.
The 20_linux_xen is to group xen dom0 kernels (be it xenlinux kernel or pvops) in a submenu and boot the hypervisor (mainly with the multiboot protocol) with them. The 10_linux is used to group native or domU kernels bookable by linux stanza. The problem could be in 10_linux that trying to boot xenlinux kernel, I remember we had similar bug report in openSUSE and no idea why the regression happens so far. By the way, how to tell native, xenlinux and pvops kernel ? Is there any kernel configs could use ?
Also, /boot/xen.gz is written again as /boot/xen-dbg-4.4.0_03-301.2.gz. which will break once xen.rpm is updated.
This also sounds familiar .. :( -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c5 --- Comment #5 from Olaf Hering <ohering@suse.com> 2014-02-07 10:09:32 CET --- 10_linux makes the assumption that every vmlinu* can be booted "native". Thats certainly not true for our kernels. No idea if upstream can have a xen-only kernel. Lets assume it does not provide that feature. xenlinux seems to be PARAVIRT=n and XEN=y pvops seems to be PARAVIRT=y and XEN=y native seems to be PARAVIRT=y|n and XEN=y|n and in case of xenlinux/pvops, the code should check if it runs in dom0 or domU. In domU no /boot/xen.gz is required. I think 20_linux_xen can be skipped if running in domU. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c6 --- Comment #6 from Michael Chang <mchang@suse.com> 2014-02-07 10:09:29 UTC --- (In reply to comment #5)
10_linux makes the assumption that every vmlinu* can be booted "native". Thats certainly not true for our kernels. No idea if upstream can have a xen-only kernel. Lets assume it does not provide that feature.
It looks like a missing feature from upstream to me as well.
xenlinux seems to be PARAVIRT=n and XEN=y pvops seems to be PARAVIRT=y and XEN=y native seems to be PARAVIRT=y|n and XEN=y|n
and in case of xenlinux/pvops, the code should check if it runs in dom0 or domU.
Ok. And I found the regression is because grub2-fix-menu-in-xen-host-server.patch dropped the patch to 10_linux.in that fixed the problem in openSUSE while upgrading to upstream 2.02-beta2. It is a turnover and not intended. But I think we can make it better now by using kernel config rather than kernel flavor in file name. diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index e7a180e..a02bf17 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -150,15 +150,23 @@ EOF EOF } +# bnc#757895 - Grub2 menu items incorrect when "Xen Virtual Machines Host Server" selected +# check kernel's flavor to prevent xen kernel from booting natively without hypervisor +is_not_xen () +{ + flavor=`echo $1 | sed -e "s,.*-,,g"` + test "x$flavor" != xxen +} + machine=`uname -m` case "x$machine" in xi?86 | xx86_64) list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do - if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi + if grub_file_is_not_garbage "$i" && is_not_xen "$i" ; then echo -n "$i " ; fi done` ;; *) list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do - if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi + if grub_file_is_not_garbage "$i" && is_not_xen "$i" ; then echo -n "$i " ; fi done` ;; esa
In domU no /boot/xen.gz is required. I think 20_linux_xen can be skipped if running in domU.
Ok. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c7 --- Comment #7 from Olaf Hering <ohering@suse.com> 2014-02-07 11:44:43 CET --- (In reply to comment #6)
(In reply to comment #5)
xenlinux seems to be PARAVIRT=n and XEN=y pvops seems to be PARAVIRT=y and XEN=y native seems to be PARAVIRT=y|n and XEN=y|n
+is_not_xen ()
Yes, I think its better to look at the capabilities instead of relying on the name. My vmlinuz is called /boot/vmlinuz-3.12-xen-fate316071 for example. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c8 Michael Chang <mchang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO InfoProvider| |ohering@suse.com --- Comment #8 from Michael Chang <mchang@suse.com> 2014-02-12 08:28:28 UTC --- Hi Olaf, The testing package in available at home:michael-chang:branches:SUSE:SLE-12:GA/grub2 https://build.suse.de/package/show/home:michael-chang:branches:SUSE:SLE-12:G... Could you please help to verify the fix (in dom0 and domU) ? Btw, here is relevant (refreshed) patch. https://build.suse.de/package/view_file/home:michael-chang:branches:SUSE:SLE... Thanks. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c9 --- Comment #9 from Michael Chang <mchang@suse.com> 2014-02-13 04:31:23 UTC --- How do we determine we're running in HVM or PV xen guest, both all classified as domU. The identities used to know we're running as domU [ ! -e /proc/xen/xsd_port -a -e /proc/xen ] And I may make wrong assumption that it's PV (no HVM) in my above patch so native kernel is wrongly skipped ... Please help to clarify. Thanks. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c10 --- Comment #10 from Olaf Hering <ohering@suse.com> 2014-02-13 15:47:20 CET --- (In reply to comment #8)
Hi Olaf,
The testing package in available at
home:michael-chang:branches:SUSE:SLE-12:GA/grub2 https://build.suse.de/package/show/home:michael-chang:branches:SUSE:SLE-12:G...
I tested this package. First zypper dup to sles12:ga, then rpm -Fvh grub*rpm, then installed hypervisort and tools. The /etc/grub.d/10_linux section has no kernel-xen anymore, good. The /etc/grub.d/20_linux_xen section has /boot/xen-4.4.0_03-1.2.gz instead of xen.gz -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c11 --- Comment #11 from Olaf Hering <ohering@suse.com> 2014-02-17 22:55:26 CET --- (In reply to comment #9)
How do we determine we're running in HVM or PV xen guest, both all classified as domU.
A HVM guest runs kernel-default, there will be no kernel-xen. Its not possible to detect if a guest is HVM. Other than running xendetect from xen-tools-domU.rpm. This package is not installed per default, so grub can not rely on it. I will have a look how to solve this. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c12 --- Comment #12 from Michael Chang <mchang@suse.com> 2014-02-18 07:09:34 UTC --- Hi Olaf, Could you also help me to clarify what if a partition or lv is dual-boot natively and virtualized (as xen domU pv guest) ? Does such setup make sense and does we support it? If that's something we have to consider, then 10_linux should provide both native and xen kernel in the same time (as what we have now) .. the problem is how do we know or detect such setup ? Thanks. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c13 Olaf Hering <ohering@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED InfoProvider|ohering@suse.com | --- Comment #13 from Olaf Hering <ohering@suse.com> 2014-02-20 10:21:35 CET --- I think its possible to have a single disk image for several VM types, for testing purpose. But nothing in our code actually takes care of such setup. So the code should take care of the following: native (includes KVM and Hyper-V guest) native dom0 xen PV dom0 xen PV domU xen HVM xen HVM is like native, expect that it has /proc/xen. Look at /lib/mkinitrd/scripts/setup-fv_guest.sh. One possible method of detection is to see if /sys/class/dmi/id exists. If it does exist and product_name == "HVM domU" and sys_vendor == "Xen", then its HVM and just kernel-default has to be considered. Maybe one day HVM can do nested virt and maybe it would be possible to run dom0 inside a HVM guest. If thats ever possible, I'm sure there will be other attributes to check for that. For the time being the check above is good. xen PV domU or dom0 can be found by /proc/xen/capabilities, if it contains "control_d" its a dom0. Otherwise its a domU. and native dom0 can be found by checking if the kernel can actually act as a dom0, by looking at its .config. There are probably ways to poke around in the binary and look for certain capabilities, but that requires additional tools to extract that info. Does that answer the question? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c14 --- Comment #14 from Michael Chang <mchang@suse.com> 2014-02-21 11:00:25 UTC --- (In reply to comment #13)
I think its possible to have a single disk image for several VM types, for testing purpose. But nothing in our code actually takes care of such setup.
Ok. Good to know that we don't have to deal with such setup and could concentrate on one vm type booting scenario for a single disk. (so question comment#12 closed.)
So the code should take care of the following:
native (includes KVM and Hyper-V guest) native dom0 xen PV dom0 xen PV domU xen HVM
xen HVM is like native, expect that it has /proc/xen. Look at /lib/mkinitrd/scripts/setup-fv_guest.sh. One possible method of detection is to see if /sys/class/dmi/id exists. If it does exist and product_name == "HVM domU" and sys_vendor == "Xen", then its HVM and just kernel-default has to be considered.
I will setup a xen HVM guest to test and verify it. And adding the check in my patch for HVM .. (so question on comment#9 can be closed ).
Maybe one day HVM can do nested virt and maybe it would be possible to run dom0 inside a HVM guest. If thats ever possible, I'm sure there will be other attributes to check for that. For the time being the check above is good.
Ok. Thanks to confirmation. So will keep 20_linux_xen skipped on domU.
xen PV domU or dom0 can be found by /proc/xen/capabilities, if it contains "control_d" its a dom0. Otherwise its a domU.
So could you please pointer me what is recommended check now? if /proc/xen/capabilities not exist native elif /proc/xen/capabilities has control_d dom0 else domU (PV/HVM) if [ ! -e /proc/xen/xsd_port -a -e /proc/xen ] # domU (PV/HVM) elif [ -e /proc/xen/xsd_port -a -e /proc/xen ] # dom0 else # native
and native dom0 can be found by checking if the kernel can actually act as a dom0, by looking at its .config. There are probably ways to poke around in the binary and look for certain capabilities, but that requires additional tools to extract that info.
Looks like has been done in the current patch.
Does that answer the question?
Should I change to /proc/xen/capabilities for checking domU/dom0 ? :) Thanks, Michael -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c15 Michael Chang <mchang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.2 Milestone 0 --- Comment #15 from Michael Chang <mchang@suse.com> 2014-02-24 11:17:51 UTC --- The sr to openSUSE factory has ben created srid#223665 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c16 Michael Chang <mchang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |eich@suse.com --- Comment #16 from Michael Chang <mchang@suse.com> 2014-02-26 10:55:41 UTC --- *** Bug 865565 has been marked as a duplicate of this bug. *** http://bugzilla.novell.com/show_bug.cgi?id=865565 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c18 --- Comment #18 from Bernhard Wiedemann <bwiedemann@suse.com> 2014-03-03 11:00:13 CET --- This is an autogenerated message for OBS integration: This bug (859361) was mentioned in https://build.opensuse.org/request/show/224389 Factory / grub2 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=859361 https://bugzilla.novell.com/show_bug.cgi?id=859361#c19 Michael Chang <mchang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #19 from Michael Chang <mchang@suse.com> 2014-03-12 08:40:18 UTC --- This is fixed. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com