回复: guestfs_mount_local* api undefined symbols
by Nok
Thank you Rich,
I checked the version and found that it printed an old 1.17.17 version which was deployed before.
But I remembered i did check the version in guestfish shell and it said 1.17.40 before that,then i totally ignored the fact i had another version involved.
I`ve changed the LD_LIBRARY_PATH and the "undefined symbol" error disappeared.But some "inspection API not available because of compiled without hivex library" pops up.I`ll check this out later.
thank you again
;)
Nok
------------------ 原始邮件 ------------------
发件人: "Richard W.M. Jones"<rjones(a)redhat.com>;
发送时间: 2012年5月10日(星期四) 晚上11:07
收件人: "Nok"<leolc_2749(a)qq.com>;
抄送: "libguestfs"<libguestfs(a)redhat.com>;
主题: Re: [Libguestfs] guestfs_mount_local* api undefined symbols
On Thu, May 10, 2012 at 09:59:17PM +0800, Nok wrote:
> Recently i deployed latest 1.17.40 on rhel6.1.
Compiled from source, by the looks of it?
> When i ran a tiny program which was to test the function
> guestfs_mount_local() or those similar functions that mounts
> locally, Error prompted—undefined symbol guest_mount_local !
>
> Why didn`t this undefined symbol error prompt when the program was
> first compiled,but occurred when it was run?
>
> Then i gave guestfish mount local a try in the shell, and found that
> ok.I thought it could not be something wrong with the
> installation.And then wierd happened—i ran the previous test program
> again,and it did mount the vm image on the host local directory! I
> doubted whether this was repeatable so i ran it again,and it failed
> with the same error “undefined symbol guestfs_mount_local”.
The symptoms sound like you're compiling your program against
libguestfs 1.17.40, but you're running your program against an earlier
libguestfs library (maybe the one installed in RHEL 6?).
> make install
>
> http://pastebin.com/EExzKbNa
This installs libguestfs in /usr/local. The one from RHEL 6 will be
in /usr. You might want to set 'LD_LIBRARY_PATH' so that the
program uses the /usr/local copy, ie:
LD_LIBRARY_PATH=/usr/local/lib ./prog
By the way, it's not necessarily safe to mix'n'match libraries,
daemons and appliances like you're trying to do here. The protocol
used between the library and the daemon has changed since RHEL 6.2.
If you are using libguestfs 1.16.19 (from [1]) then it'll probably
work for the majority of features. Earlier versions, probably not.
If you don't want to compile the right daemon + appliance on RHEL 6,
you can copy an appliance from a Fedora 17+ machine. See the
instructions here:
http://libguestfs.org/libguestfs-make-fixed-appliance.1.html
http://libguestfs.org/download/binaries/appliance/
Also you can modify your program so it prints out the version of
libguestfs that it's using:
http://libguestfs.org/guestfs.3.html#guestfs_version
#include <stdio.h>
#include <inttypes.h>
#include <guestfs.h>
//...
guestfs_h *g = guestfs_create ();
struct guestfs_version *vers = guestfs_version (g);
printf ("version = %" PRIi64 ".%" PRIi64 ".%" PRIi64 ".%s",
vers->major, vers->minor, vers->release, vers->extra);
Rich.
[1] http://people.redhat.com/~rjones/libguestfs-RHEL-6.3-preview/
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
12 years, 6 months
guestfs_mount_local* api undefined symbols
by Nok
Recently i deployed latest 1.17.40 on rhel6.1.
When i ran a tiny program which was to test the function guestfs_mount_local() or those similar functions that mounts locally, Error prompted—undefined symbol guest_mount_local !
Why didn`t this undefined symbol error prompt when the program was first compiled,but occurred when it was run?
Then i gave guestfish mount local a try in the shell, and found that ok.I thought it could not be something wrong with the installation.And then wierd happened—i ran the previous test program again,and it did mount the vm image on the host local directory! I doubted whether this was repeatable so i ran it again,and it failed with the same error “undefined symbol guestfs_mount_local”.
Nok
---------------------------------------------------------------------------------------------------------------------------
sorry for the lengthy logs below ^^#
---------------------------------------------------------------------------------------------------------------------------
libguestfs debug info
http://pastebin.com/C6E4VAW7
at the end there is an undefined symbol : guestfs_mount_local error.
---------------------------------------------------------------------------------------------------------------------------
gcc prog.c -o prog -Wall -lguestfs
no relevant warning or error
---------------------------------------------------------------------------------------------------------------------------
make install
http://pastebin.com/EExzKbNa
---------------------------------------------------------------------------------------------------------------------------
make
http://pastebin.com/1xZaSe8K
---------------------------------------------------------------------------------------------------------------------------
configure
http://pastebin.com/TMi4zpxB
12 years, 6 months
Writing policy for guestfsd in libguestfs live
by Richard W.M. Jones
Dan(s), I hope you can give us some advice on this.
Background: guestfsd is a guest agent. Normally it runs inside a
special appliance; that's *not* the case that I'm worried about.
There's also another mode where you can run guestfsd inside a regular
Fedora or RHEL guest, and it handles instructions from the host to
perform filesystem operations.
The mode is called 'libguestfs live'[1][2] and architecturally it
looks like this:
+-------------------------+
| Fedora/RHEL guest |
| |
| guestfsd (agent) | qemu/KVM
+------^------------------+
|
Host | (virtio serial channel)
v
libguestfs (library)
some program using libguestfs,
eg. guestfish, a virt tool
If you want to try it, install 'libguestfs-live-service' in a Fedora
guest, edit the guest XML as per instructions in [2], and on the host
do:
guestfish --live -d FedoraGuest
and try sending (non-destructive) commands to the guest agent.
Currently guestfsd is a monolithic daemon, so if you choose to run it
in your guest, then it can do pretty much anything in the libguestfs
API, which is a shorthand way of saying it can do pretty much
anything, eg. reading and writing any guest file, executing any
program, creating and deleting guest partitions, creating and deleting
guest LVs ...
The expected scenario is that the guest is controlled by the same
authority as the host, but possibly in future we'll have to find a way
to limit what guestfsd can do (via a configuration file).
The questions are:
(a) Can we meaningfully write an SELinux policy to confine guestfsd?
For example if guestfsd were to be included as a separate package in
RHEL, which it might be for RHEL 6.4.
(b) Can we change the design of guestfsd (within reason) to make it
simpler to write SELinux policy for guestfsd, and if so how?
(c) Is there any sort of privilege separation design that would make
sense here (cf. Privilege-separated OpenSSH).
Rich.
[1] http://libguestfs.org/guestfs.3.html#attaching_to_running_daemons
[2] https://rwmj.wordpress.com/2011/07/06/libguestfs-live/
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
12 years, 6 months
Re: [Libguestfs] virt-p2v
by Richard W.M. Jones
[Please post all v2v/p2v questions on the libguestfs mailing list]
On Wed, May 09, 2012 at 05:06:03PM +0200, NEVEU Stephane wrote:
> Richard,
>
> Sorry for disturbing you again, I'm trying to install virt-p2v on ubuntu 12.04 following your instructions :
> http://virt-tools.org/learning/start-virt-tools/#ubuntu
> so apt-get install ubuntu-virt virt-top virt-what basically
> but I cannot find the virt-p2v binary. Am I missing something ?
There's no 'virt-p2v' binary as such. You have to build an ISO, as
described here:
http://libguestfs.org/virt-v2v/
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
12 years, 6 months
[PATCH] sysprep: remove pam data
by Wanlong Gao
Remove the generated pam data in the guest.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
sysprep/Makefile.am | 2 ++
sysprep/sysprep_operation_pam_data.ml | 52 +++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 sysprep/sysprep_operation_pam_data.ml
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 38acfd2..d82e5ae 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -45,6 +45,7 @@ SOURCES = \
sysprep_operation_mail_spool.ml \
sysprep_operation_net_hwaddr.ml \
sysprep_operation_package_manager_cache.ml \
+ sysprep_operation_pam_data.ml \
sysprep_operation_random_seed.ml \
sysprep_operation_rhn_systemid.ml \
sysprep_operation_samba_db_log.ml \
@@ -77,6 +78,7 @@ OBJECTS = \
sysprep_operation_mail_spool.cmx \
sysprep_operation_net_hwaddr.cmx \
sysprep_operation_package_manager_cache.cmx \
+ sysprep_operation_pam_data.cmx \
sysprep_operation_random_seed.cmx \
sysprep_operation_rhn_systemid.cmx \
sysprep_operation_samba_db_log.cmx \
diff --git a/sysprep/sysprep_operation_pam_data.ml b/sysprep/sysprep_operation_pam_data.ml
new file mode 100644
index 0000000..dfcaf2d
--- /dev/null
+++ b/sysprep/sysprep_operation_pam_data.ml
@@ -0,0 +1,52 @@
+(* virt-sysprep
+ * Copyright (C) 2012 FUJITSU LIMITED
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+open Sysprep_operation
+open Sysprep_gettext.Gettext
+
+module G = Guestfs
+
+let pam_data_perform g root =
+ let typ = g#inspect_get_type root in
+ if typ <> "windows" then (
+ let paths = [ "/var/run/console/*";
+ "/var/run/faillock/*";
+ "/var/run/sepermit/*"; ] in
+ List.iter (
+ fun path ->
+ let files = g#glob_expand path in
+ Array.iter (
+ fun file ->
+ try g#rm file with G.Error _ -> ()
+ ) files;
+ ) paths;
+
+ []
+ )
+ else []
+
+let pam_data_op = {
+ name = "pam-data";
+ enabled_by_default = true;
+ heading = s_"Remove the PAM data in the guest";
+ pod_description = None;
+ extra_args = [];
+ perform = pam_data_perform;
+}
+
+let () = register_operation pam_data_op
--
1.7.10
12 years, 6 months
Compile Error
by Wanlong Gao
Hi Rich,
A compiling error occurs here,
File "../ocaml/guestfs.ml", line 1, characters 0-1:
Error: The implementation ../ocaml/guestfs.ml
does not match the interface ../ocaml/guestfs.cmi:
Values do not match:
external mkfs_btrfs :
t ->
?allocstart:int64 ->
?bytecount:int64 ->
?datatype:string ->
?leafsize:int ->
?label:string ->
?metadata:string ->
?nodesize:int -> ?sectorsize:int -> string array -> unit
= "ocaml_guestfs_mkfs_btrfs_byte" "ocaml_guestfs_mkfs_btrfs"
is not included in
val mkfs_btrfs :
t ->
?allocstart:int64 ->
?bytecount:int64 ->
?datatype:string ->
?leafsize:int ->
?label:string ->
?metadata:string ->
?nodesize:int -> ?sectorsize:int -> string -> unit
make: *** [../ocaml/guestfs.cmx] Error 2
Thanks,
Wanlong Gao
12 years, 6 months