[Libguestfs] grub-install with guestfish

Richard W.M. Jones rjones at redhat.com
Thu Oct 1 10:44:12 UTC 2015


On Thu, Oct 01, 2015 at 11:04:11AM +0100, Richard W.M. Jones wrote:
> [Sending the question to the proper mailing list]
> 
> On Thu, Oct 01, 2015 at 10:50:13AM +0100, slim tabka wrote:
> > Hello Mr Richard Jones,
> > 
> > First of all, thank you for the amazing tools that you are creating.
> > I'm new to the virtualization and libguestfs ,so I'm hoping you can help me
> > to at least understand what's the problem I'm having exactly or to know if
> > there's a way to resolve it , and any suggestion or advice is much
> > appreciated.
> > 
> > I have a problem while trying to create a vm (the method I'm using is to
> > copy the filesystem of a template in a newly created lvm device and I
> > modify the fstab file and grub.conf with the uuid of the newely created
> > device) but the vm get stuck in booting from hard disk , while using xen I
> > switched the vm to a pv guest and used pygrub and now the vm is working
> > properly , the problem is with kvm (installed on ubuntu 14.04) the vm
> > (centos guest) is always stuck in the booting and  didn't find a tool like
> > pygrub on kvm , the only way to make the vm work is to manually install
> > grub through a livecd, I thought of using guestfish and use grub-install /
> > /dev/sda but when I try to start the vm it is stuck in grub2.0.2 shell.
> > It seems that with grub-install with guestfish it installed grub2 but in
> > the man page of guestfish it's said that it only install grub1.

There's two possible ways to approach this:

(1) Use a guestfish command like:

  sh "grub-install [...]"

(2) Forget about grub, and use extlinux:

https://rwmj.wordpress.com/2013/04/04/new-in-libguestfs-use-syslinux-or-extlinux-to-make-bootable-guests/#content

Unfortunately the grub-install API, while nice to use, only works for
grub1, and that is now obsolete.

Rich.

> > So is it because kvm is installed on ubuntu that's why grub-install
> > installs grub2?? and if the host is centos , wil I have problems with
> > ubuntu guests while tring to install grub ??? So why even if I modified the
> > /boot/grub/grub.conf inside the guest it still don't want to boot?? if the
> > host is kvm on ubuntu will I have problems with centos guest and if the
> > host is centos will I have problems with ubuntu guest??
> > I'm really confused wth all this , I don't know if I'm missing something.
> > 
> > I'm not sure if I was clear enough , and if needed I can provide you more
> > infos , but it's been a while that I'm stuck so any suggestion will be more
> > than welcome , so thank you for your time and I hope I'm not bothering you.
> > 
> > Slim TABKA
> 
> -- 
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> Fedora Windows cross-compiler. Compile Windows programs, test, and
> build Windows installers. Over 100 libraries supported.
> http://fedoraproject.org/wiki/MinGW
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list