Re: [Libguestfs] [EXTERNAL] - Re: LIBGUESTFS mount disk failure

2023-09-17 Thread Raja Ram Sharma
Thank you, Richard!

Guestfs_launch was failing due to internal program issue. Since guesfs_launch 
creates new process for guesfs process.

Hence, Guestfs_launch was failing since new process creation failed in internal 
program due to remote connection.


We resolved using Deamon and Sender logic. 
When Deamon will receive message from sender to launch guest it will launch 
guestfs runner program => Happy Path is working.

One more help is needed : https://github.com/libguestfs/libguestfs/issues/124
/***/
I can get guestfs_last_error using function_callback and write to log file.
But "event Handling" is not working Also, std::cout and std::cerr still 
printing on terminal.

Is there any workaround for Event Handling?
 How to completely disable/enable standard output?
/***/

In short, Any Debugging sample program, 
https://github.com/libguestfs/libguestfs/issues/124 

Libguestfs:issue$124, contains sample program.


Thanks
RR

-Original Message-
From: Richard W.M. Jones  
Sent: Sunday, September 17, 2023 2:12 PM
To: Raja Ram Sharma 
Cc: Teja Konapalli ; libguestfs@redhat.com; Divyanshu 
Kumar 
Subject: Re: [EXTERNAL] - Re: LIBGUESTFS mount disk failure

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe. If you feel that the email is suspicious, please report it using 
PhishAlarm.


On Sun, Sep 17, 2023 at 03:55:24AM +, Raja Ram Sharma wrote:
> Hi Richard,
>
> Wish you a happy weekend!
>
> Guestfs_launch fails after below error :
>   
>   libguestfs: is_openable: /dev/kvm: No such file or directory
>   libguestfs: trace: get_backend_setting "force_tcg"
>   libguestfs: trace: get_backend_setting = NULL (error)
>   ^^^
> Same line has also printed in " LIBGUESTFS_BACKEND=direct 
> libguestfs-test-tool " at line $96-$98
>   ^^^
>   Could not access KVM kernel module: No such file or directory
>   qemu-kvm: failed to initialize KVM: No such file or directory
>   ^^^

Thanks for providing the second output.

The above messages aren't errors.

I really need much more context.  I need to see the program that you're trying 
to run, or a self-contained reproducer, and I also need to see the _complete_ 
output from the program from start to finish, not just small parts of it.

Rich.

--
Richard Jones, Virtualization Group, Red Hat 
https://urldefense.com/v3/__http://people.redhat.com/*rjones__;fg!!Obbck6kTJA!cGvW3aE83Ft-GmRGWxqYLh85g0kvttA_BT6dWlewP_XXEySJTE_7VerRYsyHmY3gHfNZEoSwXyazG9cD$
Read my programming and virtualization blog: 
https://urldefense.com/v3/__http://rwmj.wordpress.com__;!!Obbck6kTJA!cGvW3aE83Ft-GmRGWxqYLh85g0kvttA_BT6dWlewP_XXEySJTE_7VerRYsyHmY3gHfNZEoSwX1BFUle1$
nbdkit - Flexible, fast NBD server with plugins 
https://urldefense.com/v3/__https://gitlab.com/nbdkit/nbdkit__;!!Obbck6kTJA!cGvW3aE83Ft-GmRGWxqYLh85g0kvttA_BT6dWlewP_XXEySJTE_7VerRYsyHmY3gHfNZEoSwXx0dimlz$

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



Re: [Libguestfs] [EXTERNAL] - Re: LIBGUESTFS mount disk failure

2023-09-17 Thread Raja Ram Sharma
Hi Richard, 

Wish you a happy weekend! 

Guestfs_launch fails after below error :

libguestfs: is_openable: /dev/kvm: No such file or directory
libguestfs: trace: get_backend_setting "force_tcg"
libguestfs: trace: get_backend_setting = NULL (error)
^^^
Same line has also printed in " LIBGUESTFS_BACKEND=direct libguestfs-test-tool 
" at line $96-$98
^^^
Could not access KVM kernel module: No such file or directory
qemu-kvm: failed to initialize KVM: No such file or directory
^^^

Please find attachment of $> LIBGUESTFS_BACKEND=direct libguestfs-test-tool

Thanks 
RR


-Original Message-
From: Richard W.M. Jones  
Sent: Sunday, September 17, 2023 2:07 AM
To: Raja Ram Sharma 
Cc: Teja Konapalli ; libguestfs@redhat.com; Divyanshu 
Kumar 
Subject: Re: [EXTERNAL] - Re: LIBGUESTFS mount disk failure

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe. If you feel that the email is suspicious, please report it using 
PhishAlarm.


