libguestfs preview for RHEL 7.4
by Richard W.M. Jones
With the release of RHEL 7.3 happening today, fixing 88 reported bugs
in libguestfs and virt-v2v, and countless other ones, it's time to
look ahead to RHEL 7.4.
Again we intend to rebase libguestfs, virt-v2v and virt-p2v:
https://bugzilla.redhat.com/show_bug.cgi?id=1359086
1359086 NEW Rebase libguestfs in RHEL 7.4
To help with testing I have set up a preview repository here:
http://people.redhat.com/~rjones/libguestfs-RHEL-7.4-preview/
As always:
(1) THE PACKAGES ARE NOT SUPPORTED! Do not contact Red Hat Support
about these packages. However you are welcome to file bugs or send
comments to <libguestfs(a)redhat.com>. The link for filing bugs is:
https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%...
(2) These packages should work on top of RHEL 7.3 or CentOS 7.3.
(3) To install the packages you should create a yum repo file like the
one below, and then use yum commands as normal:
$ cat /etc/yum.repos.d/libguestfs-RHEL-7.4-preview.repo
[libguestfs-RHEL-7.4-preview]
name=libguestfs RHEL 7.4 preview
baseurl=http://people.redhat.com/~rjones/libguestfs-RHEL-7.4-preview/
enabled=1
gpgcheck=0
Notable changes in packaging:
- The 'virt-v2v' package now only includes virt-v2v, not virt-p2v.
- To build your own virt-p2v bootable USB key, install 'virt-p2v-maker'.
- virt-v2v installs Windows virtio drivers using a new technique
which tries to make the minimal possible changes to the Windows
registry. This may create exciting new bugs, so I'm particularly
interested in further testing in this area.
- There is currently a bogus dependency on 'kernel-rt' which
shouldn't be there ... under investigation.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
7 years, 9 months
[PATCH v3 0/6] Import directly from OVA tar archive if possible
by Tomáš Golembiovský
v3: Addressed Pino's comments, namely:
- input_ova.ml
- untar takes list of paths
- renamed untar_partial to untar_metadata
- replaced uggly regex with nsplit
- tests
- test changes are part of the main commit
- renamed test-data/guestfs-hashsums.sh to test-data/test-utils.sh
- renamed qemu_version to qemu_is_version and moved it to
test-data/test-utils.sh
- normalize paths in expect files
v2:
- rewritten the tar invocations, the output processing is now done in
OcaML rather than with a shell code; it turned out to be easier and
more readable than I have feared.
- added QEMU version check
- addressed Pino's comments
- changed tests; the expected result is now based on the QEMU used
during testing
This series is related to the problem of inefficient import of OVA
files. The needed enhancements of QEMU were merged into the codebase and
should be available in QEMU 2.8. From there we can use 'size' and
'offset' options in raw driver to tell QEMU to use only subset of a file
as an image.
The patch set is more or less complete. The only outstanding issue is
the missing detection of sparse files inside tar. But this can be done
in a separate patch. As pointed out before I didn't find a way how to
detect that by using the tar tool only and would probably require use of
some external library.
The first three patches are just preparation. The main work is in patch
four. Last patch fixes the tests.
Tomáš Golembiovský (6):
mllib: compute checksum of file inside tar
v2v: ova: don't detect compressed disks, read the OVF instead
v2v: ova: move the untar function
mllib: modify nsplit to take optional noempty and count arguments
tests: rename guestfs-hashsums.sh to test-utils.sh
v2v: ova: don't extract files from OVA if it's not needed
mllib/checksums.ml | 11 +-
mllib/checksums.mli | 7 +-
mllib/common_utils.ml | 12 +-
mllib/common_utils.mli | 12 +-
test-data/Makefile.am | 2 +-
test-data/{guestfs-hashsums.sh => test-utils.sh} | 20 +++
tests/qemu/qemu-liveness.sh | 2 +-
tests/qemu/qemu-snapshot-isolation.sh | 2 +-
v2v/Makefile.am | 1 +
v2v/input_ova.ml | 211 ++++++++++++++++++++---
v2v/test-v2v-i-ova-formats.sh | 7 +-
v2v/test-v2v-i-ova-gz.ovf | 2 +-
v2v/test-v2v-i-ova-gz.sh | 2 +-
v2v/test-v2v-i-ova-subfolders.expected2 | 18 ++
v2v/test-v2v-i-ova-subfolders.sh | 15 +-
v2v/test-v2v-i-ova-tar.expected | 18 ++
v2v/test-v2v-i-ova-tar.expected2 | 18 ++
v2v/test-v2v-i-ova-tar.ovf | 138 +++++++++++++++
v2v/test-v2v-i-ova-tar.sh | 71 ++++++++
v2v/test-v2v-i-ova-two-disks.expected2 | 19 ++
v2v/test-v2v-i-ova-two-disks.sh | 15 +-
v2v/test-v2v-i-ova.sh | 2 +-
v2v/test-v2v-in-place.sh | 2 +-
23 files changed, 553 insertions(+), 54 deletions(-)
rename test-data/{guestfs-hashsums.sh => test-utils.sh} (73%)
create mode 100644 v2v/test-v2v-i-ova-subfolders.expected2
create mode 100644 v2v/test-v2v-i-ova-tar.expected
create mode 100644 v2v/test-v2v-i-ova-tar.expected2
create mode 100644 v2v/test-v2v-i-ova-tar.ovf
create mode 100755 v2v/test-v2v-i-ova-tar.sh
create mode 100644 v2v/test-v2v-i-ova-two-disks.expected2
--
2.10.2
7 years, 11 months
[PATCH] lib: Use a common function to validate strings.
by Richard W.M. Jones
As discussed in the thread on validating $TERM, it would be good to
have a common function to do this. This is such a function.
The main advantage is it includes unit tests which the previous
functions did not.
Rich.
7 years, 11 months
[PATCH v4 0/6] Import directly from OVA tar archive if possible
by Tomáš Golembiovský
v4:
- rebase to more recent master
- 1/6: using just "quote" instead of "Filename.quote"
- 2/6: reformated block of code according to Richards suggestion
- 4/6: added tests for nsplit
v3: Addressed Pino's comments, namely:
- input_ova.ml
- untar takes list of paths
- renamed untar_partial to untar_metadata
- replaced uggly regex with nsplit
- tests
- test changes are part of the main commit
- renamed test-data/guestfs-hashsums.sh to test-data/test-utils.sh
- renamed qemu_version to qemu_is_version and moved it to
test-data/test-utils.sh
- normalize paths in expect files
v2:
- rewritten the tar invocations, the output processing is now done in
OcaML rather than with a shell code; it turned out to be easier and
more readable than I have feared.
- added QEMU version check
- addressed Pino's comments
- changed tests; the expected result is now based on the QEMU used
during testing
This series is related to the problem of inefficient import of OVA
files. The needed enhancements of QEMU were merged into the codebase and
should be available in QEMU 2.8. From there we can use 'size' and
'offset' options in raw driver to tell QEMU to use only subset of a file
as an image.
The patch set is more or less complete. The only outstanding issue is
the missing detection of sparse files inside tar. But this can be done
in a separate patch. As pointed out before I didn't find a way how to
detect that by using the tar tool only and would probably require use of
some external library.
Tomáš Golembiovský (6):
mllib: compute checksum of file inside tar
v2v: ova: don't detect compressed disks, read the OVF instead
v2v: ova: move the untar function
mllib: modify nsplit to take optional noempty and count arguments
tests: rename guestfs-hashsums.sh to test-utils.sh
v2v: ova: don't extract files from OVA if it's not needed
mllib/checksums.ml | 11 +-
mllib/checksums.mli | 7 +-
mllib/common_utils.ml | 12 +-
mllib/common_utils.mli | 12 +-
mllib/common_utils_tests.ml | 26 +++
test-data/Makefile.am | 2 +-
test-data/{guestfs-hashsums.sh => test-utils.sh} | 20 +++
tests/qemu/qemu-liveness.sh | 2 +-
tests/qemu/qemu-snapshot-isolation.sh | 2 +-
v2v/Makefile.am | 1 +
v2v/input_ova.ml | 194 +++++++++++++++++++++--
v2v/test-v2v-i-ova-formats.sh | 7 +-
v2v/test-v2v-i-ova-gz.ovf | 2 +-
v2v/test-v2v-i-ova-gz.sh | 2 +-
v2v/test-v2v-i-ova-subfolders.expected2 | 18 +++
v2v/test-v2v-i-ova-subfolders.sh | 15 +-
v2v/test-v2v-i-ova-tar.expected | 18 +++
v2v/test-v2v-i-ova-tar.expected2 | 18 +++
v2v/test-v2v-i-ova-tar.ovf | 138 ++++++++++++++++
v2v/test-v2v-i-ova-tar.sh | 71 +++++++++
v2v/test-v2v-i-ova-two-disks.expected2 | 19 +++
v2v/test-v2v-i-ova-two-disks.sh | 15 +-
v2v/test-v2v-i-ova.sh | 2 +-
v2v/test-v2v-in-place.sh | 2 +-
24 files changed, 571 insertions(+), 45 deletions(-)
rename test-data/{guestfs-hashsums.sh => test-utils.sh} (73%)
create mode 100644 v2v/test-v2v-i-ova-subfolders.expected2
create mode 100644 v2v/test-v2v-i-ova-tar.expected
create mode 100644 v2v/test-v2v-i-ova-tar.expected2
create mode 100644 v2v/test-v2v-i-ova-tar.ovf
create mode 100755 v2v/test-v2v-i-ova-tar.sh
create mode 100644 v2v/test-v2v-i-ova-two-disks.expected2
--
2.10.2
7 years, 11 months
Re: [Libguestfs] [rhev-tech] virt-v2v failure during selinux re-lable
by John Call
Reaching out to libguestfs(a)redhat.com. Thanks Shahar, I didn't know that
email alias existed. Also, I made the XML, full logs, and sosreport from
the VM in question available here [1]
[1] -http://people.redhat.com/~jcall/tmp.cKGPeNjfi8/
Thank you,
John Call
Red Hat - Solutions Architect
jcall(a)redhat.com
(714) 267-8802
On Thu, Dec 29, 2016 at 2:40 AM, Shahar Havivi <shavivi(a)redhat.com> wrote:
> try to ask libguestfs(a)redhat.com if you don't get answer here.
>
> On Wed, Dec 28, 2016 at 11:04 PM, John Call <jcall(a)redhat.com> wrote:
>
>> Hi everybody,
>>
>> I've had great success migrating ~40 VMs from a KVM environment into
>> RHV. However, recently my virt-v2v process broke on a few VMs. Has
>> anybody seen this before? Is there a way to simply bypass the relabel
>> process? This is being documented in case #01764770 (VM XML and complete
>> logs there)
>>
>> Command ran (as root)
>> # virt-v2v --colours --network ovirtmgmt -i libvirtxml -o rhev -oa sparse
>> -os /var/lib/exports/export tlrampy1.eams.dir.ca.gov.xml
>>
>> <snip...>
>>
>> commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e
>> /sysroot/selinux -e /sysroot/sys -r /sysroot -q
>> /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/
>> /sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid
>> argument
>> guestfsd: error: /sysroot/etc/selinux/targeted/contexts/files/file_contexts:
>> Invalid argument: Success
>> guestfsd: main_loop: proc 467 (selinux_relabel) took 0.02 seconds
>> libguestfs: trace: v2v: selinux_relabel = -1 (error)
>> virt-v2v: error: libguestfs error: selinux_relabel:
>> /sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid
>> argument: Success
>>
>>
>>
>> Thank you,
>>
>> John Call
>> Red Hat - Solutions Architect
>> jcall(a)redhat.com
>> (714) 267-8802
>>
>
>
7 years, 12 months
import-to-ovirt.pl minor problem
by Emmanuel Kasper
Hi Richard
I've noticed this snippet in import-to-ovirt.pl
my $minor_version = $g->inspect_get_major_version ($root);
I guess you meant here
my $minor_version = $g->inspect_get_minor_version ($root);
Emmanuel
8 years
[PATCH 1/2] launch: Rationalize how we construct the Linux kernel command line.
by Richard W.M. Jones
This is just code refactoring.
---
src/launch.c | 172 +++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 109 insertions(+), 63 deletions(-)
diff --git a/src/launch.c b/src/launch.c
index 46d7ab9..84d5e82 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -293,9 +293,7 @@ guestfs_impl_config (guestfs_h *g,
#endif
#if defined(__aarch64__)
-#define EARLYPRINTK " earlyprintk=pl011,0x9000000"
-#else
-#define EARLYPRINTK ""
+#define EARLYPRINTK "earlyprintk=pl011,0x9000000"
#endif
/**
@@ -327,75 +325,123 @@ char *
guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev,
int flags)
{
- char root[64] = "";
+ CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (argv);
char *term = getenv ("TERM");
- char *ret;
bool tcg = flags & APPLIANCE_COMMAND_LINE_IS_TCG;
- char lpj_s[64] = "";
- if (appliance_dev)
- snprintf (root, sizeof root, " root=%s", appliance_dev);
+ /* We assemble the kernel command line by simply joining the final
+ * list of strings with spaces. This means (a) the strings are not
+ * quoted (it's not clear if the kernel can handle quoting in any
+ * case), and (b) we can append multiple parameters in a single
+ * argument, as we must do for the g->append parameter.
+ */
+
+ /* Force kernel to panic if daemon exits. */
+ guestfs_int_add_string (g, &argv, "panic=1");
+
+#ifdef __arm__
+ guestfs_int_add_sprintf (g, &argv, " mem=%dM", g->memsize);
+#endif
+
+#ifdef __i386__
+ /* Workaround for RHBZ#857026. */
+ guestfs_int_add_string (g, &argv, "noapic");
+#endif
+
+ /* Serial console. */
+ guestfs_int_add_string (g, &argv, SERIAL_CONSOLE);
+
+#ifdef EARLYPRINTK
+ /* Get messages from early boot. */
+ guestfs_int_add_string (g, &argv, EARLYPRINTK);
+#endif
+
+#ifdef __aarch64__
+ guestfs_int_add_string (g, &argv, "ignore_loglevel");
+
+ /* This option turns off the EFI RTC device. QEMU VMs don't
+ * currently provide EFI, and if the device is compiled in it
+ * will try to call the EFI function GetTime unconditionally
+ * (causing a call to NULL). However this option requires a
+ * non-upstream patch.
+ */
+ guestfs_int_add_string (g, &argv, "efi-rtc=noprobe");
+#endif
+
+ /* RHBZ#1404287 */
+ guestfs_int_add_string (g, &argv, "edd=off");
+
+ /* For slow systems (RHBZ#480319, RHBZ#1096579). */
+ guestfs_int_add_string (g, &argv, "udevtimeout=6000");
+
+ /* Same as above, for newer udevd. */
+ guestfs_int_add_string (g, &argv, "udev.event-timeout=6000");
+
+ /* Fix for RHBZ#502058. */
+ guestfs_int_add_string (g, &argv, "no_timer_check");
if (tcg) {
const int lpj = guestfs_int_get_lpj (g);
if (lpj > 0)
- snprintf (lpj_s, sizeof lpj_s, " lpj=%d", lpj);
+ guestfs_int_add_sprintf (g, &argv, "lpj=%d", lpj);
}
- ret = safe_asprintf
- (g,
- "panic=1" /* force kernel to panic if daemon exits */
-#ifdef __arm__
- " mem=%dM"
-#endif
-#ifdef __i386__
- " noapic" /* workaround for RHBZ#857026 */
-#endif
- " " SERIAL_CONSOLE /* serial console */
- EARLYPRINTK /* get messages from early boot */
-#ifdef __aarch64__
- " ignore_loglevel"
- /* This option turns off the EFI RTC device. QEMU VMs don't
- * currently provide EFI, and if the device is compiled in it
- * will try to call the EFI function GetTime unconditionally
- * (causing a call to NULL). However this option requires a
- * non-upstream patch.
- */
- " efi-rtc=noprobe"
-#endif
- " edd=off" /* RHBZ#1404287 */
- " udevtimeout=6000"/* for slow systems (RHBZ#480319, RHBZ#1096579) */
- " udev.event-timeout=6000" /* for newer udevd */
- " no_timer_check" /* fix for RHBZ#502058 */
- "%s" /* lpj */
- " printk.time=1" /* display timestamp before kernel messages */
- " cgroup_disable=memory" /* saves us about 5 MB of RAM */
- " usbcore.nousb" /* disable USB, only saves about 1ms */
- " cryptomgr.notests" /* disable crypto tests, saves 28ms */
- " tsc=reliable" /* don't synch TSCs when using SMP,
- saves 21ms for each secondary vCPU */
- " 8250.nr_uarts=1" /* don't scan all 8250 UARTS */
- "%s" /* root=appliance_dev */
- " %s" /* selinux */
- " %s" /* quiet/verbose */
- "%s" /* network */
- " TERM=%s" /* TERM environment variable */
- "%s%s" /* handle identifier */
- "%s%s", /* append */
-#ifdef __arm__
- g->memsize,
-#endif
- lpj_s,
- root,
- g->selinux ? "selinux=1 enforcing=0" : "selinux=0",
- g->verbose ? "guestfs_verbose=1" : "quiet",
- g->enable_network ? " guestfs_network=1" : "",
- term ? term : "linux",
- STRNEQ (g->identifier, "") ? " guestfs_identifier=" : "",
- g->identifier,
- g->append ? " " : "", g->append ? g->append : "");
-
- return ret;
+ /* Display timestamp before kernel messages. */
+ guestfs_int_add_string (g, &argv, "printk.time=1");
+
+ /* Saves us about 5 MB of RAM. */
+ guestfs_int_add_string (g, &argv, "cgroup_disable=memory");
+
+ /* Disable USB, only saves about 1ms. */
+ guestfs_int_add_string (g, &argv, "usbcore.nousb");
+
+ /* Disable crypto tests, saves 28ms. */
+ guestfs_int_add_string (g, &argv, "cryptomgr.notests");
+
+ /* Don't synch TSCs when using SMP. Saves 21ms for each secondary vCPU. */
+ guestfs_int_add_string (g, &argv, "tsc=reliable");
+
+ /* Don't scan all 8250 UARTS. */
+ guestfs_int_add_string (g, &argv, "8250.nr_uarts=1");
+
+ /* Tell supermin about the appliance device. */
+ if (appliance_dev)
+ guestfs_int_add_sprintf (g, &argv, "root=%s", appliance_dev);
+
+ /* SELinux - deprecated setting, never worked and should not be enabled. */
+ if (g->selinux)
+ guestfs_int_add_string (g, &argv, "selinux=1 enforcing=0");
+ else
+ guestfs_int_add_string (g, &argv, "selinux=0");
+
+ /* Quiet/verbose. */
+ if (g->verbose)
+ guestfs_int_add_string (g, &argv, "guestfs_verbose=1");
+ else
+ guestfs_int_add_string (g, &argv, "quiet");
+
+ /* Network. */
+ if (g->enable_network)
+ guestfs_int_add_string (g, &argv, "guestfs_network=1");
+
+ /* TERM environment variable. */
+ if (term)
+ guestfs_int_add_sprintf (g, &argv, "TERM=%s", term);
+ else
+ guestfs_int_add_string (g, &argv, "TERM=linux");
+
+ /* Handle identifier. */
+ if (STRNEQ (g->identifier, ""))
+ guestfs_int_add_sprintf (g, &argv, "guestfs_identifier=%s", g->identifier);
+
+ /* Append extra arguments. */
+ if (g->append)
+ guestfs_int_add_string (g, &argv, g->append);
+
+ guestfs_int_end_stringsbuf (g, &argv);
+
+ /* Caller frees. */
+ return guestfs_int_join_strings (" ", argv.argv);
}
/**
--
2.10.2
8 years
[PATCH] appliance: Disable EDD (edd=off) (RHBZ#1404287).
by Richard W.M. Jones
EDD (https://en.wikipedia.org/wiki/Enhanced_Disk_Drive) is a BIOS INT 13h
subcall for communicating the extended size of the boot disk over 8GB
to the OS. Since libguestfs doesn't use a boot disk, and the
appliance disk is limited to 4GB, and we use virtio-scsi, this is all
useless.
EDD is also broken currently on RHEL 7.3, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1404287
Also the EDD probing takes significant extra time (about 80ms on my
laptop), and using edd=off reduces this time although doesn't entirely
eliminate it.
---
src/launch.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/launch.c b/src/launch.c
index 78bf46d..46d7ab9 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -363,6 +363,7 @@ guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev,
*/
" efi-rtc=noprobe"
#endif
+ " edd=off" /* RHBZ#1404287 */
" udevtimeout=6000"/* for slow systems (RHBZ#480319, RHBZ#1096579) */
" udev.event-timeout=6000" /* for newer udevd */
" no_timer_check" /* fix for RHBZ#502058 */
--
2.10.2
8 years
[PATCH v3 0/6] Feature: Yara file scanning
by Matteo Cafasso
v3:
- allow to load multiple rule files
- added optional namespace parameter to yara_load
- move destructor logic in yara module
- use generic file upload logic
- use generic temporary path function
Matteo Cafasso (6):
appliance: add yara dependency
New API: yara_load
New API: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added API tests
appliance/packagelist.in | 4 +
configure.ac | 1 +
daemon/Makefile.am | 4 +-
daemon/cleanups.c | 9 +
daemon/cleanups.h | 2 +
daemon/yara.c | 301 +++++++++++++++++++++++++++++++
generator/actions.ml | 64 +++++++
generator/structs.ml | 9 +
gobject/Makefile.inc | 8 +-
java/Makefile.inc | 1 +
java/com/redhat/et/libguestfs/.gitignore | 1 +
m4/guestfs_daemon.m4 | 14 ++
src/MAX_PROC_NR | 2 +-
src/Makefile.am | 1 +
src/yara.c | 127 +++++++++++++
tests/yara/Makefile.am | 26 +++
tests/yara/test-yara-scan.sh | 72 ++++++++
17 files changed, 642 insertions(+), 4 deletions(-)
create mode 100644 daemon/yara.c
create mode 100644 src/yara.c
create mode 100644 tests/yara/Makefile.am
create mode 100755 tests/yara/test-yara-scan.sh
--
2.11.0
8 years
IRC question: appending newline to end of file
by Richard W.M. Jones
16:43 < martingo_> hi all
16:43 < martingo_> I am using write_append to write at the end of one file
16:43 < martingo_> but newline he is not taking
16:43 < martingo_> guestfish add ./overcloud-full.qcow2 : run : mount /dev/sda / : write_append /etc/fstab "nodev /mnt/huge_qemu_1G
hugetlbfs rw,pagesize=1G 0 0\n"
16:43 < martingo_> any ideas
16:48 < martingo_> any help?
An example of what can go wrong is shown here:
$ guestfish -N fs -m /dev/sda1 \
write /foo "hello" : write-append /foo "goodbye\n" : hexdump /foo
00000000 68 65 6c 6c 6f 67 6f 6f 64 62 79 65 5c 6e |hellogoodbye\n|
0000000e
Notice that the literal characters '\' and 'n' have been added
to the file.
It helps to look at the API calls being made, by adding the
guestfish -x option:
$ guestfish -x -N fs -m /dev/sda1 \
write /foo "hello" : write-append /foo "goodbye\n" : hexdump /foo
[...]
libguestfs: trace: write_append "/foo" "goodbye\n"
(Notice that the trace output escapes non-printable characters using
\x.., so again that's the literal two characters '\' and 'n').
This isn't really surprising because we're asking the shell to send
those two characters to guestfish, as you can see by doing:
$ echo "\n" | hexdump -C
00000000 5c 6e 0a |\n.|
00000003
The guestfish *command line* will turn \n into a newline character as
described here:
http://libguestfs.org/guestfish.1.html#escape-sequences-in-double-quoted-...
but this doesn't apply to the shell command line because it uses a
different code path.
Anyway to fix this you can either do:
$ guestfish -N fs -m /dev/sda1 \
write /foo "hello" : write-append /foo "goodbye
" : hexdump /foo
You have to actually press the newline key: ``"goodbye<CR>''.
Or slightly less cumbersome is to use a script which invokes the
guestfish command line code path:
$ cat test.sh
guestfish -N fs -m /dev/sda1 <<'EOF'
write /foo "hello"
write-append /foo "goodbye\n"
hexdump /foo
EOF
$ bash test.sh
00000000 68 65 6c 6c 6f 67 6f 6f 64 62 79 65 0a |hellogoodbye.|
0000000d
HTH,
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
8 years