Bug 2379916 - GuestFish intermittently failing after upgrading Base image to Fedora 40
Summary: GuestFish intermittently failing after upgrading Base image to Fedora 40
Keywords:
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-07-14 15:55 UTC by chintan_orbit
Modified: 2025-10-17 12:52 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-10-17 00:11:18 UTC
Embargoed:


Attachments (Terms of Use)
libguestfs_test_tool results (1.05 KB, text/plain)
2025-07-22 20:40 UTC, armanamjad
no flags Details
inspect-os test without --remote flag (98.60 KB, image/png)
2025-07-24 18:39 UTC, armanamjad
no flags Details
fedora 40 disk inspect-os full debug logs (97.00 KB, text/plain)
2025-07-24 19:32 UTC, armanamjad
no flags Details
Testing libguestfs on fedora 42, connecting to a disk sas uri fails now. (2.29 KB, text/plain)
2025-08-08 21:28 UTC, armanamjad
no flags Details
Fedora 40 libguestfs 1.52 inspect os and list filesystems failing (95.04 KB, text/plain)
2025-08-13 18:41 UTC, armanamjad
no flags Details

Description chintan_orbit 2025-07-14 15:55:41 UTC
Description of problem:
We were using LibguestFS version 1.52 on Fedora 39 and it was working as expected since last year, but due to the security issue and Fedora 39 is our of support we need to upgrade to Fedora 40 for our container base image.

But after upgrading to Fedora 40, we are started experiencing intermittent failure on guestfish to mount the disk, sometime it is able to mount the disk as well execute the copy command to copy the files from disk and fails in middle. We are getting below failure messages in the failure.
message

OperationalLog: /dev/sda2: ntfs [uuid=30BC6B21BC6AE0B8]
/dev/sda3: vfat [uuid=166A-F60E]
/dev/sda4: ntfs [uuid=9E3C6B453C6B1793]
GuestFish:Inspecting OS Metadata:Remote> /libguestfs/run guestfish --remote inspect-os
GuestFish:Inspecting OS Metadata:Error>
guestfish: protocol error: could not decode reply from server
GuestFish: Retrying forInspecting OS Metadata
GuestFish:Inspecting OS Metadata:Remote> /libguestfs/run guestfish --remote inspect-os
GuestFish:Inspecting OS Metadata:Error>
guestfish: remote: looks like the server is not running


message
GuestFish:Mount [/,/dev/sda1]:Remote> /libguestfs/run guestfish --remote -- -mount-ro /dev/sda1 /
GuestFish:Mount [/,/dev/sda1]:Error>
guestfish: remote: looks like the server is not running


I tried upgrading the libguesfs to the latest version 1.56.1 but still observing similar errors intermittently.
Version-Release number of selected component (if applicable):


How reproducible:
Using this forked branch to allow providing query string of disk uri as part of input on top of latest master.
https://github.com/Azure/libguestfs/tree/chipate/Merge1.56

Trying to connect to the VM Disk ad execute some list and copy commands to get logs files. That operations failing on the "guestfish --remote inspect-os" or sometime copy commands.

Steps to Reproduce:
1.
2.
3.

Actual results:
Err:r guestfish: remote: looks like the server is not running

Expected results:
Should copy the log files after mounting the disk.

Additional info:

Comment 1 Richard W.M. Jones 2025-07-14 16:03:23 UTC
I think the first step is to enable debugging[1] and collect the complete
log so we know what's actually going on.

[1] https://libguestfs.org/guestfs-faq.1.html#how-do-i-debug-when-using-any-libguestfs-program-or-tool-eg.-virt-customize-or-virt-df

Comment 2 chintan_orbit 2025-07-14 23:59:53 UTC
Here are the logs I'm getting after enabling the debug:
GuestFish:Getting guestfish/libguestFS version:Error> 
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_tmpdir "/libguestfs/tmp"
libguestfs: trace: set_tmpdir = 0
libguestfs: trace: set_cachedir "/libguestfs/tmp"
libguestfs: trace: set_cachedir = 0
libguestfs: trace: set_path "/libguestfs/appliance"
libguestfs: trace: set_path = 0
libguestfs: create: flags = 0, handle = 0xec55b40, program = guestfish
libguestfs: trace: shutdown
libguestfs: trace: shutdown = 0
libguestfs: trace: close
libguestfs: closing guestfs handle 0xec55b40 (state 0)


GuestFish:Exiting:Error> 
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_tmpdir "/libguestfs/tmp"
libguestfs: trace: set_tmpdir = 0
libguestfs: trace: set_cachedir "/libguestfs/tmp"
libguestfs: trace: set_cachedir = 0
libguestfs: trace: set_path "/libguestfs/appliance"
libguestfs: trace: set_path = 0
libguestfs: create: flags = 0, handle = 0x3cceab40, program = guestfish
libguestfs: trace: shutdown
libguestfs: trace: shutdown = 0
libguestfs: trace: close
libguestfs: closing guestfs handle 0x3cceab40 (state 0)

Comment 3 Richard W.M. Jones 2025-07-15 07:03:21 UTC
That's definitely not all of the logs.  Set the environment variables as
described, and then copy *all* of the output generated.

Comment 4 chintan_orbit 2025-07-15 15:28:35 UTC
We did set the environment variable and those are the only logs we are getting. After setting those environment variables, when the above debug logs print, out container crashes, so no more logs getting emmitted.
Here is the portion of DockerFile we use as part of our container to build and libguestfs and set the env variable.

FROM mcr.microsoft.com/mirror/docker/library/fedora:40

ARG PAT_TOKEN

# package dependencies
RUN dnf install dnf-plugins-core -y \
 && dnf builddep libguestfs -y \
 && dnf updateinfo \
 && dnf upgrade --refresh -y \
 && dnf install -y \
    autoconf \
    automake \
    libtool \
    gettext-devel\
    git \
    zstd \
    nginx \
    python3-pip \
    wget \
    supermin \
    koji \
    mono-devel \
    json-c-devel

# Download kernel 6.14 for Fedora 40. Reference: https://docs.fedoraproject.org/en-US/quick-docs/kernel/installing-koji-kernel/
RUN cd $(mktemp -d) \
  && koji download-build --arch=x86_64 --arch=noarch kernel-6.14.6-100.fc40 \
  && dnf install -y *

# patched libguestfs
WORKDIR /
RUN git clone -b chipate/Merge1.56 --single-branch --depth 1 https://github.com/Azure/libguestfs
WORKDIR /libguestfs
RUN git submodule update --init
RUN autoreconf -i
RUN ./configure
RUN make

# Enable Debug for LibGuestFS
ENV LIBGUESTFS_TRACE=1
ENV LIBGUESTFS_DEBUG=1

RUN make -C appliance clean-supermin-appliance

Comment 5 Richard W.M. Jones 2025-07-17 07:49:26 UTC
I don't know why, but only a tiny fraction of messages are being logged, so
you've got to solve that so you can get the complete output.

Maybe don't use a container and just run everything on the host as normal?

