DNF update failed due to package duplicates

how to fix this i tried everything

Transaction failed: Rpm transaction failed.

  • file /usr/share/gcc-14/python/libstdcxx/pycache/init.cpython-312.opt-1.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64
  • file /usr/share/gcc-14/python/libstdcxx/pycache/init.cpython-312.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64
  • file /usr/share/gcc-14/python/libstdcxx/v6/pycache/init.cpython-312.opt-1.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64
  • file /usr/share/gcc-14/python/libstdcxx/v6/pycache/init.cpython-312.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64
  • file /usr/share/gcc-14/python/libstdcxx/v6/pycache/printers.cpython-312.opt-1.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64
  • file /usr/share/gcc-14/python/libstdcxx/v6/pycache/printers.cpython-312.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64
  • file /usr/share/gcc-14/python/libstdcxx/v6/pycache/xmethods.cpython-312.opt-1.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64
  • file /usr/share/gcc-14/python/libstdcxx/v6/pycache/xmethods.cpython-312.pyc from install of libstdc+±14.1.1-7.fc40.i686 conflicts with file from package libstdc+±14.1.1-6.fc40.x86_64

What command are you using to update your system? It appears that it is trying to update libstdc++.i686 without also updating libstdc++.x86_64. You might try running dnf update libstdc++ first.

From Ask in Other Languages to Ask Fedora

Removed unlisted-language

tried still that same issue, i tried to update using sudo dnf update libstdc++ and sudo dnf update libstdc++.i686 and sudo dnf update , all of this still same error and other stackoverflow commands too

How about dnf --refresh update libstdc++.x86_64?

1 Like

output :Repositories loaded.
Nothing to do.
and even i tried to update using this sudo dnf --refresh update libstdc++
but still same error

For some reason, your system is trying to update the i686 version but not the x86_64 version and that combination will not work. Maybe you have something installed that is preventing the x86_64 version from updating. Does dnf --allowerasing update libstdc++.x86_64 cause it to try to remove something so that the x86_64 version of the package will update?

dnf5 dont have --allowerasing and i even tried using 4 but output is noting to do

sudo dnf remove --duplicates
sudo dnf distro-sync --refresh
1 Like

❯ sudo dnf remove --duplicates
Unknown argument “–duplicates” for command “remove”. Add “–help” for more information about the arguments.

dnf check duplicates
dnf list libstdc++ --showduplicates
dnf repoquery libstdc++ --showduplicates --installed

You might want to verify that there are no exclude=... lines in /etc/dnf/dnf.conf or any of the repo files under /etc/yum.repos.d. Those “exclude” lines can cause this sort of problem with DNF’s dependency solving algorithm.

❯ sudo dnf4 list libstdc++ --showduplicates
Last metadata expiration check: 0:11:17 ago on Monday 08 July 2024 07:06:41 AM.
Installed Packages
libstdc++.i686 14.1.1-6.fc40 @System
libstdc++.x86_64 14.1.1-6.fc40 @System
libstdc++.x86_64 14.1.1-7.fc40 @System
Available Packages
libstdc++.i686 14.0.1-0.15.fc40 fedora
libstdc++.x86_64 14.0.1-0.15.fc40 fedora
libstdc++.i686 14.1.1-7.fc40 updates
libstdc++.x86_64 14.1.1-7.fc40 updates

and sudo dnf4 repoquery libstdc++ --showduplicates --installed
libstdc+±0:14.1.1-6.fc40.i686
libstdc+±0:14.1.1-6.fc40.x86_64
libstdc+±0:14.1.1-7.fc40.x86_64

there was nothing excluded

Ah, so you do have a duplicate install of libstdc++. That is the problem. Fixing that could be tricky though. If you try to remove the package, it might remove the files that belong to the newer version. I’d make sure you have a backup of anything important. If you can take a quick snapshot of your rootfs before proceeding, that might also be wise.

sudo dnf remove libstdc++-14.1.1-6.fc40.x86_64
sudo rpm --nodeps -e libstdc++-14.1.1-6.fc40.x86_64

You should probably run dnf reinstall libstdc++.x86_64 immediately after you run that rpm --nodeps -e ... command just to be sure that none of the files that actually belong to the newer version end up missing. (And hope that dnf doesn’t depend on libstdc++ if any of the files are missing. :slightly_smiling_face: In a worst-case scenario, you could fix things up from a Live session.)

Hmm, if I’m reading this correctly, it looks like libstdc++ is in DNF’s dependency chain:

