[Libguestfs] Extlinux with guestfish
Richard W.M. Jones
rjones at redhat.com
Tue Oct 20 16:40:44 UTC 2015
On Tue, Oct 20, 2015 at 04:40:09PM +0100, slim tabka wrote:
> Hi everyone,
>
> I'm working with libguestfs 1.30.3 on Centos 7 host.
> I encountered a problem when I wanted to install extlinux with guestfish as
> a bootloader for my guests and I always get this error:
>
> SYSLINUX 4.05 EDD 0x54f93f16 Copyright (C) 1994-2010 H. Peter Anvin et al
> ERROR: No configuration file found
> No default or UI configuration directive found!
> boot: _
>
>
>
> *This is how I create the virtual machines:*
>
> lvcreate -n vm_name -L 9G vm_volumes
>
> parted /dev/vm_volumes/vm_name mklabel msdos
> parted -a optimal /dev/vm_volumes/vm_name mkpart primary ext4 0% 100%
> parted /dev/vm_volumes/vm_name set 1 boot on
>
> kpartx -av /dev/vm_volumes/vm_name
>
> mkfs.ext4 /dev/mapper/loop0p1
>
> mount /dev/mapper/loop0p1 /mnt/clone
>
> tar -zxf /root/centos7_template.tar.gz -C /mnt/clone/
>
> umount /mnt/clone
> kpartx -dv /dev/vm_volumes/vm_name
Strange way to do this, as libguestfs can do all this.
> /root/libguestfs-1.30.3/run guestfish -i -a /dev/vm_volumes/{vm_name}
> << _EOF_ \n\
>
> #####mbr.bin and syslinux already existant in centos7_template.tar.gz####
> copy-file-to-device /boot/mbr.bin /dev/sda size:440 \n\
> extlinux /boot \n\
> part-set-bootable /dev/sda 1 true \n\
> _EOF_
>
> *And this is the syslinux.cfg file:*
>
> DEFAULT linux
> LABEL linux
> SAY Booting the kernel
> KERNEL /boot/vmlinuz-3.10.0-229.el7.x86_64
> INITRD /boot/initramfs-3.10.0-229.el7.x86_64.img
> APPEND ro root=UUID={{ UUID }}
Did you copy the syslinux.cfg file into the guest? The error message
you reported sounds like extlinux is installed but cannot read its
config file.
Anyway, here's how I used these APIs:
https://rwmj.wordpress.com/2013/04/04/new-in-libguestfs-use-syslinux-or-extlinux-to-make-bootable-guests/#content
It's in Perl, but the same commands will work fine in guestfish.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list