Thanks for providing the libguestfs-test-tool output in a previous message.

> While: guestfs_lanch error:
>   libguestfs: trace: set_verbose true
>   libguestfs: trace: set_verbose = 0
>   libguestfs: trace: set_backend "direct"
>   libguestfs: trace: set_backend = 0

Here you're setting backend = "direct", and while that isn't necessarily a 
problem in itself, the libguestfs-test-tool output that you provided was for 
the (normal, for RHEL) libvirt backend.

This could make a difference, so what's the output of:

  $ LIBGUESTFS_BACKEND=direct libguestfs-test-tool

?

By the way, unless you have a specific reason to set 
'LIBGUESTFS_BACKEND=direct' that you can articulate, it is best not to set this 
as it is less secure and less well tested.  If you just copied that environment 
variable from somewhere without understanding why, then don't do that.

Rich.

--
Richard Jones, Virtualization Group, Red Hat 
https://urldefense.com/v3/__http://people.redhat.com/*rjones__;fg!!Obbck6kTJA!dH7uryqvh0lZ5fENv-UGELBhZf_4YeDluWD8HOiX9HhMDMbDUVpoUkP-GHdUVq06f9twxzOInZAGIZOv$
Read my programming and virtualization blog: 
https://urldefense.com/v3/__http://rwmj.wordpress.com__;!!Obbck6kTJA!dH7uryqvh0lZ5fENv-UGELBhZf_4YeDluWD8HOiX9HhMDMbDUVpoUkP-GHdUVq06f9twxzOInU_4VCMe$
Fedora Windows cross-compiler. Compile Windows programs, test, and build 
Windows installers. Over 100 libraries supported.
https://urldefense.com/v3/__http://fedoraproject.org/wiki/MinGW__;!!Obbck6kTJA!dH7uryqvh0lZ5fENv-UGELBhZf_4YeDluWD8HOiX9HhMDMbDUVpoUkP-GHdUVq06f9twxzOInTq6QXk4$

[root@iwf1118164 ~]# LIBGUESTFS_BACKEND=direct libguestfs-test-tool
 
 *IMPORTANT NOTICE
 *
 * When reporting bugs, include the COMPLETE, UNEDITED
 * output below in your bug report.
 *
 
LIBGUESTFS_BACKEND=direct
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
XDG_RUNTIME_DIR=/run/user/0
SELinux: Enforcing
guestfs_get_append: (null)
guestfs_get_autosync: 1
guestfs_get_backend: direct
guestfs_get_backend_settings: []
guestfs_get_cachedir: /var/tmp
guestfs_get_hv: /usr/libexec/qemu-kvm
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/lib64/guestfs
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_smp: 1
guestfs_get_sockdir: /tmp
guestfs_get_tmpdir: /tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: 
version=1.38.4rhel=8,release=15.module+el8.2.0+5297+222a20af,libvirt
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfs3rE6U0
libguestfs: launch: umask=0022
libguestfs: launch: euid=0
libguestfs: is_openable: /dev/kvm: No such file or directory
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-0/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-0/appliance.d
supermin: version: 5.1.19
supermin: rpm: detected RPM version 4.14
supermin: package handler: fedora/rpm
supermin: acquiring lock on /var/tmp/.guestfs-0/lock
supermin: if-newer: output does 

Re: [Libguestfs] [EXTERNAL] - Re: LIBGUESTFS mount disk failure

2023-09-17 Thread Raja Ram Sharma
Hi Richard, 

Please find attachment.

Thanks
RR

-Original Message-
From: Richard W.M. Jones  
Sent: Sunday, September 17, 2023 12:01 AM
To: Raja Ram Sharma 
Cc: Teja Konapalli ; libguestfs@redhat.com; Divyanshu 
Kumar 
Subject: Re: [EXTERNAL] - Re: LIBGUESTFS mount disk failure

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe. If you feel that the email is suspicious, please report it using 
PhishAlarm.


Hi, can you run:

  libguestfs-test-tool

and send us the complete output.

Rich.

