update-grub thinks my kernel is a xen one

Bug #692691 reported by Brian Murray on 2010-12-20
56
This bug affects 10 people
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
High
Colin Watson
Lucid
High
Steve Langasek
Natty
High
Colin Watson

Bug Description

SRU justification:
The version of grub included in lucid has code for detecting Xen-only kernels which misfires on later kernel releases, where Xen guest support may be built into a kernel that can also be run on bare hardware. The distro kernels for natty and later are built in precisely this way, which means that the LTS backport kernels for natty and oneiric are also built this way - making it impossible to use these backported kernels on a 10.04 LTS system that's using grub 1 as its bootloader.

Test case:
1. Configure 10.04 LTS with grub as its bootloader.
2. Install the linux-image-server-lts-backport-oneiric package. Observe that the newly installed kernel is ignored by update-grub as in the below messages.
3. Install the grub package from lucid-proposed. Observe that the 3.0.0 kernel is no longer ignored by update-grub.

Binary package hint: grub

I noticed I'm not running that latest kernel and it seems that update-grub doesn't like the newest ones I have available.

10:49:13 - flash:[~/source-trees/apport/natty] sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... found: /boot/grub/splash.xpm.gz
grep: /boot/config: No such file or directory
grep: /boot/config.old: No such file or directory
Ignoring Xen kernel on non-Xen host: vmlinuz-2.6.37-10-generic
Ignoring Xen kernel on non-Xen host: vmlinuz-2.6.37-9-generic
Ignoring Xen kernel on non-Xen host: vmlinuz-2.6.37-8-generic
Found kernel: /vmlinuz-2.6.37-7-generic
Found kernel: /vmlinuz-2.6.32-24-generic
Found kernel: /vmlinuz-2.6.32-23-generic
Found kernel: /vmlinuz-2.6.32-22-generic
Found kernel: /vmlinuz-2.6.32-21-generic
Found kernel: /vmlinuz-2.6.32-19-generic
Found kernel: /vmlinuz-2.6.32-17-generic
Found kernel: /vmlinuz-2.6.32-15-generic
Found kernel: /vmlinuz-2.6.32-14-generic
Found kernel: /vmlinuz-2.6.32-13-generic
Found kernel: /vmlinuz-2.6.32-12-generic
Found kernel: /memtest86+.bin
Updating /boot/grub/menu.lst ... done

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: grub 0.97-29ubuntu60
ProcVersionSignature: Ubuntu 2.6.37-7.19-generic 2.6.37-rc3
Uname: Linux 2.6.37-7-generic x86_64
Architecture: amd64
CheckboxSubmission: fee5e196cb921cbd36888f428b38b488
CheckboxSystem: 2a6f54df59af338184485e85cbcf0d32
Date: Mon Dec 20 10:47:47 2010
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 LC_MESSAGES=en_US.utf8
 SHELL=/bin/zsh
SourcePackage: grub

Brian Murray (brian-murray) wrote :
tags: added: regression-release
Steve Langasek (vorlon) wrote :

It looks like this is because CONFIG_XEN_PRIVILEGED_GUEST, which is used to check whether or not a kernel is a Xen kernel, is no longer an accurate determinant. update-grub needs to either find some other way of identifying Xen-only kernels, or this code should be dropped.

Changed in grub (Ubuntu):
importance: Undecided → High
status: New → Triaged
Steve Langasek (vorlon) wrote :

(alternatively, we can get rid of grub1 entirely this cycle by auto-upgrading everyone to grub2 - but either way this looks like something we need to deal with before natty release)

Colin Watson (cjwatson) wrote :

grub2 doesn't have the concept of "Xen-only" kernels; instead, it offers anything with CONFIG_XEN_DOM0=y on Xen *as well* if you have a Xen hypervisor installed.

Colin Watson (cjwatson) on 2011-01-28
Changed in grub (Ubuntu Natty):
milestone: none → ubuntu-11.04-beta
Colin Watson (cjwatson) on 2011-01-28
Changed in grub (Ubuntu Natty):
assignee: nobody → Colin Watson (cjwatson)
Noel J. Bergman (noeljb) wrote :

