Hi,<br>I have upgraded my kernel as you mentioned and everything is fine now. I wrote the following code to check the integrity of /boot directory in guest image. Now my question is- how could I check the integrity of files that are modified in last 10 minutes inside /boot directory? I use boot directory as an example directory.<br>
<br>/*check a disk image for integrity */<br> <br> #include <stdio.h><br> #include <stdlib.h><br> #include <string.h><br> #include <guestfs.h><br> <br> <br> int<br> main (int argc, char *argv[])<br>
{<br> guestfs_h *g;<br> const char *disk;<br> char **roots; <br> <br> if (argc != 2) {<br> fprintf (stderr, "usage: checkvm disk.img\n");<br> exit (EXIT_FAILURE);<br> }<br> disk = argv[1];<br>
<br> g = guestfs_create ();<br> if (g == NULL) {<br> perror ("failed to create libguestfs handle");<br> exit (EXIT_FAILURE);<br> }<br> <br> /* Attach the disk image read-only to libguestfs. */<br>
if (guestfs_add_drive_opts (g, disk,<br> /* GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", */<br> GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,<br> -1) /* this marks end of optional arguments */<br> == -1)<br>
exit (EXIT_FAILURE);<br> <br> /* Run the libguestfs back-end. */<br> if (guestfs_launch (g) == -1)<br> exit (EXIT_FAILURE);<br> <br> /* Ask libguestfs to inspect for operating systems. */<br> roots = guestfs_inspect_os (g);<br>
if (roots == NULL)<br> exit (EXIT_FAILURE);<br> if (roots[0] == NULL) {<br> fprintf (stderr, "checkvm: no operating systems found\n");<br> exit (EXIT_FAILURE);<br> }<br><br> <br> printf ("start check\n");<br>
<br> guestfs_mount (g, "/dev/sda1", "/");<br> int chkrt;<br> chkrt=guestfs_checksums_out (g,<br> "sha1",<br> "/boot",<br> "chkvm.log");<br>
<br> printf ("\nend check\n");<br> guestfs_umount (g, "/"); <br> if (!chkrt)<br> exit (EXIT_FAILURE);<br><br> <br> /* Unmount everything. */<br> if (guestfs_umount_all (g) == -1)<br> exit (EXIT_FAILURE);<br>
<br> free (roots);<br> <br> guestfs_close (g);<br> <br> exit (EXIT_SUCCESS);<br> }<br><br> Thank you.<br><br>....<br><span style="font-family:georgia,serif">Wahid</span><br><br><br><div class="gmail_quote">On Mon, Mar 4, 2013 at 6:27 PM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, Mar 04, 2013 at 05:50:27PM +0100, Khan Ferdous Wahid wrote:<br>
> Hi,<br>
> I tried to run the guestfs-examples from<br>
> <a href="http://libguestfs.org/guestfs-examples.3.html" target="_blank">http://libguestfs.org/guestfs-examples.3.html</a>, but they gave the following<br>
> warnings and errors-<br>
> #warning: Unable to get device geometry for /var/tmp/guestfs.JVxEUn/root<br>
<br>
</div>You can just ignore this. However:<br>
<div class="im"><br>
> #libguestfs: error: guestfs_launch failed, see earlier error messages<br>
<br>
</div>you need to run 'libguestfs-test-tool' and post the complete, unedited<br>
output. However:<br>
<div class="im"><br>
> What I did from the beginning- I boot my debian linux (2.6.32-5-686) inside<br>
> VirtualBox and then install following packages there-<br>
> #apt-get install qemu libguestfs-dev libguestfs-tools<br>
<br>
</div>Your problem is that this kernel is too old. You have to use at least 2.6.36.<br>
<br>
Rich.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/%7Erjones%0Avirt-top" target="_blank">http://people.redhat.com/~rjones<br>
virt-top</a> is 'top' for virtual machines. Tiny program with many<br>
powerful monitoring features, net stats, disk stats, logging, etc.<br>
<a href="http://people.redhat.com/%7Erjones/virt-top" target="_blank">http://people.redhat.com/~rjones/virt-top</a><br>
</font></span></blockquote></div><br>