[CC'd to libguestfs mailing list, please send follow ups there]
On Thu, May 12, 2011 at 02:58:20PM +0200, Adrian Reber
wrote:> I am running guestfish on SL6 to install a few ubuntu VMs. I am now at
> the point where I try to install grub on the VMs. Should be easy with
> "grub-install". But it seems this installs the grub from the host
> machine. In my case that is grub 0.97 instead of the grub2 ubuntu wants.
This is true.
> Trying to run the grub-install from ubuntu in guestfish does also not
> work:
>
> ><fs> command "/usr/sbin/grub-install --root-directory=/
/dev/vda"
> libguestfs: error: command: df: Warning: cannot read table of mounted file
systems: No such file or directory
> df: Warning: cannot read table of mounted file systems: No such file or
directory
> Could not find device for //boot: Not found or not a block device.
> ><fs>
>
> Because only /dev/vda1 has been mounted on /.
>
> Any ideas how I can install grub2 with guestfish?
You could try running the grub2 command (ie. using 'command').
However see the caveats at:
http://libguestfs.org/guestfs.3.html#running_commands
http://libguestfs.org/guestfs.3.html#security
The situation is further confusing because grub2 is not a universally
agreed upon upgrade to grub (Fedora is still using grub and won't
update to grub2 any time soon).
Anyhow, patches welcome if you want to fix the API.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top