Hi ,all : thanks for helping me ! I am using libguestfs-1.28.1 on ubuntu 12.04 to manage vm disk created by KVM. I downloaded libguestfs-1.28.1.tar.gz ,and then executed (1) ./autogen.sh (2) ./configure (3) make (4) make check .there is the error. /usr/Libvmi/libguestfs-1.28.1/run --test guest-aux/make-fedora-img.pl md_create: feature 'mdadm' is not available in this build of libguestfs. Read 'AVAILABILITY' in the guestfs(3) man page for how to check for the availability of features. at /usr/Libvmi/libguestfs-1.28.1/tests/guests/guest-aux/make-fedora-img.pl line 103. /usr/Libvmi/libguestfs-1.28.1/run: command failed with exit code 2 make[2]: *** [stamp-fedora-md.img] Error 2 make[2]: Leaving directory `/usr/Libvmi/libguestfs-1.28.1/tests/guests' my questions are: (1) I googled the problem. In guestfs(3) man page ,It seems like that I don't install FUSE. In fact ,I have no idea about so many packages in libguestfs such v2v , src ,tools,tests and so on ,and I want to know where to find such kind information. (2) I find that guestfsd is the daemon in guest, so ,do I have to modify the guest(such as run guestfsd in guest)? (3) I just start the example : Inspect a disk image and display operating systems it may contain. so I copy the code under /libguestfs-1.28.1/prog.c , then I executed (1) cc prog.c -o prog `pkg-config libguestfs --cflags --libs` , (2)./prog /var/lib/libvirt/images/vm.img libguestfs: error: aug_init: aug_init: / (flags 48): Syntax error in lens definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not load module Quote for Quote.do_dquote /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Undefined variable Quote.do_dquote /usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Could not load module Rx for Rx.relinteger /usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Undefined variable Rx.relinteger /usr/share/guestfs/guestfs_lvm_conf.aug:32.20-.23:Undefined variable int /usr/share/guestfs/guestfs_lvm_conf.aug:40.17-.29:Undefined variable flat_literal thanks for your patience, I Appreciate it so much . sincerely -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libguestfs/attachments/20150505/5c825ebb/attachment.htm>
On Tue, May 05, 2015 at 04:30:40PM +0800, fu lirong wrote:> Hi ,all : > > thanks for helping me ! I am using libguestfs-1.28.1 on ubuntu > 12.04 to manage vm disk created by KVM. I downloaded > libguestfs-1.28.1.tar.gz ,and then executed > (1) ./autogen.sh (2) ./configure (3) make (4) make check > there is the error. > > /usr/Libvmi/libguestfs-1.28.1/run --test guest-aux/make-fedora-img.pl > md_create: feature 'mdadm' is not available in this > build of libguestfs. Read 'AVAILABILITY' in the guestfs(3) man page for > how to check for the availability of features. at > /usr/Libvmi/libguestfs-1.28.1/tests/guests/guest-aux/make-fedora-img.pl > line 103. > /usr/Libvmi/libguestfs-1.28.1/run: command failed with exit code 2 > make[2]: *** [stamp-fedora-md.img] Error 2 > make[2]: Leaving directory `/usr/Libvmi/libguestfs-1.28.1/tests/guests'You're doing quite well. This is likely an actual bug in the libguestfs test suite, since we always run it with mdadm available. Before we go on, does this command succeed? make quickcheck> my questions are: > (1) I googled the problem. In guestfs(3) man page ,It seems like that I > don't install FUSE. In fact ,I have no idea about so many packages in > libguestfs such v2v , src ,tools,tests and so on ,and I want to know where > to find such kind information.FUSE should be optional.> (2) I find that guestfsd is the daemon in guest, so ,do I have to modify > the guest(such as run guestfsd in guest)?No. See this diagram: http://libguestfs.org/guestfs.3.html#architecture The guest is not running, and does not need to run guestfsd.> (3) I just start the example : Inspect a disk image and display > operating systems it may contain. so I copy the code under > /libguestfs-1.28.1/prog.c , then I executed > > (1) cc prog.c -o prog `pkg-config libguestfs --cflags --libs` , > (2)./prog /var/lib/libvirt/images/vm.img > > libguestfs: error: aug_init: aug_init: / (flags 48): Syntax error in lens > definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not > load module Quote for Quote.do_dquote > /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Undefined variable > Quote.do_dquote > /usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Could not load module Rx > for Rx.relinteger > /usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Undefined variable > Rx.relinteger > /usr/share/guestfs/guestfs_lvm_conf.aug:32.20-.23:Undefined variable int > /usr/share/guestfs/guestfs_lvm_conf.aug:40.17-.29:Undefined variable > flat_literal > > thanks for your patience, I Appreciate it so much .Pino ^^ This is a libguestfs bug isn't it? But may be happening because Lirong is using Ubuntu 12.04 or the old libguestfs 1.28.1 version? Lirong: Could you share some information about what your program does? I'm guessing it calls guestfs_inspect_os() ? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
On Wed, May 06, 2015 at 08:42:09AM +0800, fu lirong wrote:> (1) make quickcheck > > works well ,after the command the terminal shows: > > ===== TEST FINISHED OK ====That's good.> (2) what your program does ( I executed ./autogen.sh 、 ./configure 、 > make 、 make check as I mentioned before , when I execute make check ,there > is something wrong and I ignored it . I started to run a C program ) > > a. I copy the code in prog.c (a C program I made ) under libguestfs-1.28.1 > ,and the code is : > > /* Example showing how to create a disk image. */ > > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > #include <fcntl.h> > #include <unistd.h> > #include <guestfs.h> > > int > main (int argc, char *argv[]) > { > guestfs_h *g; > size_t i; > > g = guestfs_create (); > if (g == NULL) { > perror ("failed to create libguestfs handle"); > exit (EXIT_FAILURE); > } > > /* Set the trace flag so that we can see each libguestfs call. */ > guestfs_set_trace (g, 1); > > /* Create a raw-format sparse disk image, 512 MB in size. */ > if (guestfs_disk_create (g, "disk.img", "raw", UINT64_C(512)*1024*1024, > -1) == -1) > exit (EXIT_FAILURE); > > /* Add the disk image to libguestfs. */ > if (guestfs_add_drive_opts (g, "disk.img", > GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", /* raw format */ > GUESTFS_ADD_DRIVE_OPTS_READONLY, 0, /* for write */ > -1) /* this marks end of optional arguments */ > == -1) > exit (EXIT_FAILURE); > > /* Run the libguestfs back-end. */ > if (guestfs_launch (g) == -1) > exit (EXIT_FAILURE); > > /* Get the list of devices. Because we only added one drive > * above, we expect that this list should contain a single > * element. > */ > char **devices = guestfs_list_devices (g); > if (devices == NULL) > exit (EXIT_FAILURE); > if (devices[0] == NULL || devices[1] != NULL) { > fprintf (stderr, "error: expected a single device from list-devices\n"); > exit (EXIT_FAILURE); > } > > /* Partition the disk as one single MBR partition. */ > if (guestfs_part_disk (g, devices[0], "mbr") == -1) > exit (EXIT_FAILURE); > > /* Get the list of partitions. We expect a single element, which > * is the partition we have just created. > */ > char **partitions = guestfs_list_partitions (g); > if (partitions == NULL) > exit (EXIT_FAILURE); > if (partitions[0] == NULL || partitions[1] != NULL) { > fprintf (stderr, "error: expected a single partition from > list-partitions\n"); > exit (EXIT_FAILURE); > } > > /* Create a filesystem on the partition. */ > if (guestfs_mkfs (g, "ext4", partitions[0]) == -1) > exit (EXIT_FAILURE); > > /* Now mount the filesystem so that we can add files. */ > if (guestfs_mount (g, partitions[0], "/") == -1) > exit (EXIT_FAILURE); > > /* Create some files and directories. */ > if (guestfs_touch (g, "/empty") == -1) > exit (EXIT_FAILURE); > const char *message = "Hello, world\n"; > if (guestfs_write (g, "/hello", message, strlen (message)) == -1) > exit (EXIT_FAILURE); > if (guestfs_mkdir (g, "/foo") == -1) > exit (EXIT_FAILURE); > > /* This one uploads the local file /etc/resolv.conf into > * the disk image. > */ > if (guestfs_upload (g, "/etc/resolv.conf", "/foo/resolv.conf") == -1) > exit (EXIT_FAILURE); > > /* Because we wrote to the disk and we want to detect write > * errors, call guestfs_shutdown. You don't need to do this: > * guestfs_close will do it implicitly. > */ > if (guestfs_shutdown (g) == -1) > exit (EXIT_FAILURE); > > guestfs_close (g); > > /* Free up the lists. */ > for (i = 0; devices[i] != NULL; ++i) > free (devices[i]); > free (devices); > for (i = 0; partitions[i] != NULL; ++i) > free (partitions[i]); > free (partitions); > > exit (EXIT_SUCCESS); > } > > > b. I executed cc prog.c -o prog `pkg-config libguestfs --cflags --libs` > c . I executed . /prog /var/lib/libvirt/images/vm.img (the vm.img is > the images that the KVM monitor created under /lib/libvirt/images) and > the vm virtual machine is running. after this command ,the errors appears: > > libguestfs: error: aug_init: aug_init: / (flags 48): Syntax error in lens > definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not > load module Quote for Quote.do_dquote > /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Undefined variable > Quote.do_dquote > /usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Could not load module Rx > for Rx.relinteger > /usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Undefined variable > Rx.relinteger > /usr/share/guestfs/guestfs_lvm_conf.aug:32.20-.23:Undefined variable int > /usr/share/guestfs/guestfs_lvm_conf.aug:40.17-.29:Undefined variable > flat_literalIt's strange because the program above doesn't call any Augeas functions in libguestfs. Perhaps you're compiling a different program? Anyway, I'm pretty sure this _is_ a bug in libguestfs, owing to the way we try to add rules to Augeas, which has been a constant source of pain. Ask Pino about that code. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
On Wed, May 06, 2015 at 05:06:32PM +0800, fu lirong wrote:> Hi Richard : > > today I download libguestfs-1.29.39.tar.gz and libguestfs-1.29.38.tar.gz > I executed : ./autogen.sh 、./configure 、make and the below is the error, > the same error in libguestfs-1.29.39.tar.gz and > libguestfs-1.29.38.tar.gz . > > > gcc: error: /usr/lib/rpm/redhat/redhat-hardened-ld: No such file or > directory > make[3]: *** [libguestfs.la] Error 1 > make[3]: Leaving directory `/usr/Libvmi/libguestfs-1.29.39/src' > make[2]: *** [all] Error 2This is a bug in the tarball (in build-aux/ltmain.sh). You should be able to work around it by rebuilding that file, by doing: libtoolize --force before building in the ordinary way. I'll modify the scripts I use to create the tarball so it doesn't add this artifact in future versions. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top