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