Difference between the old and the new febootstrap
by mohammed abdul Moniem
Hi,
First, I'd like to thank you for your nice effort of the febootstrap tool.
I understand there are 2 major versions of this tool
the first has the syntax of "febootstrap fedora-12 ./f12" while the second
has the syntax "febootstrap --names ....."
Is it correct?
I also understand the second one is used only to create a minimal system.
is it correct too?
But what about if I want to create a complete rootfs with GUI to use it
with qemu kvm?
Would you kindly show me how to do this with febootstrap?
BR.
12 years, 9 months
Re: [Libguestfs] mounting using guestfish
by Richard W.M. Jones
On Fri, Mar 09, 2012 at 01:11:23AM -0800, THO HUYNH wrote:
> Do you have any documentation about the implementation of mounting
> using guestfish. I want to know how it works inside then write the
> script.
Libguestfs live access works slightly differently from ordinary use of
libguestfs, and all the examples only explain the ordinary way.
The main documentation is here:
http://libguestfs.org/guestfs.3.html#api_overview
Once you've decided what language you want to use, you'll need to
follow one of these pages:
http://libguestfs.org/guestfs-perl.3.html
http://libguestfs.org/guestfs-python.3.html
http://libguestfs.org/guestfs-ocaml.3.html
http://libguestfs.org/guestfs-ruby.3.html
http://libguestfs.org/guestfs-java.3.html
Because it's live, you need to add the domain using the 'live' option,
see:
http://libguestfs.org/guestfs.3.html#guestfs_add_domain
To download and upload between handles, you'll need to use two
threads, a pipe between them, and the regular download/upload APIs:
http://libguestfs.org/guestfs.3.html#guestfs_download
http://libguestfs.org/guestfs.3.html#guestfs_upload
http://libguestfs.org/guestfs.3.html#guestfs_tar_out
http://libguestfs.org/guestfs.3.html#guestfs_tar_in
(etc)
I suggest writing some code and reading the many programs in the
source of libguestfs, and if you get stuck, posting specific questions
on the mailing list.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
12 years, 9 months
[PATCH] inspection: Set last errno to ENOTSUP when inspection APIs are not available.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
Previously there was no programmatic way to tell if inspection APIs
were unavailable because they are not compiled in (because hivex isn't
around). This contrasts with daemon APIs where the availability is
covered by the guestfs_available API.
Change the inspection APIs so that when they are not available, the
last errno is set to ENOTSUP. (Note that ENOTSUP must be defined on
all POSIX platforms).
This allows programs to detect if they are using a version of
libguestfs that was compiled without support for inspection, without
having to parse error messages.
---
src/inspect.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/inspect.c b/src/inspect.c
index 60c7dd4..117f57a 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -542,7 +542,7 @@ guestfs__inspect_get_hostname (guestfs_h *g, const char *root)
/* XXX These functions should be in an optgroup. */
#define NOT_IMPL(r) \
- error (g, _("inspection API not available since this version of libguestfs was compiled without the hivex library")); \
+ guestfs_error_errno (g, ENOTSUP, _("inspection API not available since this version of libguestfs was compiled without the hivex library")); \
return r
char **
--
1.7.9.1
12 years, 9 months
[PATCH V3] virt-sysprep:add ipconfig for preparation
by Wanlong Gao
V1->V2: add the documentation.
V2->V3: change the split sign from ":" to "@" for IPv6.
Add the the ipconfig for vir-prep.
Usage like below:
[root@Allen ~]# virt-sysprep --ipconfig="eth0:192.168.1.2,255.255.255.0,192.168.1.1" --enable=ipconfig -d clone-6u1
OR
[root@Allen ~]# virt-sysprep -d clone-6u1
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
clone/virt-sysprep.in | 51 +++++++++++++++++++++++++++++++++++++++++++++++-
clone/virt-sysprep.pod | 19 ++++++++++++++++++
2 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/clone/virt-sysprep.in b/clone/virt-sysprep.in
index d505532..557d46a 100644
--- a/clone/virt-sysprep.in
+++ b/clone/virt-sysprep.in
@@ -26,7 +26,7 @@ version="@PACKAGE_VERSION@"
TEMP=`getopt \
-o a:c:d:vVx \
- --long help,add:,connect:,domain:,enable:,format::,hostname:,list-operations,selinux-relabel,no-selinux-relabel,verbose,version \
+ --long help,add:,connect:,domain:,enable:,format::,hostname:,ipconfig:,list-operations,selinux-relabel,no-selinux-relabel,verbose,version \
-n $program -- "$@"`
if [ $? != 0 ]; then
echo "$program: problem parsing the command line arguments"
@@ -91,6 +91,9 @@ while true; do
--hostname)
hostname_param="$2"
shift 2;;
+ --ipconfig)
+ ipconfig_param="$2"
+ shift 2;;
--list-operations)
enable=list
shift;;
@@ -135,6 +138,7 @@ if [ -z "$enable" ]; then
dhcp_client_state=yes
dhcp_server_state=yes
hostname=yes
+ ipconfig=yes
logfiles=yes
mail_spool=yes
net_hwaddr=yes
@@ -150,6 +154,7 @@ elif [ "$enable" = "list" ]; then
echo "dhcp-client-state"
echo "dhcp-server-state"
echo "hostname"
+ echo "ipconfig"
echo "logfiles"
echo "mail-spool"
echo "net-hwaddr"
@@ -168,6 +173,7 @@ else
dhcp-client-state) dhcp_client_state=yes ;;
dhcp-server-state) dhcp_server_state=yes ;;
hostname) hostname=yes ;;
+ ipconfig) ipconfig=yes ;;
logfiles) logfiles=yes ;;
mail-spool) mail_spool=yes ;;
net-hwaddr) net_hwaddr=yes ;;
@@ -286,6 +292,49 @@ if [ "$hostname" = "yes" ]; then
esac
fi
+#FIXME: This may not work OK for IPv6 ?
+if [ "$ipconfig" = "yes" ]; then
+ case "$type/$distro" in
+ linux/fedora|linux/rhel)
+ if [ -d $mnt/etc/sysconfig/network-scripts ]; then
+ if [ -z $ipconfig_param ]; then
+ rm_ipconfig ()
+ {
+ sed '/^IPADDR=/d;/^BOOTPROTO=/d;/^NETMASK=/d;/^GATEWAY=/d;/^DNS/d' \
+ < "$1" > "$1.new"
+ echo "BOOTPROTO=dhcp" >> "$1.new"
+ mv -f "$1.new" "$1"
+ }
+ export -f rm_ipconfig
+ find $mnt/etc/sysconfig/network-scripts \
+ -name 'ifcfg-*' -type f \
+ -exec bash -c 'rm_ipconfig "$0"' {} \;
+ else
+ for (( i=1; i<8 ; i+=2 )); do
+ __device=$(echo "$ipconfig_param" | awk -v j=$i -F@ '{print $j}')
+ if [ -z $__device ]; then
+ break
+ fi
+ __ipconfig=$(echo "$ipconfig_param" | awk -v j=$((i+1)) -F@ '{print $j}')
+ __config_file=$(echo "$mnt/etc/sysconfig/network-scripts/ifcfg-$__device")
+ if [ -e $__config_file ]; then
+ __ip=$(echo "$__ipconfig" | awk -F, '{print $1}')
+ __mask=$(echo "$__ipconfig" | awk -F, '{print $2}')
+ __gw=$(echo "$__ipconfig" | awk -F, '{print $3}')
+ sed '/^IPADDR=/d;/^BOOTPROTO=/d;/^NETMASK=/d;/^GATEWAY=/d;/^DNS/d' \
+ < "$__config_file" > "$__config_file.new"
+ echo "IPADDR=$__ip" >> "$__config_file.new"
+ echo "BOOTPROTO=static" >> "$__config_file.new"
+ echo "NETMASK=$__mask" >> "$__config_file.new"
+ echo "GATEWAY=$__gw" >> "$__config_file.new"
+ mv -f "$__config_file.new" "$__config_file"
+ fi
+ done
+ fi
+ fi
+ esac
+fi
+
if [ "$logfiles" = "yes" ]; then
case "$type" in
linux)
diff --git a/clone/virt-sysprep.pod b/clone/virt-sysprep.pod
index 5cab3eb..c699887 100755
--- a/clone/virt-sysprep.pod
+++ b/clone/virt-sysprep.pod
@@ -121,6 +121,17 @@ security problem with malicious guests (CVE-2010-3851).
Change the hostname. See the L</hostname> operation below.
If not given, defaults to C<localhost.localdomain>.
+=item B<--ipconfig> "device1@ipaddr,netmask,gateway@device2@ipaddr,..."
+
+Change the IP configuration. See the L</ipconfig> operation below.
+If not given, defaults to C<dhcp>.
+
+For example:
+
+ --ipconfig "eth0@192.168.122.2,255.255.255.0,192.168.122.1@eth1(a)192.168.122.3,255.255.255.0,192.168.122.1"
+
+You can configure the IP of any existent net device in the guest.
+
=item B<--list-operations>
List the operations supported by the virt-sysprep program.
@@ -191,6 +202,14 @@ I<--hostname> parameter.
If the I<--hostname> parameter is not given, then the hostname is
changed to C<localhost.localdomain>.
+=head2 ipconfig
+
+Changes the IP configuration of the guest to the value given in
+the I<--ipconfig> parameter.
+
+If the I<--ipconfig> parameter is not given, then the IP configuration
+all changed to C<dhcp>.
+
=head2 logfiles
Remove many log files.
--
1.7.10.rc0
12 years, 9 months
[PATCH] inspect: Ignore missing HKLM\SYSTEM\MountedDevices (RHBZ#803664).
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
When a Windows guest doesn't have a HKLM\SYSTEM\MountedDevices node,
inspection fails. However inspection should not completely fail just
because we cannot get the drive letter mapping from a guest.
---
src/inspect_fs_windows.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/inspect_fs_windows.c b/src/inspect_fs_windows.c
index 11454df..1a34192 100644
--- a/src/inspect_fs_windows.c
+++ b/src/inspect_fs_windows.c
@@ -395,10 +395,11 @@ check_windows_system_registry (guestfs_h *g, struct inspect_fs *fs)
errno = 0;
node = hivex_node_get_child (h, root, "MountedDevices");
if (node == 0) {
- if (errno != 0)
- perrorf (g, "hivex_node_get_child");
- else
- error (g, "hivex: could not locate HKLM\\SYSTEM\\MountedDevices");
+ if (errno == 0)
+ /* Not found: skip getting drive letter mappings (RHBZ#803664). */
+ goto skip_drive_letter_mappings;
+ /* errno != 0, so it's some other error from hivex */
+ perrorf (g, "hivex_node_get_child");
goto out;
}
@@ -453,6 +454,7 @@ check_windows_system_registry (guestfs_h *g, struct inspect_fs *fs)
free (key);
}
+ skip_drive_letter_mappings:;
/* Get the hostname. */
const char *hivepath[] =
{ fs->windows_current_control_set, "Services", "Tcpip", "Parameters" };
--
1.7.9.1
12 years, 9 months
Re: [Libguestfs] p2v with cciss failure
by Mike Brady
> On 03/06/2012 07:40 PM, Mike Brady wrote:
> I have continued on with my attempts to get p2v working will little
> success.
>
> I have changed my server to Fedora 16 and finally got an XP with a
> single SATA disk (sda) to work. I think that this means that the current
> virt-p2v.iso just doesn't work with the packages that are available on
> Centos 6 at the moment.
>
> However, the machines that I currently need to actually migrate all have
> cciss controllers of some sort in them. For testing I have two very
> different servers with different controllers in them that both use the
> cciss driver that fail to complete the transfer of the image.
>
> Debug output is listed below, but doesn't give me any clues as to what
> to look at next.
>
>
> Mar 1 11:33:12 c2cl00 virt-v2v[6721]: Read 4194304 bytes
> Mar 1 11:33:12 c2cl00 virt-v2v[6721]: Read 4194304 bytes
> Mar 1 11:33:12 c2cl00 virt-v2v[6721]: Read 65536 bytes
> Mar 1 11:33:14 c2cl00 virt-v2v[6721]: Sent: ERROR Error receiving data:
> Mar 1 11:33:14 c2cl00 virt-v2v[6721]: FATAL: Error receiving data:
> Mar 1 11:33:14 c2cl00 virt-v2v[6721]: WARNING: Error messages were
> written to /var/log/virt-p2v-server.1330551856.log.
> Mar 1 11:33:14 c2cl00 virt-v2v[6721]: p2v-server exited.
> Mar 1 11:33:14 c2cl00 virt-v2v[6721]: Automatically cleaning up volume
> win2008-cciss_c0d0 from pool {pool}.
>
> The file /var/log/virt-p2v-server.1330551856.log contains
> -----Start
> virt-v2v: Error receiving data:
>
> -----End
>
> I don't think this error has anything to do with the cciss
> controller, as I've had it from a number of sources now. There
> appears to be some kind of race in the code which sends disk data.
> I'm currently working on trying to track it down.
>
> Matt
> --
> Matthew Booth, RHCA, RHCSS
> Red Hat Engineering, Virtualisation Team
>
> GPG ID: D33C3490
> GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
>
Matthew
Apologies, but some how I managed to miss your original reply.
Let me now if there is something I can do to help with tracking this
down. I have a couple of machines here that reliably fail that I can
test on.
Thanks
Mike
12 years, 9 months
Re: [Libguestfs] Libguestfs question
by Richard W.M. Jones
[Please keep replies on the mailing list]
On Wed, Mar 14, 2012 at 12:08:52PM +0100, Davide Barbato wrote:
> I would ask you a question: there are any possibilities to do a file
> carving on those image? I know, you lib is an "userspace" utility,
> and you take only a logical "screenshot" of the files, but I think
> maybe you can share with me some your considerations about that (I
> think you made yourself the same question).
I'm afraid I don't understand the question. What is a 'file carving'?
A snapshot?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
12 years, 9 months
Re: [Libguestfs] Compilation troubles
by Richard W.M. Jones
Please keep replies on the list, otherwise how can future readers
benefit from the permanent record of answers?
On Tue, Mar 13, 2012 at 03:43:07PM +0100, Alessandro Dentella wrote:
> On Tue, Mar 13, 2012 at 02:33:13PM +0000, Richard W.M. Jones wrote:
> > On Tue, Mar 13, 2012 at 02:33:40PM +0100, Alessandro Dentella wrote:
> > > On Mon, Mar 12, 2012 at 08:36:32AM +0000, Richard W.M. Jones wrote:
> > > > If you're compiling from git, did you run ./autogen.sh? Did it
> > > > run successfully?
> > >
> > > no, I used the package at [1]. After you e-mail I also cloned the git repo
> > > and run autogen.sh that ends with
> > >
> > > # Rerun the generator (requires OCaml interpreter). This is *not* for
> > > # anything that is required at configure-time when configure is run
> > > # from a distribution tarball. From those, nothing ocaml-related is
> > > # required.
> > > mkdir -p perl/lib/Win
> > > ./generator/generator.ml
> > > /usr/bin/env: ocaml: permission denied
> > >
> > > And I don't have/need ocaml
> >
> > You need if you want to build from git, but not from tarballs,
> > although if you have Debian/Ubuntu you might as well just install the
> > OCaml compiler.
>
> isn't it possible to avoid it?
Yes, if you build from tarballs.
> > > [1] http://libguestfs.org/download/hivex/hivex-1.3.3.tar.gz
> > >
> > > Any more hints?
> >
> > You didn't mention what version of Debian or Ubuntu you are using.
>
> I'm testing on Ubuntu 10.04. I'm not using .deb since they're just for amd
> and I'm on i386.
Yes, there is some problem with Ubuntu 10.04; I can reproduce it here,
but it probably just requires updating gnulib. I'll try to see if
that helps ...
Rich.
--
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, 9 months
Re: [Libguestfs] Compilation troubles
by Richard W.M. Jones
Please keep replies on the list.
On Mon, Mar 12, 2012 at 12:05:58AM +0100, Alessandro Dentella wrote:
> On Sun, Mar 11, 2012 at 09:50:35PM +0000, Richard W.M. Jones wrote:
> > On Sun, Mar 11, 2012 at 08:43:56PM +0100, Alessandro Dentella wrote:
> > > Hi,
> > >
> > > I'm trying to compile hivex library that I just discovered. I'd use binaries
> > > but I only have an i386 ubuntu and debian so I tryied to compile.
> > >
> > > ./configure finished with incouraging::
> > >
> > > -----------------------------------------------------------
> > > Thank you for downloading hivex 1.3.3
> > >
> > > This is how we have configured the optional components for you today:
> > >
> > > OCaml bindings ...................... no
> > > Perl bindings ....................... yes
> > > Python bindings ..................... yes
> > > Ruby bindings ....................... no
> > >
> > > If any optional component is configured 'no' when you expected 'yes'
> > > then you should check the preceeding messages.
> > >
> > > Please report bugs back to the mailing list:
> > > http://www.redhat.com/mailman/listinfo/libguestfs
> > >
> > > Next you should type 'make' to build the package,
> > > then 'make check' to run the tests.
> > > ------------------------------------------------------------
> > >
> > >
> > > but then compilation end badly::
> > >
> > > Making all in xml
> > > make[2]: Entering directory `/tmp/hivex-1.3.3/xml'
> > > CCLD hivexml
> > > hivexml-hivexml.o: In function `main':
> > > /tmp/hivex-1.3.3/xml/hivexml.c:96: undefined reference to `rpl_getopt'
> > > /tmp/hivex-1.3.3/xml/hivexml.c:110: undefined reference to `rpl_optind'
> > > /tmp/hivex-1.3.3/xml/hivexml.c:154: undefined reference to `rpl_optind'
> > > collect2: ld returned 1 exit status
> > > make[2]: *** [hivexml] Error 1
> > > make[2]: Leaving directory `/tmp/hivex-1.3.3/xml'
> > > make[1]: *** [all-recursive] Error 1
> > > make[1]: Leaving directory `/tmp/hivex-1.3.3'
> > > make: *** [all] Errore 2
> > >
> > >
> > > And I'm not enought skilled to understand it. The error is on ubuntu 10.04.
> > > A complete log can be viewd at http://pastebin.com/0s9UnxPh
> >
> > I don't understand why you see the error, but it comes from gnulib.
> > Is gnulib/lib/libgnu.a getting built and does it contain the
>
> no, it's not there
If you're compiling from git, did you run ./autogen.sh? Did it
run successfully?
Rich.
--
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, 9 months
[PATCH 0/2] 'int' to 'size_t' changes
by Richard W.M. Jones
These two patches are probably not completely independent, but
separating them is a lot of work.
With *both* patches applied, all the tests and extra-tests pass.
That's no guarantee however that there isn't a mistake, so I don't
think this patch is a candidate for the 1.16 branch, until it's had a
lot more testing in development.
Rich.
12 years, 9 months