"we can get rid of grub1 entirely this cycle"

And will you either migrate more sophisticated configurations, e.g., dedicated grub partitions with multiple OS installs, correctly, or just break them?

Colin Watson (cjwatson) wrote :

Firstly, that's irrelevant to this bug.

Secondly, if you have evidence of migration problems, please file them as bugs. In general, GRUB 2 should now be better than GRUB Legacy in most cases; there may be isolated cases where it doesn't work so well, and I'm happy to look into fixing those. I'm not going to go on fishing expeditions in response to vague comments, though!

Noel J. Bergman (noeljb) wrote :

It was no less relevant than -- or made relevant by -- Steve's comment about removing grub1 as the fix.

And I'll be happy to go over migration of grub 1 -> grub 2 with you in a more appropriate venue.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub - 0.97-29ubuntu61

---------------
grub (0.97-29ubuntu61) natty; urgency=low

  * Refine detection of Xen-only kernels: kernels with both CONFIG_XEN=y and
    CONFIG_PARAVIRT=y are now given both Xen entries (if a hypervisor is
    present) and non-Xen entries (LP: #692691).
 -- Colin Watson <email address hidden> Thu, 17 Mar 2011 14:27:42 +0000

Changed in grub (Ubuntu Natty):
status: Triaged → Fix Released
William Blunn (bill+launchpad) wrote :

AFAIK, Ubuntu 10.04 LTS uses Grub 0.97.

Ubuntu 10.04 LTS Server is, AFAIK, supported until *April 2015*

So I think that means that in terms of Ubuntu's / Canonical's responsibilities, "legacy" Grub needs to be maintained until then at the earliest.

I don't doubt that Grub 2 is the best thing since sliced bread, and supporting "legacy" Grub may seem onerous.

But if Canonical wants to put the "LTS" badge on every other April release, then that is the price of stability.

I'm not denying our responsibilities to support GRUB Legacy in 10.04
LTS; merely commenting on why I hadn't noticed this bug before now. I
agree with your comments but they aren't necessary.

A point of information, though: 10.04 LTS uses GRUB 2 by default. Xen
is of course an exception that still requires GRUB Legacy, as are some
upgrade cases.

Robert Hardy (rhardy) wrote :

This regression also affects lucid and is blocking use of kernels in lucid updates such as linux-image-2.6.38-10-virtual.

Natty's fixed grub rebuilds fine without changes under lucid without issue. Please fast track the fix in updates for lucid as well.

I've put the rebuild in my PPA for now. FYI it won't be tested in production until Launchpad.net catches up. Currently a 2 hr delay...

This is not a Xen-only issue as qemu-kvm is also affected.

My current work-around is to use OpsCode Chef to detect if grub1 in installed and replace /usr/sbin/update-grub with a working version.

* QEMU guest environment:

$ lsb_release -sd
Ubuntu 10.04.3 LTS

$ uname -srv
Linux 2.6.38-11-server #50~lucid1-Ubuntu SMP Tue Sep 13 22:10:53 UTC 2011

$ cat /boot/grub/device.map
(fd0) /dev/fd0
(hd0) /dev/vda

$ dpkg -l | awk '/grub/ {print $2 " " $3}'
grub 0.97-29ubuntu60.10.04.1
grub-common 1.98-1ubuntu12

* Before replacing /usr/sbin/grub-update

$ sudo update-grub
...
Ignoring Xen kernel on non-Xen host: vmlinuz-2.6.38-11-server
...

This is not a Xen-only issue as qemu-kvm is also affected.

Remember this? Bug #604335

Can't use grub2 on /dev/vda on LTS and can't use grub1 on /dev/vda with 2.6.38 backport on LTS too.

Can't use linux-image-server-lts-backport-oneiric.

One year past - Canonical does nothing. This was last time I've used Ubuntu Server (50+ installations). And this is last time I've using Ubuntu Desktop (11+ have so many bugs, I'll tired or die if I'll try to post all). Very bad, dear Canonical.

Steve Langasek (vorlon) wrote :

On Wed, Nov 16, 2011 at 06:24:00AM -0000, Rush Tonop Online wrote:
> One year past - Canonical does nothing.

That is most certainly not true. This bug was *fixed* in the version of grub that it was reported against, in the release that included the kernels that exposed the problem. That this would subsequently cause problems on the 10.04 LTS release due to backported kernels was not obvious at the time - and following up to a closed bug is generally not the most effective way to draw developers' attention to such an issue (it's probably better to file a new bug).

Now that the issue is known, this definitely becomes a priority to fix since it makes the backported kernels useless.

Changed in grub (Ubuntu Lucid):
status: New → Triaged
importance: Undecided → High
Steve Langasek (vorlon) on 2011-11-16
Changed in grub (Ubuntu Lucid):
assignee: nobody → Steve Langasek (vorlon)
Steve Langasek (vorlon) on 2011-11-16
description: updated
Changed in grub (Ubuntu Lucid):
status: Triaged → In Progress

Hello Brian, or anyone else affected,

Accepted grub into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in grub (Ubuntu Lucid):
status: In Progress → Fix Committed
tags: added: verification-needed

Verified on Lucid

$ lsb_release -ds
Ubuntu 10.04.3 LTS
$ uname -svrm
Linux 2.6.38-12-server #51~lucid1-Ubuntu SMP Thu Sep 29 20:09:53 UTC 2011 x86_64
$ grep QEM /proc/cpuinfo
model name : QEMU Virtual CPU version 0.14.0
$ df -h / | tail -n 1 | awk '{ print $1 }'
/dev/vda2

$ sudo apt-get purge grub grub-common
$ cd /boot/grub
$ rm -rf *
$ cd -
$ sudo aptitude -t lucid-proposed install grub grub-common
$ dpkg -l | grep grub | awk '/ii.*grub/ { print $2 " " $3 }'
grub 0.97-29ubuntu60.10.04.2
grub-common 1.98-1ubuntu12

$ sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) y
Searching for splash image ... none found, skipping ...
Found kernel: /boot/memtest86+.bin
Found kernel: /boot/vmlinuz-2.6.38-12-server
Found kernel: /boot/vmlinuz-2.6.38-11-server
Found kernel: /boot/vmlinuz-2.6.32-35-server
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

$

tags: added: verification-done-lucid
removed: verification-needed

Repeated verification on VM guest with only 2.6.32 kernel with the same results.

$ uname -svrm
Linux 2.6.32-35-server #78-Ubuntu SMP Tue Oct 11 16:26:12 UTC 2011 x86_64

Clint Byrum (clint-fewbar) wrote :

nutznboltz, thanks for all the awesome testing.

In the non-kernel SRU process, one of the tags verification-done and verification-needed always need to be present, otherwise we lose track of what is ready to go into -updates.

tags: added: verification-done
removed: verification-done-lucid

Thanks Clint.

Are there plans to improve this section?
https://wiki.ubuntu.com/StableReleaseUpdates#Verification

I especially find it difficult to know if something is being expected of the bug reporter (or subscribers) or not.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub - 0.97-29ubuntu60.10.04.2

---------------
grub (0.97-29ubuntu60.10.04.2) lucid-proposed; urgency=low

  * Backport from natty for compatibility with backported kernels:
    - Refine detection of Xen-only kernels: kernels with both CONFIG_XEN=y
      and CONFIG_PARAVIRT=y are now given both Xen entries (if a hypervisor
      is present) and non-Xen entries (LP: #692691).
 -- Steve Langasek <email address hidden> Tue, 15 Nov 2011 23:31:57 -0800

Changed in grub (Ubuntu Lucid):
status: Fix Committed → Fix Released

Thank you very much for this nifty fix. I pushed it out to 38 systems that use grub1 today.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers