Some of my linux vps servers are on Linode. Linode provides direct booting by default. I need to use SELinux, so I want to migrate pv-grub for booting my kernels on /boot folder.

After I change boot loader from console linode, my vps didnot boot and fall into grubdom. After that I boot with

root (hd0)
kernel /boot/vmlinuz-$ver-$rel.$arch root=/dev/xvda
initrd /boot/initrd-$ver-$rel.$arch.img

PS: Do not forget to replace $ver, $rel and $arch with proper ones.

After some searches, pv-grub does not support grub2 configuration!!! I need to use old legacy grub configuration file


Because pv-grub reads this file too boot. By the way, firstly I thought the problem is installing grub2 on /dev/xvda, however I found how pv-grub works. Then I create the menu.lst as

default 0
timeout 5

title Centos 7 (3.10.0-123.9.3.el7.x86_64)
        root (hd0)
        kernel /boot/vmlinuz-$ver-$rel.$arch root=/dev/xvda
        initrd /boot/initramfs-$ver-$rel.$arch.img

PS: Do not forget to replace $ver, $rel and $arch with proper ones.

After I found how I can boot from my kernels, I need to automate kernel updates. So I used grubby][grubby] to update grub menu, and yum-plugin-post-transaction-actions[ for yum update/upgrade.

I created a kernel.action file under /etc/yum/post-actions/ (do not forger to install yum-plugin-post-transaction-actions) as:

kernel*:remove:grubby --grub -o /boot/grub/menu.lst --remove-kernel=/boot/vmlinuz-$ver-$rel.$arch
kernel*:install:grubby --grub -o /boot/grub/menu.lst --add-kernel /boot/vmlinuz-$ver-$rel.$arch --args "root=/dev/xvda" --title "Centos 7 ($ver-$rel.$arch)" --initrd=/boot/initramfs-$ver-$rel.$arch.img --copy-default --make-default

First line removes old kernel and second line adds new installed kernel as default kernel. Do not touch $ver, $rel and $arch, yum will provide proper ones.

So, I successfully migrate to pv-grub.