Comment 6 armanamjad 2025-07-22 20:37:19 UTC
(In reply to Richard W.M. Jones from comment #5)
> I don't know why, but only a tiny fraction of messages are being logged, so
> you've got to solve that so you can get the complete output.
> 
> Maybe don't use a container and just run everything on the host as normal?

Hi Richard, I work with Chintan and I tried running the commands on a Fedora 40 VM without using a container, but the debug and tracelogs don't give much info. Attaching the disk and launching guestfish work as normal, but once I run the inspect-os command it just hangs endlessly without any response:

[azureuser@testFedora40 libguestfs]$ ./run guestfish --remote inspect-os
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_tmpdir "/home/azureuser/Azure-DiskInspect-Service/src/pyServer/libguestfs/tmp"
libguestfs: trace: set_tmpdir = 0
libguestfs: trace: set_cachedir "/home/azureuser/Azure-DiskInspect-Service/src/pyServer/libguestfs/tmp"
libguestfs: trace: set_cachedir = 0
libguestfs: trace: set_path "/home/azureuser/Azure-DiskInspect-Service/src/pyServer/libguestfs/appliance"
libguestfs: trace: set_path = 0
libguestfs: create: flags = 0, handle = 0x115fe60, program = guestfish
libguestfs: trace: set_pgroup true
libguestfs: trace: set_pgroup = 0

If I download the vhd file and use that to attach the disk I don't see this issue and inspect-os works fine, but when I attach the disk using a SAS URL then inspect-os doesn't work. I tried the libguestfs_test_tool and it doesn't seem to report any issues. I will attach the test result to this.

Comment 7 armanamjad 2025-07-22 20:40:45 UTC
Created attachment 2097918 [details]
libguestfs_test_tool results

Comment 8 armanamjad 2025-07-23 16:33:50 UTC
Hi Richard, I did some more testing and found that I am sometimes able to get a response with inspect-os command, but the latency is significantly higher than before when we were running this in Fedora 39. It's not as consistent either as sometimes the command will finish in under a minute, while other times it will not complete for a few minutes. We didn't notice these latency issues when running on Fedora 39 though, do you know why the upgrade to Fedora 40 would cause these issues we're seeing? One thing to note is the command runs fast when I attach the disk directly with a vhd, this issue is isolated to disks which are attached via blob SAS URL.

Comment 9 Richard W.M. Jones 2025-07-24 08:23:39 UTC
(In reply to armanamjad from comment #6)
> [azureuser@testFedora40 libguestfs]$ ./run guestfish --remote inspect-os

The problem here is that you're enabling debugging for the guestfish --remote
command, not for libguestfs (running remotely).

(In reply to armanamjad from comment #7)
> Created attachment 2097918 [details]
> libguestfs_test_tool results

This is missing almost all of the debug messages for some reason.

I'm still cannot help unless you're able to produce full, unedited debug messages.
Would suggest removing all use of containers and use of --remote, and isolate it
down to a simple test case, then enable debugging and collect all of the
messages (both stdout & stderr).

Comment 10 Richard W.M. Jones 2025-07-24 08:24:23 UTC
(In reply to armanamjad from comment #8)
> Hi Richard, I did some more testing and found that I am sometimes able to
> get a response with inspect-os command, but the latency is significantly
> higher than before when we were running this in Fedora 39. It's not as
> consistent either as sometimes the command will finish in under a minute,
> while other times it will not complete for a few minutes. We didn't notice
> these latency issues when running on Fedora 39 though, do you know why the
> upgrade to Fedora 40 would cause these issues we're seeing? One thing to
> note is the command runs fast when I attach the disk directly with a vhd,
> this issue is isolated to disks which are attached via blob SAS URL.

No idea - I need the debugging to tell anything about failures or performance
regressions.

Comment 11 armanamjad 2025-07-24 18:38:24 UTC
Hm, I tried removing --remote and this is the output I got:
><fs> inspect-os
libguestfs: trace: inspect_os
inspect_os: collect_coreos_inspection_info
inspect_os: check_for_duplicated_bsd_root
inspect_os: check_for_duplicated_btrfs_snapshots_of_root
inspect_os: collect_linux_inspection_info
libguestfs: trace: inspect_os = ["btrfsvol:/dev/sda3/root"]
btrfsvol:/dev/sda3/root

Are these the full logs? Please let me know if I should be using a different command to test this.

Comment 12 armanamjad 2025-07-24 18:39:24 UTC
Created attachment 2098109 [details]
inspect-os test without --remote flag

Comment 13 Richard W.M. Jones 2025-07-24 19:21:16 UTC
https://libguestfs.org/guestfs-faq.1.html#how-do-i-debug-when-using-any-libguestfs-program-or-tool-eg.-virt-customize-or-virt-df

Set the environment variables before running guestfish.

Attach the complete, unedited debug output as a TEXT file to this bug.  It will be
quite lengthy.

Comment 14 armanamjad 2025-07-24 19:32:56 UTC
Created attachment 2098135 [details]
fedora 40 disk inspect-os full debug logs

Comment 15 armanamjad 2025-07-24 19:33:50 UTC
Thanks Richard, I was able to get the full logs now. Just attached the text file.

Comment 16 Richard W.M. Jones 2025-07-24 19:48:20 UTC
So the logs show inspecting a disk.  Actually the disk comes from an HTTPS server,
which is slightly unusual but shouldn't normally cause a problem (if the network
doesn't have too high latency).  We seem to successfully inspect the disk, find
a Fedora 40 guest on the disk, and print the btrfs root volume.

However I think you reported that mounting filesystem(s) from the disk failed.
You didn't try that explicitly here (although inspection does mount some filesystems
from the disk implicitly, apparently without problem).

As such I can't really see if there's an issue with this.  What happens when you
do something that fails?  (Again, full logs are required.)

You could also try using the guestfish -i option which will inspect and mount up
the filesystems from the original guest.

Comment 17 armanamjad 2025-08-08 21:28:02 UTC
Created attachment 2103086 [details]
Testing libguestfs on fedora 42, connecting to a disk sas uri fails now.

Comment 18 armanamjad 2025-08-08 21:32:15 UTC
Hi Richard, the error we were seeing on fedora 40 seemed to be more of a reliability issue where there the connection to the disk would get lost intermittently. It was difficult to reproduce the error in a local environment and get debug logs.

I have been trying out different setups and am currently facing an error after upgrading to fedora 42, this time connecting to the disk consistently fails. I attached the debug logs, it looks like there is an issue supporting HTTPS protocol. Do you know if HTTPS protocol is not supported in later versions of qemu img?

Comment 19 Richard W.M. Jones 2025-08-13 08:54:26 UTC
(In reply to armanamjad from comment #18)
> Hi Richard, the error we were seeing on fedora 40 seemed to be more of a
> reliability issue where there the connection to the disk would get lost
> intermittently. It was difficult to reproduce the error in a local
> environment and get debug logs.

This is because it's using HTTP to connect to the disk?  You'll need to
make sure the HTTP connection is reliable and low latency.

> I have been trying out different setups and am currently facing an error
> after upgrading to fedora 42, this time connecting to the disk consistently
> fails. I attached the debug logs, it looks like there is an issue supporting
> HTTPS protocol. Do you know if HTTPS protocol is not supported in later
> versions of qemu img?

qemu-img: /home/azureuser/libguestfs/tmp/libguestfsJgFtvV/overlay1.qcow2: Unknown protocol 'https'

That's pretty strange.  What version of qemu is this (full RPM NVR)?

Comment 20 armanamjad 2025-08-13 18:40:38 UTC
I was able to get past this error actually, after installing qemu-block-curl disk connection via url and launch started working. But now the latest error I am seeing is the list-filesystems and inspect-os commands are failing. I am stumped on this one and not sure if it's related to my setup or incompatibility with libguestfs 1.52 and fedora 40. Could you take a look at my debug logs and let me know if anything sticks out to you?

Comment 21 armanamjad 2025-08-13 18:41:22 UTC
Created attachment 2103560 [details]
Fedora 40 libguestfs 1.52 inspect os and list filesystems failing

Comment 22 Richard W.M. Jones 2025-08-14 08:03:23 UTC
The server is giving errors, lots of:
qemu-kvm: curl: The requested URL returned error: 503

Comment 23 armanamjad 2025-09-23 16:17:47 UTC
Hey Richard,

The above errors we were seeing were related to setup /dependency issues, and I was able to resolve those. But the main issue still is that when we connect to the disk via SAS URL rather than a local VHD file, we experience intermittent disconnection errors where the inspect-os or mount command will time out and we need to reconnect to the disk. Are there any known issues similar to this?

Additionally, we are currently using a custom fork of the repo where we have a commit which would allow guestfish commands to be able to parse query parameters, as currently this feature is unavailable. Would it be possible to get this commit merged into the main libguestfs repo so we may pull from the official source? This would reduce potential setup issues and upkeep on our end as well. I can create a pull request with the change if this commit seems reasonable to you:
https://github.com/libguestfs/libguestfs/commit/cf0d959b8a0bbaf407e76c668a3884c93b612b4b

Comment 24 Richard W.M. Jones 2025-09-25 09:01:52 UTC
I guess the backing disk has to be stable, otherwise no tooling can work reliably.

I have specific comments about the commit, but more generally, I'm not sure what it's trying to do.  However we could look at it properly in a PR.

Comment 25 armanamjad 2025-09-26 16:24:34 UTC
Created the PR: https://github.com/libguestfs/libguestfs/pull/215

Comment 26 armanamjad 2025-10-09 20:27:46 UTC
I created a PR for the Common updates as well since it is in a submodule. Please take a look: https://github.com/libguestfs/libguestfs-common/pull/19

Comment 27 Red Hat Bugzilla 2025-10-17 00:11:18 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.

Comment 28 Alasdair Kergon 2025-10-17 12:52:13 UTC
Reopening because Virtualization Tools has not been discontinued.


Note You need to log in before you can comment on or make changes to this bug.