--
Richard Jones, Virtualization Group, Red Hat 
https://urldefense.com/v3/__http://people.redhat.com/*rjones__;fg!!Obbck6kTJA!cUhKTzkHbeycH9ONmg7YVuA28RxRwLfJ3XfePXETLBjNcS3vefsLwC2HoDNyIltFDhvduQ5NSIeGrD_b$
Read my programming and virtualization blog: 
https://urldefense.com/v3/__http://rwmj.wordpress.com__;!!Obbck6kTJA!cUhKTzkHbeycH9ONmg7YVuA28RxRwLfJ3XfePXETLBjNcS3vefsLwC2HoDNyIltFDhvduQ5NSFHTYeM4$
Fedora Windows cross-compiler. Compile Windows programs, test, and build 
Windows installers. Over 100 libraries supported.
https://urldefense.com/v3/__http://fedoraproject.org/wiki/MinGW__;!!Obbck6kTJA!cUhKTzkHbeycH9ONmg7YVuA28RxRwLfJ3XfePXETLBjNcS3vefsLwC2HoDNyIltFDhvduQ5NSJEawKzk$

[root@iwf1118164 ~]#   libguestfs-test-tool
 
 *IMPORTANT NOTICE
 *
 * When reporting bugs, include the COMPLETE, UNEDITED
 * output below in your bug report.
 *
 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
XDG_RUNTIME_DIR=/run/user/0
SELinux: Enforcing
guestfs_get_append: (null)
guestfs_get_autosync: 1
guestfs_get_backend: libvirt
guestfs_get_backend_settings: []
guestfs_get_cachedir: /var/tmp
guestfs_get_hv: /usr/libexec/qemu-kvm
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/lib64/guestfs
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_smp: 1
guestfs_get_sockdir: /tmp
guestfs_get_tmpdir: /tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: 
version=1.38.4rhel=8,release=15.module+el8.2.0+5297+222a20af,libvirt
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=libvirt
libguestfs: launch: tmpdir=/tmp/libguestfsMogiUb
libguestfs: launch: umask=0022
libguestfs: launch: euid=0
libguestfs: libvirt version = 4005000 (4.5.0)
libguestfs: guest random name = guestfs-8ld1b37qkd0lijw1
libguestfs: connect to libvirt
libguestfs: opening libvirt handle: URI = qemu:///system, auth = 
default+wrapper, flags = 0
libguestfs: successfully opened libvirt handle: conn = 0x5565989aa530
libguestfs: qemu version (reported by libvirt) = 2012000 (2.12.0)
libguestfs: get libvirt capabilities
libguestfs: parsing capabilities XML
libguestfs: build appliance
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-0/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-0/appliance.d
supermin: version: 5.1.19
supermin: rpm: detected RPM version 4.14
supermin: package handler: fedora/rpm
supermin: acquiring lock on /var/tmp/.guestfs-0/lock
supermin: if-newer: output does not need rebuilding
libguestfs: finished building supermin appliance
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -o 
backing_file=/var/tmp/.guestfs-0/appliance.d/root,backing_fmt=raw
libguestfs: command: run: \ /tmp/libguestfsMogiUb/overlay2.qcow2
Formatting '/tmp/libguestfsMogiUb/overlay2.qcow2', fmt=qcow2 size=4294967296 
backing_file=/var/tmp/.guestfs-0/appliance.d/root backing_fmt=raw 
cluster_size=65536 lazy_refcounts=off refcount_bits=16
libguestfs: create libvirt XML
libguestfs: command: run: dmesg | grep -Eoh 'lpj=[[:digit:]]+'
libguestfs: read_lpj_from_dmesg: calculated lpj=2397223
libguestfs: libvirt XML:\n\nhttp://libvirt.org/schemas/domain/qemu/1.0;>\n  
guestfs-8ld1b37qkd0lijw1\n  500\n  
500\n  1\n  \n\n\n\n  
\n  \nhvm\n
/var/tmp/.guestfs-0/appliance.d/kernel\n
/var/tmp/.guestfs-0/appliance.d/initrd\npanic=1 
console=ttyS0 edd=off udevtimeout=6000 udev.event-timeout=6000 no_timer_check 
lpj=2397223 

Re: [Libguestfs] [EXTERNAL] - Re: LIBGUESTFS mount disk failure

2023-09-17 Thread Raja Ram Sharma
Hi Richard, 

Thank you for the reply, I hope this mail finds you well.

We resolved guestfs_add_drive failure, now guestfs_add_drive is adding disk 
successfully after adding "format:raw".

But guestfs_launch is failing Kindly help me to troubleshoot or to find any 
workaround. 

Error_callback is in-place, it return guestfs_last_error()

guestfs_last_error():
[ 2023-09-16 17:24:20 ]  errno: ( 10 ) : command: waitpid: No child 
processes
[ 2023-09-16 17:24:20 ]  errno: ( 10 ) : command: waitpid: No child 
processes

