1

I have a VPS running Ubuntu server 12.04. A while ago, my host installed an alternative kernel (one of Amazon's EC2 kernels) to fix a boot issue I was having. Now, 2 Ubuntu releases later, this kernel (2.6.31-302-ec2) is still being used even though later (3.2.xx) kernels have been installed.

How can I make the server use the most recent installed kernel, preferably without just uninstalling the EC2 kernel just in case doing so causes issues?

7
  • What kind of VPS is this? OpenVZ? Xen? KVM? VMWare?
    – ish
    Jun 17, 2012 at 14:47
  • I believe it is Xen Jun 17, 2012 at 17:15
  • Please pastebin /boot/grub/menu.lst and the full output of dmesg. Also, install imvirt (a tool to detect exactly what kind of virtualization is being used), and run it, and paste its output (it may fail to detect, or give you a Perl error - just note that if that is the case).
    – ish
    Jun 21, 2012 at 0:19
  • menu.lst: paste.ubuntu.com/1052280, imvirt outputs (after some perl warnings): Xen PV 3.4. dmesg seems to output only things relating to ipkungfu (a firewall script which I probably need to replace), so I'm not sure if that's something I want to expose, but if you think it may still be relevant I'll pastebin that too. Jun 21, 2012 at 8:25
  • It would be helpful - use dmesg | grep -i -v ipkung to remove that stuff from the output so it's safer to paste. Also, the output of sudo update-grub...
    – ish
    Jun 21, 2012 at 8:28

3 Answers 3

2
+50

Congratulations, you're on PyGrub!

  • Your menu.lst file, the different kernel images in your /boot directory and most importantly, the kernel you're running (an Amazon EC2 version extremely unlikely to be running on a physical host) strongly imply you do have pygrub enabled.
    • This is because non-Pygrub XenPVs must use the same kernel as the host
  • The oddly empty dmesg is likely a side-effect of the customizations in the EC2 kernel; compare with the very informative output of a normal kernel on a XenPV 3.4

A little bit on XenPV kernel options:

  • Your current custom EC2 kernel boots with the options root=/dev/sda1 xencons=tty (see end of menu.lst)
  • The standard XenPV boot options on stock kernels, instead are root=/dev/xvda1 console=hvc0
    • xvda is the paravirtualized (and more efficient) disk device, while sda is the less efficient emulated device -- this is the first time I've seen the latter used in a 3.x XenPV.
    • xencons=tty and console=hvc0 are very similar, but I believe the former is an older (legacy) usage; you can stack them with no ill-effects; it simply tells the kernel that the standard virtual terminal is unavailable for the console, and to use the specialized hvc0 device instead.

How to switch kernels:

This part may be slightly hairy, and you should be in your provider's good books because you may need their help with a simple cp operation once or twice! After that, you'll know what options you need and should be set for the future.

  • To give you some context if you need it, here are some files from my XenPV VPS on the latest 64-bit kernel: ls -l /boot, menu.lst and a full post-boot dmesg
  • Add the following at the top of your menu.lst, adapting to the kernel version you need:

    default=0
    title vmlinuz-3.2.0-25-generic
    root            (hd0) 
    kernel          /boot/vmlinuz-3.2.0-25-generic ro root=/dev/sda1 xencons=tty console=hvc0
    initrd      /boot/initrd.img-3.2.0-25-generic
    
  • Cross your fingers, reboot, and hope it comes back up!

  • If not, try changing to root=/dev/xvda1 and that should almost certainly work.
  • Remember to decline installing "new" menu.lst when upgrading kernels!
5
  • Thanks, this looked good, but the VM failed to boot (with or without /dev/xvda1) with a "Will only load images built for the generic loader or Linux images" error. I've contacted my host, I'll report back when I hear from them. Appreciate the help though. Jun 25, 2012 at 22:26
  • @TimFountain, Since this is a 32-bit VM, you need the -generic-pae kernel; the plain generic does not have Xen PV support! That's the most common cause of that error, AFAIK.
    – ish
    Jun 26, 2012 at 3:25
  • Thanks - for the bounty and the feedback. I'll add it to the answer. If recovery is easy and you feel like dipping your toes in shark-infested waters again, try out the xvda1 bit, which should be better in theory; but if you're happy with sda1 as it is, maybe just leave it be! :)
    – ish
    Jun 26, 2012 at 8:51
  • I did have to use xvda1, with sda1 I got an error on boot saying that didn't exist (not sure how it worked in the old menu.lst). But with xvda1 all is good. Jun 26, 2012 at 9:06
  • A minor correction to the above: Non pygrub pv:s CAN run with different kernels than the hypervisor. The Hypervisor(domU) just need to have the kernels installed.
    – tomodachi
    Aug 7, 2012 at 9:53
1

By default xen guests (domU) can't control what kernels are being used.

The kernel is provisioned from the hypervisor (dom-0) where the specific kernel version is hard coded along with ip , memory disk size etc in the config script for each virtual machine.

Unless your VPS provider has enabled pygrub which allows the use and boot of custom kernels within the VPS. if that is the case have a look at this instruction

Xen and PyGrub

2
  • Thanks for the relpy. There's no indication that PyGrub is being used. I was hoping to be able to learn how to fix this myself but it is starting to look like I may have to ask my host to fix this after all. Jun 21, 2012 at 8:27
  • @TimFountain hey, what about the bounty? how does that work? Will I be getting it or will it just expire?
    – tomodachi
    Jun 25, 2012 at 14:39
-1

Search Grub Customizer in software center.

Install the program.

Then open Grub Customizer.

It you can uncheck any of the older kernels and check the newer ones.

When ubuntu boots it will only see the ones that are checked.

Hope this helps,

Leinardo

2
  • This assumes that one is running X on the server. Which seldom is the case. Running X on a Linux server unless you have a specific use case in mind is not recommended for security / stability reasons. Also xen guests (domU) don't have grub. It's the dom0 that handles the boot process for it's guests.
    – tomodachi
    Jun 20, 2012 at 22:26
  • Whoops! My bad.... Jun 21, 2012 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .