Extlinux with guestfish
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 /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 }} The strange thing is that before I was using a ubuntu 14.04 host with libguestfs 1.24.5 and everything was working fine all my guests worked with extlinux as a bootloader and it's a better solution than grub but when I changed to a Centos7 host the same vm creation script didn't work. I don't know where is the problem, is it from guestfish?? or extlinux?? is there an additional package that I need to install?? Thank you for your time. Best regards, Slim TABKA
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-extl... 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
Thank you for the quick response.
Strange way to do this, as libguestfs can do all this.
Sorry to ask this (I'm a newly graduated engineer and I new to the virtualization world), but how can libguestfs do all of the above?, do you mean it can create all the partitions inside a new lvm volume or a new raw image??
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.
Yes I'm sure that I copied the syslinux.cfg in the guest and that's why I was confused with the error message. My problem is that the exact same steps worked on a ubuntu 14.04 host with libguestfs 1.24.5 , and I can't see why it won't work on a centos7 host , that's why I thought about a problem with this libguestfs version (1.30.3). Here's how I installed extlinux (I already saw the link that you sent me and I don't think I made a mistake) but the guest still don't want to boot: [root@localhost libguestfs-1.30.3]# ./run guestfish -i -a /dev/vm_volumes/clone2 Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell Operating system: CentOS Linux release 7.1.1503 (Core) /dev/sda1 mounted on /
<fs> ls /boot/ .vmlinuz-3.10.0-229.el7.x86_64.hmac System.map-3.10.0-229.el7.x86_64 config-3.10.0-229.el7.x86_64 grub grub2 initramfs-0-rescue-c898899928d341b58ae4d02802d19340.img initramfs-3.10.0-229.el7.x86_64.img initramfs-3.10.0-229.el7.x86_64kdump.img initrd-plymouth.img ldlinux.sys mbr.bin symvers-3.10.0-229.el7.x86_64.gz syslinux.cfg vmlinuz-0-rescue-c898899928d341b58ae4d02802d19340 vmlinuz-3.10.0-229.el7.x86_64 <fs> cat /boot/syslinux.cfg 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=8e137cd9-cd6c-4205-a27f-211d6184a5f3
<fs> copy-file-to-device /boot/mbr.bin /dev/sda size:440 <fs> extlinux /boot <fs> part-set-bootable /dev/sda 1 true
Thank you for your time and understanding.
On Tue, Oct 20, 2015 at 06:15:05PM +0100, slim tabka wrote:
Thank you for the quick response.
Strange way to do this, as libguestfs can do all this.
Sorry to ask this (I'm a newly graduated engineer and I new to the virtualization world), but how can libguestfs do all of the above?, do you mean it can create all the partitions inside a new lvm volume or a new raw image??
Of course: # guestfish -a /dev/vg/lv_test
<fs> run 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:-- <fs> part-init /dev/sda msdos <fs> part-disk /dev/sda msdos <fs> mkfs ext4 /dev/sda1 <fs> mount /dev/sda1 / <fs> tgz-in /tmp/libguestfs-1.31.18.tar.gz / etc.
but replace /tmp/libguestfs-1.31.18.tar.gz with your CentOS tarball.
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.
Yes I'm sure that I copied the syslinux.cfg in the guest and that's why I was confused with the error message.
My problem is that the exact same steps worked on a ubuntu 14.04 host with libguestfs 1.24.5 , and I can't see why it won't work on a centos7 host , that's why I thought about a problem with this libguestfs version (1.30.3).
Here's how I installed extlinux (I already saw the link that you sent me and I don't think I made a mistake) but the guest still don't want to boot:
[root@localhost libguestfs-1.30.3]# ./run guestfish -i -a /dev/vm_volumes/clone2
Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images.
Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
Operating system: CentOS Linux release 7.1.1503 (Core) /dev/sda1 mounted on /
<fs> ls /boot/ .vmlinuz-3.10.0-229.el7.x86_64.hmac System.map-3.10.0-229.el7.x86_64 config-3.10.0-229.el7.x86_64 grub grub2 initramfs-0-rescue-c898899928d341b58ae4d02802d19340.img initramfs-3.10.0-229.el7.x86_64.img initramfs-3.10.0-229.el7.x86_64kdump.img initrd-plymouth.img ldlinux.sys mbr.bin symvers-3.10.0-229.el7.x86_64.gz syslinux.cfg vmlinuz-0-rescue-c898899928d341b58ae4d02802d19340 vmlinuz-3.10.0-229.el7.x86_64 <fs> cat /boot/syslinux.cfg 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=8e137cd9-cd6c-4205-a27f-211d6184a5f3
<fs> copy-file-to-device /boot/mbr.bin /dev/sda size:440 <fs> extlinux /boot <fs> part-set-bootable /dev/sda 1 true
I wonder if extlinux is confused because /boot isn't a separate partition? TBH this is most likely an extlinux problem, since all that libguestfs does is to run `extlinux --install /boot', and if that command isn't working it's probably not because of anything libguestfs does. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
participants (2)
-
Richard W.M. Jones -
slim tabka