[PATCH] sysprep: handle distro specific sysv scripts
by Olaf Hering
Currently firstboot would only work on redhat-based images.
Handle redhat-based, suse-based and debian guests, error out in case of an
unknown distro.
Update firstboot.sh:
- make sure scripts exists and can be executed
- add LSB header to avoid insserv warnings later on
- run script only if called with "start"
Update functions, pass only required options.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
diff --git a/sysprep/firstboot.ml b/sysprep/firstboot.ml
index 97cd8a9..c5296a1 100644
--- a/sysprep/firstboot.ml
+++ b/sysprep/firstboot.ml
@@ -28,14 +28,35 @@ let firstboot_dir = "/usr/lib/virt-sysprep"
let firstboot_sh = sprintf "\
#!/bin/sh -
+### BEGIN INIT INFO
+# Provides: virt-sysprep
+# Required-Start: $null
+# Should-Start: $all
+# Required-Stop: $null
+# Should-Stop: $all
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Start scripts to run once at next boot
+# Description: Start scripts to run once at next boot
+# These scripts run the first time the guest boots,
+# and then are deleted. Output or errors from the scripts
+# are written to ~root/virt-sysprep-firstboot.log.
+### END INIT INFO
+
d=%s/scripts
logfile=~root/virt-sysprep-firstboot.log
-for f in $d/* ; do
- echo '=== Running' $f '===' >>$logfile
- $f >>$logfile 2>&1
- rm $f
-done
+if test \"$1\" = \"start\"
+then
+ for f in $d/* ; do
+ if test -x \"$f\"
+ then
+ echo '=== Running' $f '===' >>$logfile
+ $f >>$logfile 2>&1
+ rm -f $f
+ fi
+ done
+fi
" firstboot_dir
let firstboot_service = sprintf "\
@@ -56,7 +77,7 @@ WantedBy=default.target
let failed fs =
ksprintf (fun msg -> failwith (s_"firstboot: failed: " ^ msg)) fs
-let rec install_service g root =
+let rec install_service g distro =
g#mkdir_p firstboot_dir;
g#mkdir_p (sprintf "%s/scripts" firstboot_dir);
g#write (sprintf "%s/firstboot.sh" firstboot_dir) firstboot_sh;
@@ -64,18 +85,18 @@ let rec install_service g root =
(* systemd, else assume sysvinit *)
if g#is_dir "/etc/systemd" then
- install_systemd_service g root
+ install_systemd_service g
else
- install_sysvinit_service g root
+ install_sysvinit_service g distro
(* Install the systemd firstboot service, if not installed already. *)
-and install_systemd_service g root =
+and install_systemd_service g =
g#write (sprintf "%s/firstboot.service" firstboot_dir) firstboot_service;
g#mkdir_p "/etc/systemd/system/default.target.wants";
g#ln_sf (sprintf "%s/firstboot.service" firstboot_dir)
"/etc/systemd/system/default.target.wants"
-and install_sysvinit_service g root =
+and install_sysvinit_redhat g =
g#mkdir_p "/etc/rc.d/rc2.d";
g#mkdir_p "/etc/rc.d/rc3.d";
g#mkdir_p "/etc/rc.d/rc5.d";
@@ -86,12 +107,51 @@ and install_sysvinit_service g root =
g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
"/etc/rc.d/rc5.d/99virt-sysprep-firstboot"
+(* Make firstboot.sh look like a runlevel script to avoid insserv warnings. *)
+and install_sysvinit_suse g =
+ g#mkdir_p "/etc/init.d/rc2.d";
+ g#mkdir_p "/etc/init.d/rc3.d";
+ g#mkdir_p "/etc/init.d/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_debian g =
+ g#mkdir_p "/etc/init.d";
+ g#mkdir_p "/etc/rc2.d";
+ g#mkdir_p "/etc/rc3.d";
+ g#mkdir_p "/etc/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_service g distro =
+ match distro with
+ | ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based") ->
+ install_sysvinit_redhat g
+ | ("opensuse"|"sles"|"suse-based") ->
+ install_sysvinit_suse g
+ | "debian" ->
+ install_sysvinit_debian g
+ | _ ->
+ failed "guest type %s is not supported" distro
+
let add_firstboot_script g root id content =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
| "linux", _ ->
- install_service g root;
+ install_service g distro;
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%Ld-%s-%s" firstboot_dir t r id in
--
1.7.12
10 years, 11 months
[PATCH V2] virt-diff: add new virt-diff tool
by Wanlong Gao
add new virt-diff tool
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
Hi Rich,
It can work now, please give some comments. ;)
Cheers,
Wanlong Gao
cat/Makefile.am | 20 ++-
cat/virt-diff.c | 525 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
po/POTFILES | 1 +
3 files changed, 545 insertions(+), 1 deletion(-)
create mode 100644 cat/virt-diff.c
diff --git a/cat/Makefile.am b/cat/Makefile.am
index f7c763a..5f6a986 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -27,7 +27,7 @@ EXTRA_DIST = \
CLEANFILES = stamp-virt-cat.pod stamp-virt-ls.pod stamp-virt-filesystems.pod
-bin_PROGRAMS = virt-cat virt-filesystems virt-ls
+bin_PROGRAMS = virt-cat virt-filesystems virt-ls virt-diff
SHARED_SOURCE_FILES = \
../fish/config.c \
@@ -91,6 +91,24 @@ virt_ls_LDADD = \
$(top_builddir)/src/libguestfs.la \
../gnulib/lib/libgnu.la
+virt_diff_SOURCES = \
+ ../fish/keys.c \
+ virt-diff.c
+
+virt_diff_CFLAGS = \
+ -DGUESTFS_WARN_DEPRECATED=1 \
+ -I$(top_srcdir)/src -I$(top_builddir)/src \
+ -I$(top_srcdir)/fish \
+ -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
+ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
+ $(WARN_CFLAGS) $(WERROR_CFLAGS) \
+ $(LIBCONFIG_CFLAGS)
+
+virt_diff_LDADD = \
+ $(LIBCONFIG_LIBS) \
+ $(top_builddir)/src/libguestfs.la \
+ ../gnulib/lib/libgnu.la
+
# Manual pages and HTML files for the website.
man_MANS = virt-cat.1 virt-filesystems.1 virt-ls.1
diff --git a/cat/virt-diff.c b/cat/virt-diff.c
new file mode 100644
index 0000000..c2c59a6
--- /dev/null
+++ b/cat/virt-diff.c
@@ -0,0 +1,525 @@
+/* virt-diff
+ * Copyright (C) 2012 Fujitsu Limited.
+ * Copyright (C) 2012 Red Hat Inc.
+ *
+ * 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.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <string.h>
+#include <inttypes.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <assert.h>
+#include <time.h>
+#include <libintl.h>
+#include <sys/wait.h>
+
+#include "c-ctype.h"
+
+#include "human.h"
+#include "progname.h"
+
+#include "guestfs.h"
+#include "options.h"
+
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
+int keys_from_stdin = 0;
+int echo_keys = 0;
+/* libguestfs handle for seed. */
+static guestfs_h *sg;
+
+/* libguestfs handle for temp. */
+static guestfs_h *dg;
+
+const char *libvirt_uri = NULL;
+
+static inline char *
+diff_bad_case (char const *s)
+{
+ return (char *) s;
+}
+
+static void __attribute__((noreturn))
+diff_usage (int status)
+{
+ if (status != EXIT_SUCCESS) {
+ fprintf (stderr, _("Try `%s --help' for more information.\n"),
+ program_name);
+ } else {
+ fprintf (stdout,
+ _("%s: Show the differences between seed Guest and the others\n"
+ "Copyright (C) 2012 Fujitsu Limited.\n"
+ "Copyright (C) 2012 Red Hat Inc.\n"
+ "Usage:\n"
+ " %s [--options] -s domname -d domname path\n"
+ "Options:\n"
+ " -c|--connect uri Specify libvirt URI for -s and -d options\n"
+ " -s|--seed guest Add seed disk from libvirt guest\n"
+ " -d|--domain guest Add target disk from libvirt guest\n"
+ " --keys-from-stdin Read passphrases from stdin\n"
+ " --echo-keys Don't turn off echo for passphrases\n"
+ " --help Display brief help\n"),
+ program_name, program_name);
+ }
+ exit (status);
+}
+
+/* Make a LUKS map name from the partition name,
+ * eg "/dev/vda2" => "luksvda2"
+ */
+static void
+diff_make_mapname (const char *device, char *mapname, size_t len)
+{
+ size_t i = 0;
+
+ if (len < 5)
+ abort ();
+ strcpy (mapname, "luks");
+ mapname += 4;
+ len -= 4;
+
+ if (STRPREFIX (device, "/dev/"))
+ i = 5;
+
+ for (; device[i] != '\0' && len >= 1; ++i) {
+ if (c_isalnum (device[i])) {
+ *mapname++ = device[i];
+ len--;
+ }
+ }
+
+ *mapname = '\0';
+}
+
+static void
+free_strings (char **strings)
+{
+ size_t i;
+
+ for (i = 0; strings[i] != NULL; ++i)
+ free (strings[i]);
+ free (strings);
+}
+
+static size_t
+count_strings (char **strings)
+{
+ size_t i;
+
+ for (i = 0; strings[i] != NULL; ++i)
+ ;
+ return i;
+}
+
+/* Simple implementation of decryption: look for any crypto_LUKS
+ * partitions and decrypt them, then rescan for VGs. This only works
+ * for Fedora whole-disk encryption. WIP to make this work for other
+ * encryption schemes.
+ */
+static void
+diff_inspect_do_decrypt (guestfs_h *g)
+{
+ char **partitions = guestfs_list_partitions (g);
+ if (partitions == NULL)
+ exit (EXIT_FAILURE);
+
+ int need_rescan = 0;
+ size_t i;
+ for (i = 0; partitions[i] != NULL; ++i) {
+ char *type = guestfs_vfs_type (g, partitions[i]);
+ if (type && STREQ (type, "crypto_LUKS")) {
+ char mapname[32];
+ diff_make_mapname (partitions[i], mapname, sizeof mapname);
+
+ char *key = read_key (partitions[i]);
+ /* XXX Should we call guestfs_luks_open_ro if readonly flag
+ * is set? This might break 'mount_ro'.
+ */
+ if (guestfs_luks_open (g, partitions[i], key, mapname) == -1)
+ exit (EXIT_FAILURE);
+
+ free (key);
+
+ need_rescan = 1;
+ }
+ free (type);
+ }
+
+ free_strings (partitions);
+
+ if (need_rescan) {
+ if (guestfs_vgscan (g) == -1)
+ exit (EXIT_FAILURE);
+ if (guestfs_vg_activate_all (g, 1) == -1)
+ exit (EXIT_FAILURE);
+ }
+}
+
+static int
+compare_keys (const void *p1, const void *p2)
+{
+ const char *key1 = * (char * const *) p1;
+ const char *key2 = * (char * const *) p2;
+
+ return strcmp (key1, key2);
+}
+
+static int
+compare_keys_len (const void *p1, const void *p2)
+{
+ const char *key1 = * (char * const *) p1;
+ const char *key2 = * (char * const *) p2;
+ int c;
+
+ c = strlen (key1) - strlen (key2);
+ if (c != 0)
+ return c;
+
+ return compare_keys (p1, p2);
+}
+
+static void
+diff_inspect_mount_root (guestfs_h *g, const char *root)
+{
+ char **mountpoints = guestfs_inspect_get_mountpoints (g, root);
+ if (mountpoints == NULL)
+ exit (EXIT_FAILURE);
+
+ /* Sort by key length, shortest key first, so that we end up
+ * mounting the filesystems in the correct order.
+ */
+ qsort (mountpoints, count_strings (mountpoints) / 2, 2 * sizeof (char *),
+ compare_keys_len);
+
+ size_t i;
+ size_t mount_errors = 0;
+ for (i = 0; mountpoints[i] != NULL; i += 2) {
+ int r;
+ r = guestfs_mount_ro (g, mountpoints[i+1], mountpoints[i]);
+ if (r == -1) {
+ /* If the "/" filesystem could not be mounted, give up, else
+ * just count the errors and print a warning.
+ */
+ if (STREQ (mountpoints[i], "/"))
+ exit (EXIT_FAILURE);
+ mount_errors++;
+ }
+ }
+
+ free_strings (mountpoints);
+
+ if (mount_errors)
+ fprintf (stderr, _("%s: some filesystems could not be mounted (ignored)\n"),
+ program_name);
+}
+
+/* This function implements the -i option. */
+static void
+diff_inspect_mount (guestfs_h *g)
+{
+ const char *root = NULL;
+ diff_inspect_do_decrypt (g);
+
+ char **roots = guestfs_inspect_os (g);
+ if (roots == NULL)
+ exit (EXIT_FAILURE);
+
+ if (roots[0] == NULL) {
+ fprintf (stderr,
+ _("%s: no operating system was found on this disk\n"
+ "\n"
+ "If using guestfish '-i' option, remove this option and instead\n"
+ "use the commands 'run' followed by 'list-filesystems'.\n"
+ "You can then mount filesystems you want by hand using the\n"
+ "'mount' or 'mount-ro' command.\n"
+ "\n"
+ "If using guestmount '-i', remove this option and choose the\n"
+ "filesystem(s) you want to see by manually adding '-m' option(s).\n"
+ "Use 'virt-filesystems' to see what filesystems are available.\n"
+ "\n"
+ "If using other virt tools, this disk image won't work\n"
+ "with these tools. Use the guestfish equivalent commands\n"
+ "(see the virt tool manual page).\n"),
+ program_name);
+ free_strings (roots);
+ exit (EXIT_FAILURE);
+ }
+
+ if (roots[1] != NULL) {
+ fprintf (stderr,
+ _("%s: multi-boot operating systems are not supported\n"
+ "\n"
+ "If using guestfish '-i' option, remove this option and instead\n"
+ "use the commands 'run' followed by 'list-filesystems'.\n"
+ "You can then mount filesystems you want by hand using the\n"
+ "'mount' or 'mount-ro' command.\n"
+ "\n"
+ "If using guestmount '-i', remove this option and choose the\n"
+ "filesystem(s) you want to see by manually adding '-m' option(s).\n"
+ "Use 'virt-filesystems' to see what filesystems are available.\n"
+ "\n"
+ "If using other virt tools, multi-boot operating systems won't work\n"
+ "with these tools. Use the guestfish equivalent commands\n"
+ "(see the virt tool manual page).\n"),
+ program_name);
+ free_strings (roots);
+ exit (EXIT_FAILURE);
+ }
+
+ root = roots[0];
+ free (roots);
+
+ diff_inspect_mount_root (g, root);
+}
+
+static void
+free_drive (struct drv *drv)
+{
+ if (!drv) return;
+
+ free (drv->device);
+ free (drv);
+}
+
+int
+main (int argc, char *argv[])
+{
+ /* set global program name that is not polluted with libtool artifacts. */
+ set_program_name (argv[0]);
+ bindtextdomain (PACKAGE, LOCALEBASEDIR);
+ textdomain (PACKAGE);
+
+ enum { HELP_OPTION = CHAR_MAX + 1 };
+
+ static const char *options = "s:d:";
+ static const struct option long_options[] = {
+ {"seed", 1, 0, 's'},
+ {"domain", 1, 0, 'd'},
+ {"help", 0, 0, HELP_OPTION},
+ {0, 0, 0, 0}
+ };
+
+ struct drv *sdrv = NULL;
+ struct drv *ddrv = NULL;
+ int c, nr;
+ int option_index;
+ int spid, dpid;
+
+ sg = guestfs_create ();
+ if (sg == NULL) {
+ fprintf (stderr, _("guestfs_create: failed to create seed handle\n"));
+ exit (EXIT_FAILURE);
+ }
+
+ dg = guestfs_create ();
+ if (dg == NULL) {
+ fprintf (stderr, _("guestfs_create: failed to create comparison handle\n"));
+ exit (EXIT_FAILURE);
+ }
+
+ argv[0] = diff_bad_case (program_name);
+
+ for (;;) {
+ c = getopt_long (argc, argv, options, long_options, &option_index);
+ if (c == -1) break;
+
+ switch (c) {
+ case 0:
+ if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
+ keys_from_stdin = 1;
+ } else if (STREQ (long_options[option_index].name, "echo-keys")) {
+ echo_keys = 1;
+ } else if (STREQ (long_options[option_index].name, "seed")) {
+ if (sdrv) {
+ fprintf(stderr, _("Only one seed device"));
+ exit (EXIT_FAILURE);
+ }
+ sdrv = calloc (1, sizeof (struct drv));
+ if (!sdrv) {
+ perror ("malloc");
+ exit (EXIT_FAILURE);
+ }
+ sdrv->type = drv_d;
+ sdrv->nr_drives = -1;
+ sdrv->d.guest = optarg;
+ sdrv->next = NULL;
+ } else if (STREQ (long_options[option_index].name, "domain")) {
+ if (ddrv) {
+ fprintf (stderr, _("Only one diff device"));
+ exit (EXIT_FAILURE);
+ }
+ ddrv = calloc (1, sizeof (struct drv));
+ if (!ddrv) {
+ perror ("malloc");
+ exit (EXIT_FAILURE);
+ }
+ ddrv->type = drv_d;
+ ddrv->nr_drives = -1;
+ ddrv->d.guest = optarg;
+ ddrv->next = NULL;
+ } else {
+ fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
+ program_name, long_options[option_index].name, option_index);
+ exit (EXIT_FAILURE);
+ }
+ break;
+
+ case 'c':
+ libvirt_uri = optarg;
+
+ case 's':
+ if (sdrv) {
+ fprintf(stderr, _("Only one seed device"));
+ exit (EXIT_FAILURE);
+ }
+ sdrv = calloc (1, sizeof (struct drv));
+ if (!sdrv) {
+ perror ("malloc");
+ exit (EXIT_FAILURE);
+ }
+ sdrv->type = drv_d;
+ sdrv->nr_drives = -1;
+ sdrv->d.guest = optarg;
+ sdrv->next = NULL;
+ break;
+
+ case 'd':
+ if (ddrv) {
+ fprintf (stderr, _("Only one diff device"));
+ exit (EXIT_FAILURE);
+ }
+ ddrv = calloc (1, sizeof (struct drv));
+ if (!ddrv) {
+ perror ("malloc");
+ exit (EXIT_FAILURE);
+ }
+ ddrv->type = drv_d;
+ ddrv->nr_drives = -1;
+ ddrv->d.guest = optarg;
+ ddrv->next = NULL;
+ break;
+
+ case HELP_OPTION:
+ diff_usage (EXIT_SUCCESS);
+
+ default:
+ diff_usage (EXIT_FAILURE);
+ }
+ }
+
+ if (sdrv == NULL)
+ diff_usage (EXIT_FAILURE);
+ if (ddrv == NULL)
+ diff_usage (EXIT_FAILURE);
+
+ struct guestfs_add_domain_argv optargs = {
+ .bitmask = 0,
+ .libvirturi = libvirt_uri,
+ .readonly = 1,
+ .allowuuid = 1,
+ .readonlydisk = "read",
+ };
+ nr = guestfs_add_domain_argv (sg, sdrv->d.guest, &optargs);
+ if (nr == -1)
+ exit (EXIT_FAILURE);
+ sdrv->nr_drives = nr;
+ nr = guestfs_add_domain_argv (dg, ddrv->d.guest, &optargs);
+ if (nr == -1)
+ exit (EXIT_FAILURE);
+ ddrv->nr_drives = nr;
+
+ if (guestfs_launch (sg) == -1)
+ exit (EXIT_FAILURE);
+ if (guestfs_launch (dg) == -1)
+ exit (EXIT_FAILURE);
+
+ diff_inspect_mount (sg);
+ diff_inspect_mount (dg);
+
+ char stempdir[] = "/tmp/sGuestXXXXXX";
+ char dtempdir[] = "/tmp/dGuestXXXXXX";
+
+ if (mkdtemp (stempdir) == NULL) {
+ perror ("mkdtemp");
+ exit (EXIT_FAILURE);
+ }
+ if (mkdtemp (dtempdir) == NULL) {
+ perror ("mkdtemp");
+ exit (EXIT_FAILURE);
+ }
+
+ if (guestfs_mount_local (sg, stempdir, -1) == -1)
+ exit (EXIT_FAILURE);
+ if (guestfs_mount_local (dg, dtempdir, -1) == -1)
+ exit (EXIT_FAILURE);
+
+ spid = fork ();
+ if (spid == -1) {
+ perror ("fork");
+ exit (EXIT_FAILURE);
+ }
+ if (spid == 0) {
+ if (guestfs_mount_local_run (sg) == -1)
+ exit (EXIT_FAILURE);
+ _exit (EXIT_SUCCESS);
+ }
+
+ dpid = fork();
+ if (dpid == -1) {
+ perror ("fork");
+ exit (EXIT_FAILURE);
+ }
+ if (dpid == 0) {
+ if (guestfs_mount_local_run (dg) == -1)
+ exit (EXIT_FAILURE);
+ _exit (EXIT_SUCCESS);
+ }
+
+ const char *dir = argv[optind];
+ char system_arg[BUFSIZ];
+ sprintf (system_arg, "diff -urN %s%s %s%s", stempdir, dir,
+ dtempdir, dir);
+ sleep (5);
+ if (system (system_arg) == -1)
+ exit (EXIT_FAILURE);
+
+ guestfs_umount_local (sg, GUESTFS_UMOUNT_LOCAL_RETRY, 1, -1);
+ waitpid (spid, NULL, 0);
+ guestfs_umount_local (dg, GUESTFS_UMOUNT_LOCAL_RETRY, 1, -1);
+ waitpid (dpid, NULL, 0);
+
+ if (guestfs_shutdown (sg) == -1)
+ exit (EXIT_FAILURE);
+ if (guestfs_shutdown (dg) == -1)
+ exit (EXIT_FAILURE);
+
+ free_drive (sdrv);
+ free_drive (ddrv);
+
+ guestfs_close (sg);
+ guestfs_close (dg);
+
+ exit (EXIT_SUCCESS);
+}
diff --git a/po/POTFILES b/po/POTFILES
index dffa899..3f51648 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -1,6 +1,7 @@
align/domains.c
align/scan.c
cat/virt-cat.c
+cat/virt-diff.c
cat/virt-filesystems.c
cat/virt-ls.c
daemon/9p.c
--
1.7.12.rc1
12 years
simplify debugging of guestfsd
by Olaf Hering
Sometimes guestfsd fails to gather info, and the virt-<tool> -v output
is usually not useful to figure out whats going on within the temporary
guest. I see the /init script has support to run guestfsd with a debug
tool, which is currently valgrind.
Granted, valgrind support is a compile time thing. What would be a good
way to optionally run guestfsd with strace or gdb?
Should each tool get a new option, something like 'virt-<tool>
--debug=strace', or should it be like 'XYZ_STRACE=1 virt-<tool>'?
Olaf
12 years, 1 month
Fwd: hivex: patch for read support of "li"-records from "ri" intermediate
by Richard W.M. Jones
[The bug which this fixes is:
https://bugzilla.redhat.com/show_bug.cgi?id=717583 ]
----- Forwarded message from Peter Fokker <peter(a)berestijn.nl> -----
Date: Thu, 8 Mar 2012 11:37:06 +0100 (CET)
From: Peter Fokker <peter(a)berestijn.nl>
To: rjones(a)redhat.com
Cc: Peter Fokker <peter(a)berestijn.nl>
Subject: hivex: patch for read support of "li"-records from "ri"
intermediate
User-Agent: SquirrelMail/1.4.9a
Richard,
Thank you for creating the hivex-library. Studying your source code helped
me a great deal to better understand the internals of the Windows Registry.
However, while I was browsing a real-world SOFTWARE-hive (XP, SP3) I
could not browse to the '\Classes' key. Instead I got this (debug)-message:
get_children: returning ENOTSUP because ri-record offset does not
point to lf/lh (0x49020)
I tracked this issue down and I discovered that the intermediate
"ri"-record may not only contain offsets to "lf" and "lh" but to
"li"-records too.
Attached is a patch against hivex.c v1.3.3 that recognises
"li"-records referenced from "ri"-records. For me this fixed the issue
with browsing the '\Classes' key.
Note that I have not fixed the related problem of rewriting
"li"-records when inserting a new subkey or deleting an
existing one. This sure would cause problems when I were to
add/delete a subkey to/from '\Classes'.
I would very much appreciate it if would be so kind to take a look at
my patch, allthough I cannot blame you if you immediately dump this
unsollicited message+patch from some random stranger from The Netherlands.
Kind regards,
--Peter Fokker
--
Peter Fokker <peter(a)berestijn.nl>
Ingenieursbureau PSD +31 35 695 29 99 / +31 644 238 568
Stargardlaan 7 1404 BC Bussum, The Netherlands
----- End forwarded message -----
--
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, 1 month
no man page for guestfsd
by Olaf Hering
rpmlint complains that guestfsd has no man page. I think its a good
idea to provide one also for guestfsd.
Olaf
12 years, 1 month
[PATCH v2] inspection: Fix calls to case_sensitive_path (RHBZ#858126).
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
Don't assume that if guestfs_case_sensitive_path returns NULL, that it
means the file does not exist.
The (previously undefined) behaviour of case_sensitive_path was that a
NULL return meant "either the file doesn't exist or some other error".
However in commit 973581780d8a006f336684fef6762801402d775d this was
changed so that if the last element of the path didn't exist, it was
assumed to be a new file and the (non-NULL) path of the new file is
returned.
This change breaks code (including in libguestfs) which tries to use
case_sensitive_path as a dual-purpose call to fix-up a path for
Windows and test if the file exists. Such code should be rewritten so
that it explicitly tests for file existence after calling
case_sensitive_path.
I examined all the calls to case_sensitive_path in libguestfs and
modified them where necessary.
---
examples/virt-dhcp-address.c | 4 +---
perl/lib/Sys/Guestfs/Lib.pm | 3 +++
src/inspect-apps.c | 7 ++-----
src/inspect-fs-windows.c | 41 +++++++++++++++++++++++++++--------------
tools/virt-win-reg | 14 ++------------
5 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/examples/virt-dhcp-address.c b/examples/virt-dhcp-address.c
index c4e3647..df06ebe 100644
--- a/examples/virt-dhcp-address.c
+++ b/examples/virt-dhcp-address.c
@@ -206,10 +206,8 @@ print_dhcp_address_windows (guestfs_h *g, char *root_fs)
/* Locate the SYSTEM hive case-sensitive path. */
system_path =
guestfs_case_sensitive_path (g, "/windows/system32/config/system");
- if (!system_path) {
- fprintf (stderr, "virt-dhcp-address: HKLM\\System not found in this guest.");
+ if (!system_path)
exit (EXIT_FAILURE);
- }
/* Open the hive to parse it. Note that before libguestfs 1.19.35
* you had to download the file and parse it using hivex(3). Since
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 33e8acb..5dde409 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -356,6 +356,9 @@ sub resolve_windows_path
my $r;
eval { $r = $g->case_sensitive_path ($path); };
+
+ $r = undef if defined $r && ! $g->exists ($r);
+
return $r;
}
diff --git a/src/inspect-apps.c b/src/inspect-apps.c
index e9f020a..f65c70a 100644
--- a/src/inspect-apps.c
+++ b/src/inspect-apps.c
@@ -418,12 +418,9 @@ list_applications_windows (guestfs_h *g, struct inspect_fs *fs)
snprintf (software, len, "%s/system32/config/software",
fs->windows_systemroot);
- char *software_path = guestfs___case_sensitive_path_silently (g, software);
- if (!software_path) {
- /* Missing software hive is a problem. */
- error (g, "no HKLM\\SOFTWARE hive found in the guest");
+ char *software_path = guestfs_case_sensitive_path (g, software);
+ if (!software_path)
return NULL;
- }
struct guestfs_application_list *ret = NULL;
const char *hivepath[] =
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index c3a5aba..af75871 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -157,11 +157,9 @@ guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs)
return -1;
}
- systemroot = guestfs___case_sensitive_path_silently (g, systemroots[i]);
- if (!systemroot) {
- error (g, _("cannot resolve Windows %%SYSTEMROOT%%"));
+ systemroot = guestfs_case_sensitive_path (g, systemroots[i]);
+ if (!systemroot)
return -1;
- }
debug (g, "windows %%SYSTEMROOT%% = %s", systemroot);
@@ -189,9 +187,10 @@ check_windows_arch (guestfs_h *g, struct inspect_fs *fs)
char cmd_exe[len];
snprintf (cmd_exe, len, "%s/system32/cmd.exe", fs->windows_systemroot);
- char *cmd_exe_path = guestfs___case_sensitive_path_silently (g, cmd_exe);
+ /* Should exist because of previous check above in has_windows_systemroot. */
+ char *cmd_exe_path = guestfs_case_sensitive_path (g, cmd_exe);
if (!cmd_exe_path)
- return 0;
+ return -1;
char *arch = guestfs_file_architecture (g, cmd_exe_path);
free (cmd_exe_path);
@@ -210,17 +209,24 @@ static int
check_windows_software_registry (guestfs_h *g, struct inspect_fs *fs)
{
int ret = -1;
+ int r;
size_t len = strlen (fs->windows_systemroot) + 64;
char software[len];
snprintf (software, len, "%s/system32/config/software",
fs->windows_systemroot);
- char *software_path = guestfs___case_sensitive_path_silently (g, software);
+ char *software_path = guestfs_case_sensitive_path (g, software);
if (!software_path)
- /* If the software hive doesn't exist, just accept that we cannot
- * find product_name etc.
- */
+ return -1;
+
+ r = guestfs_is_file (g, software_path);
+ if (r == -1)
+ return -1;
+ /* If the software hive doesn't exist, just accept that we cannot
+ * find product_name etc.
+ */
+ if (r == 0)
return 0;
int64_t node;
@@ -312,16 +318,23 @@ check_windows_software_registry (guestfs_h *g, struct inspect_fs *fs)
static int
check_windows_system_registry (guestfs_h *g, struct inspect_fs *fs)
{
+ int r;
size_t len = strlen (fs->windows_systemroot) + 64;
char system[len];
snprintf (system, len, "%s/system32/config/system",
fs->windows_systemroot);
- char *system_path = guestfs___case_sensitive_path_silently (g, system);
+ char *system_path = guestfs_case_sensitive_path (g, system);
if (!system_path)
- /* If the system hive doesn't exist, just accept that we cannot
- * find hostname etc.
- */
+ return -1;
+
+ r = guestfs_is_file (g, system_path);
+ if (r == -1)
+ return -1;
+ /* If the system hive doesn't exist, just accept that we cannot
+ * find hostname etc.
+ */
+ if (r == 0)
return 0;
int ret = -1;
diff --git a/tools/virt-win-reg b/tools/virt-win-reg
index 9e053dd..0a1b754 100755
--- a/tools/virt-win-reg
+++ b/tools/virt-win-reg
@@ -516,12 +516,7 @@ sub download_hive
my $hivefile = shift;
my $hiveshortname = shift;
- my $winfile;
- eval { $winfile = $g->case_sensitive_path ($hivefile); };
- if ($@) {
- die __x("virt-win-reg: {p}: file not found in guest: {err}\n",
- p => $hivefile, err => $@);
- }
+ my $winfile = $g->case_sensitive_path ($hivefile);
warn "downloading $winfile ..." if $debug;
eval { $g->download ($winfile, "$tmpdir/$hiveshortname"); };
@@ -538,12 +533,7 @@ sub upload_hive
my $hiveshortname = shift;
my $hivefile = shift;
- my $winfile;
- eval { $winfile = $g->case_sensitive_path ($hivefile); };
- if ($@) {
- die __x("virt-win-reg: {p}: file not found in guest: {err}\n",
- p => $hivefile, err => $@);
- }
+ my $winfile = $g->case_sensitive_path ($hivefile);
warn "uploading $winfile ..." if $debug;
eval { $g->upload ("$tmpdir/$hiveshortname", $winfile); };
--
1.7.11.4
12 years, 1 month
Re: [Libguestfs] guestfish hang when exec command.
by xuanmao_001
[root@localhost ~]# libguestfs-test-tool
===== Test starts here =====
LIBGUESTFS_PATH=/usr/local/lib/guestfs/appliance/
TMPDIR=(not set)
library version: 1.18.7
guestfs_get_append: (null)
guestfs_get_attach_method: appliance
guestfs_get_autosync: 1
guestfs_get_direct: 0
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/local/lib/guestfs/appliance/
guestfs_get_pgroup: 0
guestfs_get_qemu: /usr/libexec/qemu-kvm
guestfs_get_recovery_proc: 1
guestfs_get_selinux: 0
guestfs_get_smp: 1
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 60 seconds.
libguestfs: [00000ms] begin testing qemu features
libguestfs: [00017ms] finished testing qemu features
libguestfs: accept_from_daemon: 0x115f0f0 g->state = 1
[00019ms] /usr/libexec/qemu-kvm \
-global virtio-blk-pci.scsi=off \
-nodefconfig \
-nodefaults \
-nographic \
-drive file=/tmp/libguestfs-test-tool-sda-tEXoNC,cache=none,format=raw,if=virtio \
-machine accel=kvm:tcg \
-m 500 \
-no-reboot \
-no-hpet \
-device virtio-serial \
-serial stdio \
-device sga \
-chardev socket,path=/tmp/libguestfsJ8W9L0/guestfsd.sock,id=channel0 \
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-kernel /usr/local/lib/guestfs/appliance//kernel \
-initrd /usr/local/lib/guestfs/appliance//initrd \
-append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm ' \
-drive file=/usr/local/lib/guestfs/appliance//root,snapshot=on,if=virtio,cache=unsafe\x1b[1;256r\x1b[256;256H\x1b[6n
Google, Inc.
Serial Graphics Adapter 11/03/11
SGABIOS $Id$ (pbonzini(a)yakj.usersys.redhat.com) Thu Nov 3 13:33:51 UTC 2011
Term: 80x24
4 0
SeaBIOS (version pre-0.6.3-20110810_173319-rincewind.home.kraxel.org)
Booting from ROM...
Probing EDD (edd=off to disable)... ok
\x1b[2J[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.5.0-0.rc3.git0.4.bz835019.fc18.x86_64 (rjones(a)spin.home.annexia.org) (gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC) ) #1 SMP Mon Jun 25 18:39:15 BST 2012
[ 0.000000] Command line: panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009b7ff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009b800-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001f3fcfff] usable
[ 0.000000] BIOS-e820: [mem 0x000000001f3fd000-0x000000001f3fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] DMI 2.4 present.
[ 0.000000] No AGP bridge found
[ 0.000000] e820: last_pfn = 0x1f3fd max_arch_pfn = 0x400000000
[ 0.000000] PAT not supported by CPU.
[ 0.000000] found SMP MP-table at [mem 0x000fda70-0x000fda7f] mapped at [ffff8800000fda70]
[ 0.000000] init_memory_mapping: [mem 0x00000000-0x1f3fcfff]
[ 0.000000] RAMDISK: [mem 0x1f2c5000-0x1f3effff]
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000001f3fcfff]
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x1f3fcfff]
[ 0.000000] NODE_DATA [mem 0x1f2b1000-0x1f2c4fff]
[ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[ 0.000000] kvm-clock: cpu 0, msr 0:1cf4741, boot clock
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x00010000-0x00ffffff]
[ 0.000000] DMA32 [mem 0x01000000-0xffffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00010000-0x0009afff]
[ 0.000000] node 0: [mem 0x00100000-0x1f3fcfff]
[ 0.000000] SFI: Simple Firmware Interface v0.81 http://simplefirmware.org
[ 0.000000] Intel MultiProcessor Specification v1.4
[ 0.000000] MPTABLE: OEM ID: BOCHSCPU
[ 0.000000] MPTABLE: Product ID: 0.1
[ 0.000000] MPTABLE: APIC at: 0xFEE00000
[ 0.000000] Processor #0 (Bootup-CPU)
[ 0.000000] IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23
[ 0.000000] Processors: 1
[ 0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs
[ 0.000000] PM: Registered nosave memory: 000000000009b000 - 000000000009c000
[ 0.000000] PM: Registered nosave memory: 000000000009c000 - 00000000000a0000
[ 0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000f0000
[ 0.000000] PM: Registered nosave memory: 00000000000f0000 - 0000000000100000
[ 0.000000] e820: [mem 0x1f400000-0xfeffbfff] available for PCI devices
[ 0.000000] Booting paravirtualized kernel on KVM
[ 0.000000] setup_percpu: NR_CPUS:128 nr_cpumask_bits:128 nr_cpu_ids:1 nr_node_ids:1
[ 0.000000] PERCPU: Embedded 28 pages/cpu @ffff88001ee00000 s83072 r8192 d23424 u2097152
[ 0.000000] kvm-clock: cpu 0, msr 0:1ee13741, primary cpu clock
[ 0.000000] KVM setup async PF for cpu 0
[ 0.000000] kvm-stealtime: cpu 0, msr 1ee0df40
[ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 125874
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm
[ 0.000000] Disabling memory control group subsystem
[ 0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.000000] __ex_table already sorted, skipping sort
[ 0.000000] Checking aperture...
[ 0.000000] No AGP bridge found
[ 0.000000] Memory: 485880k/511988k available (6255k kernel code, 468k absent, 25640k reserved, 6925k data, 1016k init)
[ 0.000000] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] NR_IRQS:8448 nr_irqs:256 16
[ 0.000000] Console: colour *CGA 80x25
[ 0.000000] console [ttyS0] enabled
[ 0.000000] Detected 2593.484 MHz processor.
[ 0.001999] Calibrating delay loop (skipped) preset value.. 5186.96 BogoMIPS (lpj=2593484)
[ 0.003009] pid_max: default: 32768 minimum: 301
[ 0.003797] Security Framework initialized
[ 0.004065] SELinux: Disabled at boot.
[ 0.005163] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
[ 0.007602] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
[ 0.008234] Mount-cache hash table entries: 256
[ 0.009442] Initializing cgroup subsys cpuacct
[ 0.010018] Initializing cgroup subsys memory
[ 0.011055] Initializing cgroup subsys devices
[ 0.012012] Initializing cgroup subsys freezer
[ 0.012649] Initializing cgroup subsys net_cls
[ 0.013004] Initializing cgroup subsys blkio
[ 0.014005] Initializing cgroup subsys perf_event
[ 0.014790] mce: CPU supports 10 MCE banks
[ 0.015200] SMP alternatives: switching to UP code
[ 0.105737] Freeing SMP alternatives: 24k freed
[ 0.106091] ftrace: allocating 23068 entries in 91 pages
[ 0.115832] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[ 0.116001] CPU0: Intel QEMU Virtual CPU version 1.0,1 stepping 03
[ 0.219049] Performance Events: unsupported p6 CPU model 2 no PMU driver, software events only.
[ 0.220980] NMI watchdog: disabled (cpu0): hardware events not enabled
[ 0.221947] Brought up 1 CPUs
[ 0.221980] Total of 1 processors activated (5186.96 BogoMIPS).
[ 0.223505] devtmpfs: initialized
[ 0.225422] atomic64 test passed for x86-64 platform with CX8 and with SSE
[ 0.226107] RTC time: 10:28:03, date: 09/26/12
[ 0.227060] NET: Registered protocol family 16
[ 0.228463] PCI: Using configuration type 1 for base access
[ 0.230298] bio: create slab <bio-0> at 0
[ 0.231138] ACPI: Interpreter disabled.
[ 0.232015] vgaarb: loaded
[ 0.232543] SCSI subsystem initialized
[ 0.233120] usbcore: registered new interface driver usbfs
[ 0.233990] usbcore: registered new interface driver hub
[ 0.234770] usbcore: registered new device driver usb
[ 0.235058] PCI: Probing PCI hardware
[ 0.236009] PCI host bridge to bus 0000:00
[ 0.236597] pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
[ 0.236990] pci_bus 0000:00: root bus resource [mem 0x00000000-0xffffffffff]
[ 0.241196] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
[ 0.241989] pci 0000:00:01.3: quirk: [io 0xb100-0xb10f] claimed by PIIX4 SMB
[ 0.258164] pci 0000:00:01.0: PIIX/ICH IRQ router [8086:7000]
[ 0.259423] NetLabel: Initializing
[ 0.259986] NetLabel: domain hash size = 128
[ 0.260620] NetLabel: protocols = UNLABELED CIPSOv4
[ 0.261029] NetLabel: unlabeled traffic allowed by default
[ 0.262067] Switching to clocksource kvm-clock
[ 0.270448] pnp: PnP ACPI: disabled
[ 0.273082] NET: Registered protocol family 2
[ 0.273785] IP route cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.274960] TCP established hash table entries: 16384 (order: 6, 262144 bytes)
[ 0.276554] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[ 0.277850] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.279108] TCP: reno registered
[ 0.279587] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.280451] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.281497] NET: Registered protocol family 1
[ 0.282205] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[ 0.283132] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[ 0.283974] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[ 0.285397] Unpacking initramfs...
[ 0.288787] Freeing initrd memory: 1196k freed
[ 0.290479] platform rtc_cmos: registered platform RTC device (no PNP device found)
[ 0.291987] Initialise module verification
[ 0.292678] audit: initializing netlink socket (disabled)
[ 0.293450] type=2000 audit(1348655284.292:1): initialized
[ 0.311804] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[ 0.314175] VFS: Disk quotas dquot_6.5.2
[ 0.314827] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.316110] msgmni has been set to 951
[ 0.316715] Key type crypto registered
[ 0.317256] Crypto key parser 'pgp' registered
[ 0.318202] alg: No test for stdrng (krng)
[ 0.318801] NET: Registered protocol family 38
[ 0.319483] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[ 0.320537] io scheduler noop registered
[ 0.321135] io scheduler deadline registered
[ 0.321870] io scheduler cfq registered (default)
[ 0.322856] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 0.323700] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[ 0.324617] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[ 0.325830] virtio-pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 34
[ 0.327109] virtio-pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 35
[ 0.328410] virtio-pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 35
[ 0.329671] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 0.352762] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 0.438538] Non-volatile memory driver v1.3
[ 0.439209] Linux agpgart interface v0.103
[ 0.440462] loop: module loaded
[ 0.441668] scsi0 : ata_piix
[ 0.442482] scsi1 : ata_piix
[ 0.443084] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0a0 irq 14
[ 0.444098] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0a8 irq 15
[ 0.445486] Fixed MDIO Bus: probed
[ 0.446074] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.447062] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.447955] uhci_hcd: USB Universal Host Controller Interface driver
[ 0.449394] usbcore: registered new interface driver usbserial
[ 0.450342] usbcore: registered new interface driver usbserial_generic
[ 0.451396] USB Serial support registered for generic
[ 0.452188] usbserial: USB Serial Driver core
[ 0.452879] i8042: PNP: No PS/2 controller found. Probing ports directly.
[ 0.455084] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 0.455851] serio: i8042 AUX port at 0x60,0x64 irq 12
[ 0.456735] mousedev: PS/2 mouse device common for all mice
[ 0.457886] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
[ 0.462846] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
[ 0.463897] rtc0: alarms up to one day, 114 bytes nvram
[ 0.464819] device-mapper: uevent: version 1.0.3
[ 0.465678] device-mapper: ioctl: 4.22.0-ioctl (2011-10-19) initialised: dm-devel(a)redhat.com
[ 0.467501] cpuidle: using governor ladder
[ 0.468168] cpuidle: using governor menu
[ 0.468911] EFI Variables Facility v0.08 2004-May-17
[ 0.469902] usbcore: registered new interface driver usbhid
[ 0.470833] usbhid: USB HID core driver
[ 0.471480] drop_monitor: Initializing network drop monitor service
[ 0.472544] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 0.473707] TCP: cubic registered
[ 0.474337] Initializing XFRM netlink socket
[ 0.475110] NET: Registered protocol family 10
[ 0.475930] mip6: Mobile IPv6
[ 0.476429] NET: Registered protocol family 17
[ 0.477103] Key type dns_resolver registered
[ 0.477871] Load module verification keys
[ 0.478524] Loaded modsign.0 key: 58e41855e6c53d536290f6bc3e9b824470580478
[ 0.479527] registered taskstats version 1
[ 0.480409] Magic number: 12:956:477
[ 0.481193] rtc_cmos rtc_cmos: setting system clock to 2012-09-26 10:28:04 UTC (1348655284)
[ 0.603251] Freeing unused kernel memory: 1016k freed
[ 0.605842] Write protecting the kernel read-only data: 12288k
[ 0.616280] Freeing unused kernel memory: 1924k freed
[ 0.622342] Freeing unused kernel memory: 1456k freed
febootstrap: mounting /proc
febootstrap: uptime: 0.62 0.22
febootstrap: ext2 mini initrd starting up: 3.18 zlib
febootstrap: cmdline: panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm
febootstrap: mounting /sys
febootstrap: internal insmod libcrc32c.ko
febootstrap: internal insmod crc32c-intel.ko
insmod: init_module: crc32c-intel.ko: No such device
febootstrap: internal insmod crc-itu-t.ko
febootstrap: internal insmod crc-ccitt.ko
febootstrap: internal insmod crc8.ko
febootstrap: internal insmod scsi_transport_spi.ko
febootstrap: internal insmod sym53c8xx.ko
febootstrap: internal insmod rfkill.ko
febootstrap: internal insmod sparse-keymap.ko
febootstrap: internal insmod ideapad-laptop.ko
insmod: init_module: ideapad-laptop.ko: No such device
febootstrap: internal insmod virtio_mmio.ko
febootstrap: internal insmod virtio_balloon.ko
febootstrap: internal insmod virtio-rng.ko
febootstrap: internal insmod virtio_blk.ko
[ 0.675053] vda: unknown partition table
[ 0.895612] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input1
Alarm clock
[root@localhost ~]#
At 2012-09-26 18:14:59,"Richard W.M. Jones" <rjones(a)redhat.com> wrote:
>And also send all replies to the mailing list.
>
>Rich.
>
>--
>Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
>virt-p2v converts physical machines to virtual machines. Boot with a
>live CD or over the network (PXE) and turn machines into Xen guests.
>http://et.redhat.com/~rjones/virt-p2v
12 years, 1 month
guestfish hang when exec command.
by xuanmao_001
Hi,
I have some issues with libguestfs. I download the libguestfs-0.18.3 source code and read the README file.
it requested qemu >= 0.13, my qemu version is qemu-1.0.1
requested kernel version >= 2.6.34, my kernel version is 3.1.4
the most of requirement for compiling I reached. but I completed compiltion and executed command.
the guestfish hang there.
the following was my operating steps:
tar -Jxvf appliance-<VERSION>.tar.xz
Then copy all four files:
* kernel
* initrd
* root
* README.fixed
into a directory somewhere, eg. /usr/local/lib/guestfs/appliance/
Then build libguestfs (>= 1.16.7 or >= 1.17.10) from source, disabling
the normal appliance and daemon:
./configure --disable-appliance --disable-daemon
make
make install
Set LIBGUESTFS_PATH to the path where you unpacked these files, eg:
export LIBGUESTFS_PATH=/usr/local/lib/guestfs/appliance/
then executed command:
virt-copy-out -d GuestName 'win:c:\windows\system32\config' .
the command hang here.
Is there something going wrong? give me some help, thanks!
xuanmao_001
12 years, 1 month