Pino Toscano
2017-Mar-17 17:11 UTC
[Libguestfs] [PATCH 0/4] p2v: fix virt-p2v-make-disk on Debian
Hi, this small series fixes the generation of Debian-based images using virt-p2v-make-disk. With this series, the image can boot fine, X is started, and the p2v interface appears. I haven't tried an actual conversion, but I don't think there are Debian-specific problems preventing that. Thanks, Pino Toscano (4): p2v: fix Gtk dependencies on Debian p2v: remove network-manager-applet Debian dependency p2v: virt-p2v-make-disk: fix systemd paths p2v: virt-p2v-make-disk: prevent daemons to run on Debian p2v/dependencies.m4 | 3 +-- p2v/virt-p2v-make-disk.in | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) -- 2.9.3
Pino Toscano
2017-Mar-17 17:11 UTC
[Libguestfs] [PATCH 1/4] p2v: fix Gtk dependencies on Debian
On Debian, the names of the packages containing the Gtk 2 and 3 libraries have different patterns, and thus just the name will not work for Gtk 3. Apply a bit of m4 to use a different package name on Gtk 2 and other versions. It can be easily adapted to new models in future Gtk 4+, should the naming pattern change from Gtk 3. --- p2v/dependencies.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2v/dependencies.m4 b/p2v/dependencies.m4 index 2037477..3160dce 100644 --- a/p2v/dependencies.m4 +++ b/p2v/dependencies.m4 @@ -64,7 +64,7 @@ ifelse(REDHAT,1, ifelse(DEBIAN,1, libpcre3 libxml2 - libgtk`'GTK_VERSION`'.0-0 + ifelse(GTK_VERSION,2,libgtk`'GTK_VERSION`'.0-0,libgtk-`'GTK_VERSION`'-0) libdbus-1-3 ifdef(`HAVE_LIBVIRT', `libvirt0') openssh-client -- 2.9.3
Pino Toscano
2017-Mar-17 17:11 UTC
[Libguestfs] [PATCH 2/4] p2v: remove network-manager-applet Debian dependency
On Debian, network-manager-gnome contains nm-applet, which is what launch-virt-p2v spawns. network-manager-gnome is already in the list of packages for Debian, while network-manager-applet does not exist. --- p2v/dependencies.m4 | 1 - 1 file changed, 1 deletion(-) diff --git a/p2v/dependencies.m4 b/p2v/dependencies.m4 index 3160dce..0db2f85 100644 --- a/p2v/dependencies.m4 +++ b/p2v/dependencies.m4 @@ -78,7 +78,6 @@ ifelse(DEBIAN,1, metacity network-manager network-manager-gnome - network-manager-applet dbus-x11 net-tools ) -- 2.9.3
Pino Toscano
2017-Mar-17 17:11 UTC
[Libguestfs] [PATCH 3/4] p2v: virt-p2v-make-disk: fix systemd paths
Usually systemd is configured with prefix=/, so units are in /lib/systemd. On a system with UsrMove, such as Fedora/RHEL7, /lib is a symlink to /usr/lib, so both /lib/systemd and /usr/lib/systemd work; OTOH, on non-UsrMove systems, such as Debian, the two paths are different locations, and thus trying to edit system files as /usr/lib/systemd/etc will fail. As solution, just reference /lib/systemd for systemd files. --- p2v/virt-p2v-make-disk.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/p2v/virt-p2v-make-disk.in b/p2v/virt-p2v-make-disk.in index 6b7f15a..6b82eaf 100644 --- a/p2v/virt-p2v-make-disk.in +++ b/p2v/virt-p2v-make-disk.in @@ -241,9 +241,9 @@ virt-builder "$osversion" \ --chmod 0755:/usr/bin/launch-virt-p2v \ --upload "$datadir"/p2v.service:/etc/systemd/system/ \ --mkdir /etc/systemd/system/default.target.wants \ - --link /usr/lib/systemd/system/multi-user.target:/etc/systemd/system/default.target \ + --link /lib/systemd/system/multi-user.target:/etc/systemd/system/default.target \ --link /etc/systemd/system/p2v.service:/etc/systemd/system/default.target.wants/p2v.service \ - --edit '/usr/lib/systemd/system/getty@.service: + --edit '/lib/systemd/system/getty@.service: s/^ExecStart=(.*)/ExecStart=$1 -a root/ ' \ --edit '/etc/systemd/logind.conf: -- 2.9.3
Pino Toscano
2017-Mar-17 17:11 UTC
[Libguestfs] [PATCH 4/4] p2v: virt-p2v-make-disk: prevent daemons to run on Debian
On Debian systems, usually daemons are run automatically after their installations; since we are upgrading the template, and installing packages such as openssh, network-manager, etc, this may cause few daemon to stay running during the virt-builder execution, causing it to fail when shutting down (since e.g. /sysroot/dev would be in use). As workaround, use a temporary policy-rc.d policy layer [1]: give an error code so no daemon is ever started at any point of package upgrades and installation. The script is removed at the very end of the building, so the final image will spawn daemons just fine when booted. [1] https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt --- p2v/virt-p2v-make-disk.in | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/p2v/virt-p2v-make-disk.in b/p2v/virt-p2v-make-disk.in index 6b82eaf..026d18b 100644 --- a/p2v/virt-p2v-make-disk.in +++ b/p2v/virt-p2v-make-disk.in @@ -189,6 +189,19 @@ EOF ;; debian-*|ubuntu-*) depsfile="$datadir/dependencies.debian" + cat > $tmpdir/policy-rc.d <<'EOF' +#!/bin/sh +# Avoid running daemons during the upgrade/installation +exit 101 +EOF + chmod +x $tmpdir/policy-rc.d + # Double quotes because we want $tmpdir to be expanded: + preinstall_args=" + --upload $tmpdir/policy-rc.d:/usr/sbin/policy-rc.d + " + final_args=" + --delete /usr/sbin/policy-rc.d + " ;; archlinux-*) depsfile="$datadir/dependencies.archlinux" @@ -229,6 +242,7 @@ virt-builder "$osversion" \ $verbose_option \ --output "$output" \ $arch_option \ + $preinstall_args \ --update \ --install "$install" \ --root-password password:p2v \ @@ -251,7 +265,8 @@ virt-builder "$osversion" \ ' \ $upload \ $extra_args \ - "${passthru[@]}" + "${passthru[@]}" \ + $final_args # We have to do this so the cleanup() handler runs. exit $? -- 2.9.3
Richard W.M. Jones
2017-Mar-20 09:14 UTC
Re: [Libguestfs] [PATCH 4/4] p2v: virt-p2v-make-disk: prevent daemons to run on Debian
ACK series. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Reasonably Related Threads
- [PATCH 4/4] p2v: virt-p2v-make-disk: prevent daemons to run on Debian
- [p2v PATCH] make-disk: set p2v.local as hostname
- [PATCH v3] p2v: Allow virt-p2v to be built with Gtk 2 or 3.
- [PATCH 0/2] p2v: Allow virt-p2v to be built with Gtk 2 or 3.
- [PATCH v2 0/3] p2v: Allow virt-p2v to be built with Gtk 2 or 3.