While: guestfs_lanch error:
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_backend "direct"
libguestfs: trace: set_backend = 0
libguestfs: create: flags = 0, handle = 0xbb0a70, program = greagent.exe
libguestfs: trace: add_drive 
"/var/opt/omni/tmp/GRE/5029f5c4-e08d-23e1-07d3-96c5c7ffeeac/2023/09/16-3/5029f5c4-e08d-23e1-07d3-96c5c7ffeeac/Datastore2-9166/RAJATEST/RAJATEST_1-flat.vmdk"
 "format:raw"
libguestfs: trace: add_drive = 0
libguestfs: trace: add_drive 
"/var/opt/omni/tmp/GRE/5029f5c4-e08d-23e1-07d3-96c5c7ffeeac/2023/09/16-3/5029f5c4-e08d-23e1-07d3-96c5c7ffeeac/Datastore2-9166/RAJATEST/RAJATEST_2-flat.vmdk"
 "format:raw"
libguestfs: trace: add_drive = 0
libguestfs: trace: add_drive 
"/var/opt/omni/tmp/GRE/5029f5c4-e08d-23e1-07d3-96c5c7ffeeac/2023/09/16-3/5029f5c4-e08d-23e1-07d3-96c5c7ffeeac/Datastore2-9166/RAJATEST/RAJATEST-flat.vmdk"
 "format:raw"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: max_disks
libguestfs: trace: max_disks = 255
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: version
libguestfs: trace: version = 
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=greagent.exe
libguestfs: launch: 
version=1.38.4rhel=8,release=15.module+el8.2.0+5297+222a20af,libvirt
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsMzD9Rl
libguestfs: launch: umask=0002
libguestfs: launch: euid=0
libguestfs: is_openable: /dev/kvm: No such file or directory
libguestfs: trace: get_backend_setting "force_tcg"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-0/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-0/appliance.d
supermin: version: 5.1.19
supermin: rpm: detected RPM version 4.14
supermin: package handler: fedora/rpm
supermin: acquiring lock on /var/tmp/.guestfs-0/lock
supermin: if-newer: output does not need rebuilding
libguestfs: trace: launch = -1 (error)
libguestfs: trace: close
libguestfs: closing guestfs handle 0xbb0a70 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsMzD9Rl


Thanks
RR




-Original Message-
From: Richard W.M. Jones  
Sent: Saturday, September 16, 2023 9:39 PM
To: Teja Konapalli 
Cc: libguestfs@redhat.com; Raja Ram Sharma ; Divyanshu 
Kumar 
Subject: [EXTERNAL] - Re: LIBGUESTFS mount disk failure

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe. If you feel that the email is suspicious, please report it using 
PhishAlarm.


On Sat, Sep 16, 2023 at 03:56:07PM +, Teja Konapalli wrote:
> Hi Richard & Team,
>
>
>
> Could you please help here on the below failure of mounting disk using 
> libguestfs.
>
>
>
> OS version: RHEL 8.2
>
> Libguestfs version: 1.38.0 stable
>
>
>
>
>
> Error logs:
>
>
>
> libguestfs: trace: add_drive_ro "/var/opt/tmp/GRE//RAJA/RAJAT-flat.vmdk"
> libguestfs: trace: add_drive "/var/opt/tmp/GRE//RAJA/RAJAT-flat.vmdk"
> "readonly:true"
> libguestfs: creating COW overlay to protect original drive content
> libguestfs: trace: disk_create "/tmp/libguestfsCpl8My/overlay3.qcow2" "qcow2"
> -1 

Re: [Libguestfs] [EXTERNAL] - Re: LIBGUESTFS mount disk failure

2023-09-17 Thread Richard W.M. Jones
On Sun, Sep 17, 2023 at 03:55:24AM +, Raja Ram Sharma wrote:
> Hi Richard, 
> 
> Wish you a happy weekend! 
> 
> Guestfs_launch fails after below error :
>   
>   libguestfs: is_openable: /dev/kvm: No such file or directory
>   libguestfs: trace: get_backend_setting "force_tcg"
>   libguestfs: trace: get_backend_setting = NULL (error)
>   ^^^
> Same line has also printed in " LIBGUESTFS_BACKEND=direct 
> libguestfs-test-tool " at line $96-$98
>   ^^^
>   Could not access KVM kernel module: No such file or directory
>   qemu-kvm: failed to initialize KVM: No such file or directory
>   ^^^

Thanks for providing the second output.

The above messages aren't errors.

I really need much more context.  I need to see the program that
you're trying to run, or a self-contained reproducer, and I also need
to see the _complete_ output from the program from start to finish,
not just small parts of it.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs