root@ubuntu12-04-vm1:~# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise DISTRIB_DESCRIPTION="Ubuntu 12.04.1 LTS" root@ubuntu12-04-vm1:~# uname -rn ubuntu12-04-vm1 3.2.0-29-virtual |
This ubuntu is running on KVM as a VM which I built with vmbuilder tool.
[ install kernel 3.5 ]
install python-software-repositories to use add-apt-repository command if you have not installed it.
root@ubuntu12-04-vm1:~# apt-get install python-software-repositories |
root@ubuntu12-04-vm1:~# add-apt-repository ppa:upubuntu-com/kernel-amd64 You are about to add the following PPA to your system: More info: https://launchpad.net/~upubuntu-com/+archive/kernel-amd64 Press [ENTER] to continue or ctrl-c to cancel adding it Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.YHmwwsc3kM --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80/ --recv DED04C8CBB517AE45B073F12A5D712AEE06E6293 gpg: requesting key E06E6293 from hkp server keyserver.ubuntu.com gpg: key E06E6293: public key "Launchpad PPA for upubuntu.com" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) |
root@ubuntu12-04-vm1:~# apt-get update |
root@ubuntu12-04-vm1:~# apt-get install linux -y Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: linux-headers-3.5.0-030500 linux-headers-3.5.0-030500-generic linux-image-3.5.0-030500-generic <snip> 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 ... none found, skipping ... Found kernel: /boot/vmlinuz-3.5.0-030500-generic Found kernel: /boot/vmlinuz-3.2.0-29-virtual Updating /boot/grub/menu.lst ... done root@ubuntu12-04-vm1:~# |
update grub.cfg. I’m using grub not grub2
root@ubuntu12-04-vm1:~# dpkg -l grub Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii grub 0.97-29ubuntu6 GRand Unified Bootloader (Legacy version) |
back up the original menu.lst and then issue the following command.
Please don’t issue the following command. this is mistake !! If you issue grub-mkconfig , you will not boot the OS..
root@ubuntu12-04-vm1:~# grub-mkconfig -o /boot/grub/menu.lst |
reboot
root@ubuntu12-04-vm1:~# reboot |
OMG !!! …. can’t login !!!
okay , stop the ubuntu VM forcefully
on the KVM host
virsh # destroy ubuntu12-04-vm1 Domain ubuntu12-04-vm1 destroyed |
Luckily , I backed up the original menu.lst , so restore it with guestfish.
root@ubuntu-1:~# guestfish --rw -d ubuntu12-04-vm1 -i edit /boot/grub/menu.lst |
The following menu.lst is the original menu.lst which I backed up.
root@ubuntu-1:~# guestfish --rw -d ubuntu12-04-vm1 -i cat /boot/grub/menu.lst # cat /boot/grub/menu.lst # menu.lst - See: grub(8), info grub, update-grub(8) # grub-install(8), grub-floppy(8), # grub-md5-crypt, /usr/share/doc/grub # and /usr/share/doc/grub-legacy-doc/. ## default num # Set the default entry to the entry number NUM. Numbering starts from 0, and # the entry number 0 is the default if the command is not used. # # You can specify 'saved' instead of a number. In this case, the default entry # is the entry saved with the command 'savedefault'. # WARNING: If you are using dmraid do not use 'savedefault' or your # array will desync and will not let you boot your system. default 0 ## timeout sec # Set a timeout, in SEC seconds, before automatically booting the default entry # (normally the first entry defined). #timeout 3 timeout 0 ## hiddenmenu # Hides the menu by default (press ESC to see the menu) hiddenmenu # Pretty colours #color cyan/blue white/blue ## password ['--md5'] passwd # If used in the first section of a menu file, disable all interactive editing # control (menu entry editor and command-line) and entries protected by the # command 'lock' # e.g. password topsecret # password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/ # password topsecret # # examples # # title Windows 95/98/NT/2000 # root (hd0,0) # makeactive # chainloader +1 # # title Linux # root (hd0,1) # kernel /vmlinuz root=/dev/hda2 ro # # # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST ### BEGIN AUTOMAGIC KERNELS LIST ## lines between the AUTOMAGIC KERNELS LIST markers will be modified ## by the debian update-grub script except for the default options below ## DO NOT UNCOMMENT THEM, Just edit them to your needs ## ## Start Default Options ## ## default kernel options ## default kernel options for automagic boot options ## If you want special options for specific kernels use kopt_x_y_z ## where x.y.z is kernel version. Minor versions can be omitted. ## e.g. kopt=root=/dev/hda1 ro ## kopt_2_6_8=root=/dev/hdc1 ro ## kopt_2_6_8_2_686=root=/dev/hdc2 ro # kopt=root=UUID=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ro ## default grub root device ## e.g. groot=(hd0,0) # groot=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ## should update-grub create alternative automagic boot options ## e.g. alternative=true ## alternative=false # alternative=true ## should update-grub lock alternative automagic boot options ## e.g. lockalternative=true ## lockalternative=false # lockalternative=false ## additional options to use with the default boot option, but not with the ## alternatives ## e.g. defoptions=vga=791 resume=/dev/hda5 # defoptions=quiet splash ## should update-grub lock old automagic boot options ## e.g. lockold=false ## lockold=true # lockold=false ## Xen hypervisor options to use with the default Xen boot option # xenhopt= ## Xen Linux kernel options to use with the default Xen boot option # xenkopt=console=tty0 ## altoption boot targets option ## multiple altoptions lines are allowed ## e.g. altoptions=(extra menu suffix) extra boot options ## altoptions=(recovery) single # altoptions=(recovery mode) single ## controls how many kernels should be put into the menu.lst ## only counts the first occurence of a kernel, not the ## alternative kernel options ## e.g. howmany=all ## howmany=7 # howmany=all ## specify if running in Xen domU or have grub detect automatically ## update-grub will ignore non-xen kernels when running in domU and vice versa ## e.g. indomU=detect ## indomU=true ## indomU=false # indomU=detect ## should update-grub create memtest86 boot option ## e.g. memtest86=true ## memtest86=false # memtest86=true ## should update-grub adjust the value of the default booted system ## can be true or false # updatedefaultentry=false ## should update-grub add savedefault to the default options ## can be true or false # savedefault=false ## ## End Default Options ## title Ubuntu 12.04.1 LTS, kernel 3.2.0-29-virtual uuid dd3e1234-f569-4a8e-9bff-5f2fd4bad248 kernel /boot/vmlinuz-3.2.0-29-virtual root=UUID=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ro quiet splash initrd /boot/initrd.img-3.2.0-29-virtual console=tty0 console=ttyS0,115200n8 title Ubuntu 12.04.1 LTS, kernel 3.2.0-29-virtual (recovery mode) uuid dd3e1234-f569-4a8e-9bff-5f2fd4bad248 kernel /boot/vmlinuz-3.2.0-29-virtual root=UUID=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ro single initrd /boot/initrd.img-3.2.0-29-virtual ### END DEBIAN AUTOMAGIC KERNELS LIST |
start the ubuntu VM.
root@ubuntu-1:~# virsh start ubuntu12-04-vm1 Domain ubuntu12-04-vm1 started |
Yhea , I could login..
root@ubuntu-1:~# virsh console ubuntu12-04-vm1 Connected to domain ubuntu12-04-vm1 Escape character is ^] Ubuntu 12.04.1 LTS ubuntu12-04-vm1 ttyS0 ubuntu12-04-vm1 login: root Password: Last login: Thu Aug 26 04:38:36 UTC 2012 on ttyS0 Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64) * Documentation: https://help.ubuntu.com/ |
Okay , let’s update menu.lst again.
issue update-grub command.
root@ubuntu12-04-vm1:~# 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 ... none found, skipping ... Found kernel: /boot/vmlinuz-3.5.0-030500-generic Found kernel: /boot/vmlinuz-3.2.0-29-virtual Updating /boot/grub/menu.lst ... done |
nnn , menu.lst does not seem to be updated. why ??
root@ubuntu12-04-vm1:~# diff /boot/grub/menu.lst /home/hattori/org.menu.lst |
root@ubuntu12-04-vm1:~# egrep -v ^# /boot/grub/menu.lst | grep -v ^$ default 0 timeout 0 hiddenmenu title Ubuntu 12.04.1 LTS, kernel 3.2.0-29-virtual uuid dd3e1234-f569-4a8e-9bff-5f2fd4bad248 kernel /boot/vmlinuz-3.2.0-29-virtual root=UUID=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ro quiet splash initrd /boot/initrd.img-3.2.0-29-virtual console=tty0 console=ttyS0,115200n8 title Ubuntu 12.04.1 LTS, kernel 3.2.0-29-virtual (recovery mode) uuid dd3e1234-f569-4a8e-9bff-5f2fd4bad248 kernel /boot/vmlinuz-3.2.0-29-virtual root=UUID=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ro single initrd /boot/initrd.img-3.2.0-29-virtual |
root@ubuntu12-04-vm1:~# apt-cache policy grub grub: Installed: 0.97-29ubuntu66 Candidate: 0.97-29ubuntu66 Version table: *** 0.97-29ubuntu66 0 500 http://jp.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages 100 /var/lib/dpkg/status |
kernel 3.5 is in /boot directory for sure.
oot@ubuntu12-04-vm1:~# ls /boot/ System.map-3.2.0-29-virtual grub System.map-3.5.0-030500-generic initrd.img-3.2.0-29-virtual abi-3.2.0-29-virtual initrd.img-3.5.0-030500-generic abi-3.5.0-030500-generic vmlinuz-3.2.0-29-virtual config-3.2.0-29-virtual vmlinuz-3.5.0-030500-generic config-3.5.0-030500-generic |
okay , back up the original and then remove it and then issue update-grub to create a new one.
root@ubuntu12-04-vm1:~# mv /boot/grub/menu.lst /home/hattori/ root@ubuntu12-04-vm1:~# 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/vmlinuz-3.5.0-030500-generic Found kernel: /boot/vmlinuz-3.2.0-29-virtual Updating /boot/grub/menu.lst ... done |
Okay , kernel 3.5 definition is in menu.lst
root@ubuntu12-04-vm1:~# egrep "3.5" /boot/grub/menu.lst title Ubuntu 12.04.1 LTS, kernel 3.5.0-030500-generic kernel /boot/vmlinuz-3.5.0-030500-generic root=UUID=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ro quiet splash initrd /boot/initrd.img-3.5.0-030500-generic title Ubuntu 12.04.1 LTS, kernel 3.5.0-030500-generic (recovery mode) kernel /boot/vmlinuz-3.5.0-030500-generic root=UUID=dd3e1234-f569-4a8e-9bff-5f2fd4bad248 ro single initrd /boot/initrd.img-3.5.0-030500-generic |
reboot the OS.
I can boot the OS with kernel 3.5 :)
Broadcast message from root@ubuntu12-04-vm1 (/dev/ttyS0) at 5:51 ... The system is going down for reboot NOW! Ubuntu 12.04.1 LTS ubuntu12-04-vm1 ttyS0 ubuntu12-04-vm1 login: root Password: Last login: Thu Aug 26 05:38:23 UTC 2012 on ttyS0 Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.5.0-030500-generic x86_64) * Documentation: https://help.ubuntu.com/ root@ubuntu12-04-vm1:~# uname -rn ubuntu12-04-vm1 3.5.0-030500-generic |