Bug 2401684 - DNF output begins with "repo_comps: Document is empty", then proceeds as normal
Summary: DNF output begins with "repo_comps: Document is empty", then proceeds as normal
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 42
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: rpm-software-management
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-10-05 18:12 UTC by Nick Krichevsky
Modified: 2025-10-23 11:43 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-10-23 11:43:27 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
strace of `dnf info sdfljk` (4.06 MB, text/plain)
2025-10-05 18:12 UTC, Nick Krichevsky
no flags Details

Description Nick Krichevsky 2025-10-05 18:12:04 UTC
Since this morning, I've noticed that all DNF output begins with  "repo_comps: Document is empty"

e.g.
```
$ dnf info sldkf
Updating and loading repositories:
repo_comps: Document is empty
 at line 1:1
Repositories loaded.
No matching packages to list
```

I've tried a `dnf clean all` to no avail. I've attached an strace; it appears like it comes from reading the dnf cache.


Reproducible: Always

Steps to Reproduce:
1. Run any dnf command
2. Observe this output

I'm sure this doesn't happen on every Fedora installation, and there is something specific about my system here, but I haven't been able to gather what.

Comment 1 Nick Krichevsky 2025-10-05 18:12:53 UTC
Created attachment 2108687 [details]
strace of `dnf info sdfljk`

Comment 2 Petr Pisar 2025-10-06 10:08:38 UTC
The error messages comes from libsolv when parsing *-comps-*.xml* file of a repository. The error usually means that the XML file is empty, but it is also reported when there is no root element or an entity is not terminated.

Determine which repository is affected with --enablerepo, --disablerepo, or --repo options. That check the corresponding comps file under /var/cache/libdn5.

Comment 3 Nick Krichevsky 2025-10-07 23:36:29 UTC
I disabled all repos, but the error persists. Here is an example using check-update, which should validate that I've disabled the repos properly

```
$ sudo dnf --disable-repo=$(dnf repolist --json | jq .[].id -r |tr '\n' ',') check-update
Updating and loading repositories:
repo_comps: Document is empty
 at line 1:1
Repositories loaded.
```

@ppisar

Comment 4 Petr Pisar 2025-10-08 11:01:30 UTC
You can write --disable-repo='*' instead. The argument is a glob and expands to all repository identifiers.

Frankly, I cannot reproduce your problem.

The only other place with comps XML files is /usr/lib/sysimage/libdnf5/comps_groups directory. It retains definitions of installed groups. Do you have something interesting there?

If you uninstall are groups (dnf group remove --no-packages '*'), does the problem persist?

Comment 5 Nick Krichevsky 2025-10-08 11:41:36 UTC
Nice spot!

$ ls /usr/lib/sysimage/libdnf5/comps_groups -l
<snip>
-rw-r--r--. 1 root root     0 Oct  5 13:39 cosmic-desktop.xml

Deleting this file did it for me. This aligns with when I started seeing the problem; I don't recall the exact sequence of things that I did, but I believe I used `dnf history undo` to undo a groupinstall of cosmic-desktop.

Comment 6 Petr Pisar 2025-10-08 12:55:18 UTC
Thanks for the details. Indeed when a group is installed and its XML file in /usr/lib/sysimage/libdnf5/comps_groups is empty, then this message is printed. It e.g. prevents from listing the installed groups:

root@fedora-42:~ # dnf --disablerepo '*' group list --installed
Updating and loading repositories:
Repositories loaded.
ID                    Name                  Installed
rpm-development-tools RPM Development Tools       yes
root@fedora-42:~ # truncate -s 0  /usr/lib/sysimage/libdnf5/comps_groups/rpm-development-tools.xml 
root@fedora-42:~ # dnf --disablerepo '*' group list --installed
Updating and loading repositories:
repo_comps: Document is empty
 at line 1:1
Repositories loaded.
root@fedora-42:~ # echo $?
0

Workaround is, as you wrote, removing that empty file:

# rm /usr/lib/sysimage/libdnf5/comps_groups/rpm-development-tools.xml
# dnf --disablerepo '*' group list --installed
Updating and loading repositories:
Repositories loaded.
ID                    Name Installed
rpm-development-tools            yes

I'm not aware of any DNF5 bug that would truncate the files.

I only know that DNF5 was not good at atomically updating the files and if some external error occurred, like a power outage, or killing the DNF5 process, then the file could have left corrupted. That issue was supposedly fixed in https://github.com/rpm-software-management/dnf5/pull/2289 after 5.2.13.1.

Comment 7 Petr Pisar 2025-10-23 11:43:27 UTC
Correct approach is identify and fix the cause instead of papering over the warning message by automatically removing empty files.
Since the file becomes empty as a result of an unknown error, I will close this bug report for now. If somebody meets this warning again, please share us with the reproducer.


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