dnf rq --whatdepends libstdc++ | grep dnf
Last metadata expiration check: 0:31:49 ago on Sun 07 Jul 2024 08:36:26 PM CDT.
dnf5-0:5.1.17-1.fc39.i686
dnf5-0:5.1.17-1.fc39.x86_64
dnf5-0:5.1.4-1.fc39.i686
dnf5-0:5.1.4-1.fc39.x86_64
dnf5-plugin-automatic-0:5.1.17-1.fc39.x86_64
dnf5-plugins-0:5.1.17-1.fc39.x86_64
dnf5-plugins-0:5.1.4-1.fc39.x86_64
dnf5daemon-client-0:5.1.17-1.fc39.x86_64
dnf5daemon-client-0:5.1.4-1.fc39.x86_64
dnf5daemon-server-0:5.1.17-1.fc39.x86_64
dnf5daemon-server-0:5.1.4-1.fc39.x86_64
libdnf-0:0.72.0-1.fc39.i686
libdnf-0:0.72.0-1.fc39.x86_64
libdnf-0:0.73.1-1.fc39.i686
libdnf-0:0.73.1-1.fc39.x86_64
libdnf-plugin-txnupd-0:0.1.3-6.fc39.x86_64
libdnf5-0:5.1.17-1.fc39.i686
libdnf5-0:5.1.17-1.fc39.x86_64
libdnf5-0:5.1.4-1.fc39.i686
libdnf5-0:5.1.4-1.fc39.x86_64
libdnf5-cli-0:5.1.17-1.fc39.i686
libdnf5-cli-0:5.1.17-1.fc39.x86_64
libdnf5-cli-0:5.1.4-1.fc39.i686
libdnf5-cli-0:5.1.4-1.fc39.x86_64
libdnf5-plugin-actions-0:5.1.17-1.fc39.x86_64
libdnf5-plugin-actions-0:5.1.4-1.fc39.x86_64
libdnf5-plugin-rhsm-0:5.1.17-1.fc39.x86_64
perl-libdnf5-0:5.1.17-1.fc39.x86_64
perl-libdnf5-0:5.1.4-1.fc39.x86_64
perl-libdnf5-cli-0:5.1.17-1.fc39.x86_64
perl-libdnf5-cli-0:5.1.4-1.fc39.x86_64
python3-libdnf-0:0.72.0-1.fc39.x86_64
python3-libdnf-0:0.73.1-1.fc39.x86_64
python3-libdnf5-0:5.1.17-1.fc39.x86_64
python3-libdnf5-0:5.1.4-1.fc39.x86_64
python3-libdnf5-cli-0:5.1.17-1.fc39.x86_64
python3-libdnf5-cli-0:5.1.4-1.fc39.x86_64
python3-libdnf5-python-plugins-loader-0:5.1.17-1.fc39.x86_64
python3-libdnf5-python-plugins-loader-0:5.1.4-1.fc39.x86_64
ruby-libdnf5-0:5.1.17-1.fc39.x86_64
ruby-libdnf5-0:5.1.4-1.fc39.x86_64
ruby-libdnf5-cli-0:5.1.17-1.fc39.x86_64
ruby-libdnf5-cli-0:5.1.4-1.fc39.x86_64

However, the rpm command (from the rpm package) does not appear to depend on libstdc++.

$ dnf rq --whatdepends libstdc++ | grep rpm
Last metadata expiration check: 0:32:30 ago on Sun 07 Jul 2024 08:36:26 PM CDT.
plasma-discover-rpm-ostree-0:5.27.11-3.fc39.i686
plasma-discover-rpm-ostree-0:5.27.11-3.fc39.x86_64
plasma-discover-rpm-ostree-0:5.27.8-1.fc39.i686
plasma-discover-rpm-ostree-0:5.27.8-1.fc39.x86_64
rpm-ostree-0:2023.7-1.fc39.x86_64
rpm-ostree-0:2024.5-1.fc39.x86_64
tiled-plugin-rpmap-0:1.10.2-1.fc39.x86_64
tiled-plugin-rpmap-0:1.11.0-1.fc39.x86_64

You might want to run dnf download libstdc++.x86_64 before running rpm --nodeps -e ... just in case. If you find that you cannot run dnf after you’ve removed that package, you should still be able to run rpm -ivh ./libstdc++* if you have the package downloaded.

1 Like

i just simply ```
sudo dnf remove libstdc+±14.1.1-6.fc40.x86_64
sudo rpm --nodeps -e libstdc+±14.1.1-6.fc40.x86_64

2 Likes