But when I executed the command suggested by the documentation: sudo dnf remove --duplicates
The following prompt message was received: Unknown argument "--duplicates" for command "remove".
The --duplicatesflag works with dnf4, but apparently not with dnf5 (see man dnf remove).
You could run sudo dnf4 remove --duplicates for your specific issue. Does the command sudo dnf repoquery --duplicates return any packages? If it doesn’t, then there is no need to remove any.
Regarding the referred doc, it obviously needs ammended, as it isn’t updated to F41.
The point is, that if the update is interrupted before being done, you have an inconsistent rpm database, where some packages appears to be installed multiple times. Thus what needs to be done is remove the record of the oldest package, and make sure the newest version is in a consistent state.
From man rpm of dnf4 you can read:
dnf [options] remove --duplicates
Removes older versions of duplicate packages. To ensure the integrity
of the system it reinstalls the newest package. In some cases the com‐
mand cannot resolve conflicts. In such cases the dnf shell command with
remove --duplicates and upgrade dnf-shell sub-commands could help.
Notice that probably the files provided by the new package have already replaced the files that came with the old package, or maybe not, depending on when the process was interrupted.
The meta-information of the database may be inconsistent. But the overall consistency isn’t. When doing a big update, all the install procedures if the new packages are processed one by one, and then all the uninstall procedures of the old packages are processed one by one.
for pkg in pkgs_list[1:]:
self.base.package_remove(pkg)
which goes through the list of duplicates packages from the newest to the oldest skipping the newest package itself. Before that, the newest package is re-installed.