DNF operations lead to btrfs issues

I have dnf issues and whenever I try to solve them the file system is locked and I have to fix btrfs to be able to boot again (the dnf issues remain).

First dnf check discovers 102 Problems - all duplicates:

[peer@fedora ~]$ sudo dnf check
adobe-mappings-cmap-20230118-1.fc38.noarch is a duplicate with adobe-mappings-cmap-20230622-1.fc38.noarch
adobe-mappings-cmap-deprecated-20230118-1.fc38.noarch is a duplicate with adobe-mappings-cmap-deprecated-20230622-1.fc38.noarch
alternatives-1.24-1.fc38.x86_64 is a duplicate with alternatives-1.25-1.fc38.x86_64
audit-libs-3.1.1-1.fc38.x86_64 is a duplicate with audit-libs-3.1.2-1.fc38.x86_64
cheese-2:44.0.1-1.fc38.x86_64 is a duplicate with cheese-2:44.1-1.fc38.x86_64
cheese-libs-2:44.0.1-1.fc38.x86_64 is a duplicate with cheese-libs-2:44.1-1.fc38.x86_64
cpp-13.1.1-4.fc38.x86_64 is a duplicate with cpp-13.2.1-1.fc38.x86_64
cxl-libs-77-1.fc38.x86_64 is a duplicate with cxl-libs-78-1.fc38.x86_64
daxctl-libs-77-1.fc38.x86_64 is a duplicate with daxctl-libs-78-1.fc38.x86_64
dnf-4.16.1-1.fc38.noarch is a duplicate with dnf-4.16.2-1.fc38.noarch
dnf-data-4.16.1-1.fc38.noarch is a duplicate with dnf-data-4.16.2-1.fc38.noarch
dnf-plugins-core-4.4.1-1.fc38.noarch is a duplicate with dnf-plugins-core-4.4.2-1.fc38.noarch
epiphany-runtime-1:44.5-1.fc38.x86_64 is a duplicate with epiphany-runtime-1:44.6-1.fc38.x86_64
flexiblas-3.3.1-3.fc38.x86_64 is a duplicate with flexiblas-3.3.1-5.fc38.x86_64
flexiblas-netlib-3.3.1-3.fc38.x86_64 is a duplicate with flexiblas-netlib-3.3.1-5.fc38.x86_64
flexiblas-openblas-openmp-3.3.1-3.fc38.x86_64 is a duplicate with flexiblas-openblas-openmp-3.3.1-5.fc38.x86_64
gcc-13.1.1-4.fc38.x86_64 is a duplicate with gcc-13.2.1-1.fc38.x86_64
gcc-c++-13.1.1-4.fc38.x86_64 is a duplicate with gcc-c++-13.2.1-1.fc38.x86_64
gcc-gdb-plugin-13.1.1-4.fc38.x86_64 is a duplicate with gcc-gdb-plugin-13.2.1-1.fc38.x86_64
gnome-software-44.3-1.fc38.x86_64 is a duplicate with gnome-software-44.4-1.fc38.x86_64
grub2-common-1:2.06-98.fc38.noarch is a duplicate with grub2-common-1:2.06-100.fc38.noarch
grub2-pc-modules-1:2.06-98.fc38.noarch is a duplicate with grub2-pc-modules-1:2.06-100.fc38.noarch
grub2-tools-1:2.06-98.fc38.x86_64 is a duplicate with grub2-tools-1:2.06-100.fc38.x86_64
grub2-tools-1:2.06-98.fc38.x86_64 is obsoleted by grub2-tools-minimal-1:2.06-100.fc38.x86_64
grub2-tools-minimal-1:2.06-98.fc38.x86_64 is a duplicate with grub2-tools-minimal-1:2.06-100.fc38.x86_64
gspell-1.12.1-1.fc38.x86_64 is a duplicate with gspell-1.12.2-1.fc38.x86_64
gtk4-4.10.4-1.fc38.x86_64 is a duplicate with gtk4-4.10.5-1.fc38.x86_64
gupnp-1.6.4-1.fc38.x86_64 is a duplicate with gupnp-1.6.5-1.fc38.x86_64
gvfs-1.50.5-2.fc38.x86_64 is a duplicate with gvfs-1.50.6-1.fc38.x86_64
gvfs-client-1.50.5-2.fc38.x86_64 is a duplicate with gvfs-client-1.50.6-1.fc38.x86_64
gvisor-tap-vsock-6:0.7.0-3.fc38.x86_64 is a duplicate with gvisor-tap-vsock-6:0.7.0-6.fc38.x86_64
gvisor-tap-vsock-6:0.7.0-3.fc38.x86_64 is obsoleted by gvisor-tap-vsock-gvforwarder-6:0.7.0-6.fc38.x86_64
hplip-3.23.5-1.fc38.x86_64 is a duplicate with hplip-3.23.5-8.fc38.x86_64
hplip-common-3.23.5-1.fc38.x86_64 is a duplicate with hplip-common-3.23.5-8.fc38.x86_64
hplip-libs-3.23.5-1.fc38.x86_64 is a duplicate with hplip-libs-3.23.5-8.fc38.x86_64
inkscape-1.2.2-7.fc38.x86_64 is a duplicate with inkscape-1.3-4.fc38.x86_64
java-17-openjdk-headless-1:17.0.7.0.7-5.fc38.x86_64 is a duplicate with java-17-openjdk-headless-1:17.0.8.0.7-1.fc38.x86_64
javascriptcoregtk4.0-2.40.3-1.fc38.x86_64 is a duplicate with javascriptcoregtk4.0-2.40.5-1.fc38.x86_64
javascriptcoregtk4.0-2.40.3-1.fc38.x86_64 is a duplicate with javascriptcoregtk4.0-2.42.0-1.fc38.x86_64
javascriptcoregtk4.1-2.40.3-1.fc38.x86_64 is a duplicate with javascriptcoregtk4.1-2.40.5-1.fc38.x86_64
javascriptcoregtk4.1-2.40.3-1.fc38.x86_64 is a duplicate with javascriptcoregtk4.1-2.42.0-1.fc38.x86_64
javascriptcoregtk6.0-2.40.3-1.fc38.x86_64 is a duplicate with javascriptcoregtk6.0-2.40.5-1.fc38.x86_64
javascriptcoregtk6.0-2.40.3-1.fc38.x86_64 is a duplicate with javascriptcoregtk6.0-2.42.0-1.fc38.x86_64
libadwaita-1.3.3-1.fc38.x86_64 is a duplicate with libadwaita-1.3.4-1.fc38.x86_64
libatomic-13.1.1-4.fc38.x86_64 is a duplicate with libatomic-13.2.1-1.fc38.x86_64
libcurl-minimal-8.0.1-3.fc38.x86_64 is a duplicate with libcurl-minimal-8.0.1-4.fc38.x86_64
libdnf-0.70.1-1.fc38.x86_64 is a duplicate with libdnf-0.70.2-1.fc38.x86_64
libgcc-13.1.1-4.fc38.x86_64 is a duplicate with libgcc-13.2.1-1.fc38.x86_64
libgccjit-13.1.1-4.fc38.x86_64 is a duplicate with libgccjit-13.2.1-1.fc38.x86_64
libgfortran-13.1.1-4.fc38.x86_64 is a duplicate with libgfortran-13.2.1-1.fc38.x86_64
libgomp-13.1.1-4.fc38.x86_64 is a duplicate with libgomp-13.2.1-1.fc38.x86_64
libquadmath-13.1.1-4.fc38.x86_64 is a duplicate with libquadmath-13.2.1-1.fc38.x86_64
librepo-1.15.1-2.fc38.x86_64 is a duplicate with librepo-1.15.2-1.fc38.x86_64
librsvg2-2.56.2-1.fc38.x86_64 is a duplicate with librsvg2-2.56.3-1.fc38.x86_64
libsane-hpaio-3.23.5-1.fc38.x86_64 is a duplicate with libsane-hpaio-3.23.5-8.fc38.x86_64
libsoup3-3.4.2-4.fc38.x86_64 is a duplicate with libsoup3-3.4.3-1.fc38.x86_64
libstdc++-13.1.1-4.fc38.x86_64 is a duplicate with libstdc++-13.2.1-1.fc38.x86_64
libstdc++-devel-13.1.1-4.fc38.x86_64 is a duplicate with libstdc++-devel-13.2.1-1.fc38.x86_64
m17n-db-1.8.2-1.fc38.noarch is a duplicate with m17n-db-1.8.3-1.fc38.noarch
ndctl-libs-77-1.fc38.x86_64 is a duplicate with ndctl-libs-78-1.fc38.x86_64
openssh-9.0p1-16.fc38.x86_64 is a duplicate with openssh-9.0p1-17.fc38.x86_64
openssl-libs-1:3.0.9-1.fc38.x86_64 is a duplicate with openssl-libs-1:3.0.9-2.fc38.x86_64
ostree-libs-2023.5-2.fc38.x86_64 is a duplicate with ostree-libs-2023.6-1.fc38.x86_64
p11-kit-0.24.1-6.fc38.x86_64 is a duplicate with p11-kit-0.25.0-1.fc38.x86_64
p11-kit-trust-0.24.1-6.fc38.x86_64 is a duplicate with p11-kit-trust-0.25.0-1.fc38.x86_64
pipewire-0.3.79-1.fc38.x86_64 is a duplicate with pipewire-0.3.80-1.fc38.x86_64
pipewire-gstreamer-0.3.79-1.fc38.x86_64 is a duplicate with pipewire-gstreamer-0.3.80-1.fc38.x86_64
pipewire-jack-audio-connection-kit-libs-0.3.79-1.fc38.x86_64 is a duplicate with pipewire-jack-audio-connection-kit-libs-0.3.80-1.fc38.x86_64
pipewire-libs-0.3.79-1.fc38.x86_64 is a duplicate with pipewire-libs-0.3.80-1.fc38.x86_64
python3-dnf-4.16.1-1.fc38.noarch is a duplicate with python3-dnf-4.16.2-1.fc38.noarch
python3-dnf-plugins-core-4.4.1-1.fc38.noarch is a duplicate with python3-dnf-plugins-core-4.4.2-1.fc38.noarch
python3-google-api-core-1:2.11.0-2.fc38.noarch is a duplicate with python3-google-api-core-1:2.11.1-6.fc38.noarch
python3-hawkey-0.70.1-1.fc38.x86_64 is a duplicate with python3-hawkey-0.70.2-1.fc38.x86_64
python3-libdnf-0.70.1-1.fc38.x86_64 is a duplicate with python3-libdnf-0.70.2-1.fc38.x86_64
python3-regex-2022.10.31-2.fc38.x86_64 is a duplicate with python3-regex-2023.6.3-1.fc38.x86_64
qgnomeplatform-qt6-0.9.1-6.fc38.x86_64 is a duplicate with qgnomeplatform-qt6-0.9.1-8.fc38.x86_64
qt5-qtbase-5.15.10-5.fc38.x86_64 is a duplicate with qt5-qtbase-5.15.10-9.fc38.x86_64
qt5-qtbase-common-5.15.10-5.fc38.noarch is a duplicate with qt5-qtbase-common-5.15.10-9.fc38.noarch
qt5-qtbase-gui-5.15.10-5.fc38.x86_64 is a duplicate with qt5-qtbase-gui-5.15.10-9.fc38.x86_64
qt6-qtbase-6.5.1-2.fc38.x86_64 is a duplicate with qt6-qtbase-6.5.2-1.fc38.x86_64
qt6-qtbase-common-6.5.1-2.fc38.noarch is a duplicate with qt6-qtbase-common-6.5.2-1.fc38.noarch
qt6-qtbase-gui-6.5.1-2.fc38.x86_64 is a duplicate with qt6-qtbase-gui-6.5.2-1.fc38.x86_64
qt6-qtdeclarative-6.5.1-2.fc38.x86_64 is a duplicate with qt6-qtdeclarative-6.5.2-1.fc38.x86_64
qt6-qtwayland-6.5.1-2.fc38.x86_64 is a duplicate with qt6-qtwayland-6.5.2-1.fc38.x86_64
rygel-0.42.3-1.fc38.x86_64 is a duplicate with rygel-0.42.4-1.fc38.x86_64
selinux-policy-38.27-1.fc38.noarch is a duplicate with selinux-policy-38.28-1.fc38.noarch
selinux-policy-targeted-38.27-1.fc38.noarch is a duplicate with selinux-policy-targeted-38.28-1.fc38.noarch
speech-dispatcher-0.11.4-2.fc38.x86_64 is a duplicate with speech-dispatcher-0.11.5-1.fc38.x86_64
speech-dispatcher-espeak-ng-0.11.4-2.fc38.x86_64 is a duplicate with speech-dispatcher-espeak-ng-0.11.5-1.fc38.x86_64
systemd-253.9-1.fc38.x86_64 is a duplicate with systemd-253.10-1.fc38.x86_64
systemd-libs-253.9-1.fc38.x86_64 is a duplicate with systemd-libs-253.10-1.fc38.x86_64
systemd-networkd-253.9-1.fc38.x86_64 is a duplicate with systemd-networkd-253.10-1.fc38.x86_64
systemd-pam-253.9-1.fc38.x86_64 is a duplicate with systemd-pam-253.10-1.fc38.x86_64
systemd-resolved-253.9-1.fc38.x86_64 is a duplicate with systemd-resolved-253.10-1.fc38.x86_64
systemd-udev-253.9-1.fc38.x86_64 is a duplicate with systemd-udev-253.10-1.fc38.x86_64
webkitgtk6.0-2.40.3-1.fc38.x86_64 is a duplicate with webkitgtk6.0-2.40.5-1.fc38.x86_64
whois-nls-5.5.17-1.fc38.noarch is a duplicate with whois-nls-5.5.18-1.fc38.noarch
xdg-desktop-portal-gnome-44.1-1.fc38.x86_64 is a duplicate with xdg-desktop-portal-gnome-44.2-1.fc38.x86_64
xournalpp-1.1.3-4.fc38.x86_64 is a duplicate with xournalpp-1.2.0-1.fc38.x86_64
xournalpp-plugins-1.1.3-4.fc38.noarch is a duplicate with xournalpp-plugins-1.2.0-1.fc38.noarch
xournalpp-ui-1.1.3-4.fc38.noarch is a duplicate with xournalpp-ui-1.2.0-1.fc38.noarch
yum-4.16.1-1.fc38.noarch is a duplicate with yum-4.16.2-1.fc38.noarch
Error: Check discovered 102 problem(s)

Then I try dnf distro-sync but that does not work because some packages (such as grub2-tools-minimal) are protected:

[peer@fedora ~]$ sudo dnf distro-sync
Fedora 38 - x86_64 - Updates                                                                                                                                                                             102 kB/s |  14 kB     00:00    
Fedora 38 - x86_64 - Updates                                                                                                                                                                             1.8 MB/s | 2.5 MB     00:01    
Fedora Modular 38 - x86_64 - Updates                                                                                                                                                                     120 kB/s |  16 kB     00:00    
Error: 
 Problem: The operation would result in removing the following protected packages: grub2-tools-minimal, python3-dnf, systemd, systemd-udev
(try to add '--skip-broken' to skip uninstallable packages)
[peer@fedora ~]$ sudo dnf distro-sync --skip-broken
Last metadata expiration check: 0:02:21 ago on Fr 22 Sep 2023 14:22:09.
Error: 
 Problem: The operation would result in removing the following protected packages: grub2-tools-minimal, python3-dnf, systemd, systemd-udev

So I try dnf remove --duplicates which fails because some dependencies cannot be installed (I don’t know why)

[peer@fedora ~]$ sudo dnf remove --duplicates
Last metadata expiration check: 0:05:28 ago on Fr 22 Sep 2023 14:22:09.
Installed package xournalpp-ui-1.2.0-1.fc38.noarch not available.
Installed package xournalpp-1.2.0-1.fc38.x86_64 not available.
Installed package xournalpp-plugins-1.2.0-1.fc38.noarch not available.
Installed package webkitgtk6.0-2.40.5-1.fc38.x86_64 not available.
Installed package gnome-software-44.4-1.fc38.x86_64 not available.
Installed package qt6-qtbase-common-6.5.2-1.fc38.noarch not available.
Installed package qt6-qtbase-6.5.2-1.fc38.x86_64 not available.
Installed package qt6-qtbase-gui-6.5.2-1.fc38.x86_64 not available.
Error: 
 Problem: package epiphany-runtime-1:44.6-1.fc38.x86_64 from updates requires libwebkitgtk-6.0.so.4()(64bit), but none of the providers can be installed
  - package webkitgtk6.0-2.40.5-1.fc38.x86_64 from @System requires javascriptcoregtk6.0(x86-64) = 2.40.5-1.fc38, but none of the providers can be installed
  - conflicting requests
(try to add '--skip-broken' to skip uninstallable packages)
[peer@fedora ~]$ sudo dnf remove --duplicates --skip-broken
Last metadata expiration check: 0:06:12 ago on Fr 22 Sep 2023 14:22:09.
Installed package xournalpp-ui-1.2.0-1.fc38.noarch not available.
Installed package xournalpp-1.2.0-1.fc38.x86_64 not available.
Installed package xournalpp-plugins-1.2.0-1.fc38.noarch not available.
Installed package webkitgtk6.0-2.40.5-1.fc38.x86_64 not available.
Installed package gnome-software-44.4-1.fc38.x86_64 not available.
Installed package qt6-qtbase-common-6.5.2-1.fc38.noarch not available.
Installed package qt6-qtbase-6.5.2-1.fc38.x86_64 not available.
Installed package qt6-qtbase-gui-6.5.2-1.fc38.x86_64 not available.
Error: 
 Problem: package epiphany-runtime-1:44.6-1.fc38.x86_64 from updates requires libwebkitgtk-6.0.so.4()(64bit), but none of the providers can be installed
  - package webkitgtk6.0-2.40.5-1.fc38.x86_64 from @System requires javascriptcoregtk6.0(x86-64) = 2.40.5-1.fc38, but none of the providers can be installed
  - conflicting requests

For dnf upgrade the transaction ultimately fails and locks the file system (home partition).
the first sign of trouble seems to be

  Obsoleting       : webkitgtk6.0-2.40.5-1.fc38.x86_64                                                                                                                                                                             51/98 
  Cleanup          : webkitgtk6.0-2.40.3-1.fc38.x86_64                                                                                                                                                                             52/98 
error: DELETE FROM 'Requirename' WHERE hnum=?: 10: disk I/O error
error: sqlite failure: RELEASE 'Requirename': no such savepoint: Requirename
error: sqlite failure: RELEASE 'Providename': disk I/O error
error: sqlite failure: RELEASE 'rwlock': no such savepoint: rwlock

Full log: dnf update - Pastebin.com
Abridged:

[peer@fedora ~]$ sudo dnf upgrade
Last metadata expiration check: 0:09:32 ago on Fr 22 Sep 2023 14:22:09.
Dependencies resolved.
=========================================================================================================================================================================================================================================
 Package                                                                Architecture                               Version                                                    Repository                                            Size
=========================================================================================================================================================================================================================================
Upgrading:
 btrfs-progs                                                            x86_64                                     6.5.1-1.fc38                                               updates                                              1.2 M
 chromium                                                               x86_64                                     117.0.5938.88-1.fc38                                       updates                                               70 M
 chromium-common                                                        x86_64                                     117.0.5938.88-1.fc38                                       updates                                               13 M
 container-selinux                                                      noarch                                     2:2.222.0-1.fc38                                           updates                                               54 k
 containerd.io                                                          x86_64                                     1.6.24-3.1.fc38                                            docker-ce-stable                                      33 M
 curl                                                                   x86_64                                     8.0.1-4.fc38                                               updates                                              349 k
[...]
 webkit2gtk4.0                                                          x86_64                                     2.42.0-1.fc38                                              updates                                               24 M
 webkit2gtk4.1                                                          x86_64                                     2.42.0-1.fc38                                              updates                                               24 M
 webkitgtk6.0                                                           x86_64                                     2.42.0-1.fc38                                              updates                                               24 M
     replacing  webkitgtk6.0.x86_64 2.40.5-1.fc38
 xournalpp                                                              x86_64                                     1.2.1-1.fc38                                               updates                                              1.4 M
     replacing  xournalpp.x86_64 1.2.0-1.fc38
 xournalpp-plugins                                                      noarch                                     1.2.1-1.fc38                                               updates                                               18 k
     replacing  xournalpp-plugins.noarch 1.2.0-1.fc38
 xournalpp-ui                                                           noarch                                     1.2.1-1.fc38                                               updates                                              187 k
     replacing  xournalpp-ui.noarch 1.2.0-1.fc38
 zip                                                                    x86_64                                     3.0-37.fc38                                                updates                                              265 k
Installing weak dependencies:
 qadwaitadecorations-qt6                                                x86_64                                     0.1.1-1.fc38                                               updates                                               62 k

Transaction Summary
=========================================================================================================================================================================================================================================
Install   1 Package
Upgrade  46 Packages

Total size: 237 M
Total download size: 3.6 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] qadwaitadecorations-qt6-0.1.1-1.fc38.x86_64.rpm: Already downloaded                                                                                                                                                           
[...]
[SKIPPED] webkitgtk6.0-2.42.0-1.fc38.x86_64.rpm: Already downloaded                                                                                                                                                                     
(40/47): xournalpp-plugins-1.2.0-1.fc38_1.2.1-1.fc38.noarch.drpm                                                                                                                                          48 kB/s |  10 kB     00:00    
(41/47): gstreamer1-1.22.5-1.fc38_1.22.6-1.fc38.x86_64.drpm                                                                                                                                              678 kB/s | 152 kB     00:00    
(42/47): xournalpp-ui-1.2.0-1.fc38_1.2.1-1.fc38.noarch.drpm                                                                                                                                              2.4 MB/s |  69 kB     00:00    
(43/47): container-selinux-2.222.0-1.fc38.noarch.rpm                                                                                                                                                     1.7 MB/s |  54 kB     00:00    
(44/47): libwebp-1.3.2-1.fc38.x86_64.rpm                                                                                                                                                                 2.2 MB/s | 284 kB     00:00    
(45/47): traceroute-2.1.3-1.fc38.x86_64.rpm                                                                                                                                                              319 kB/s |  57 kB     00:00    
(46/47): xournalpp-1.2.0-1.fc38_1.2.1-1.fc38.x86_64.drpm                                                                                                                                                 2.1 MB/s | 1.0 MB     00:00    
[DRPM 1/4] xournalpp-plugins-1.2.0-1.fc38_1.2.1-1.fc38.noarch.drpm: done                                                                                                                                                                
(47/47): zip-3.0-37.fc38.x86_64.rpm                                                                                                                                                                      2.0 MB/s | 265 kB     00:00    
[DRPM 2/4] xournalpp-ui-1.2.0-1.fc38_1.2.1-1.fc38.noarch.drpm: done                                                                                                                                                                     
[DRPM 3/4] gstreamer1-1.22.5-1.fc38_1.22.6-1.fc38.x86_64.drpm: done                                                                                                                                                                     
[DRPM 4/4] xournalpp-1.2.0-1.fc38_1.2.1-1.fc38.x86_64.drpm: done                                                                                                                                                                        
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                    812 kB/s | 1.9 MB     00:02     
Delta RPMs reduced 237.5 MB of updates to 235.7 MB (0.7% saved)
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                 1/1 
  Upgrading        : libwebp-1.3.2-1.fc38.x86_64                                                                                                                                                                                    1/98 
  Upgrading        : gstreamer1-1.22.6-1.fc38.x86_64                                                                                                                                                                                2/98 
  Running scriptlet: gstreamer1-1.22.6-1.fc38.x86_64                                                                                                                                                                                2/98 
  Upgrading        : xournalpp-ui-1.2.1-1.fc38.noarch                                                                                                                                                                               [...]
50/98 
  Obsoleting       : webkitgtk6.0-2.40.5-1.fc38.x86_64                                                                                                                                                                             51/98 
  Cleanup          : webkitgtk6.0-2.40.3-1.fc38.x86_64                                                                                                                                                                             52/98 
error: DELETE FROM 'Requirename' WHERE hnum=?: 10: disk I/O error
error: sqlite failure: RELEASE 'Requirename': no such savepoint: Requirename
error: sqlite failure: RELEASE 'Providename': disk I/O error
error: sqlite failure: RELEASE 'rwlock': no such savepoint: rwlock
warning: file libwebkitgtk-6.0.so.4.0.4: remove failed: Read-only file system
warning: file c11f1fa1b8d2c1c676f0d8deb6cd3c3b8ed1c1: remove failed: Read-only file system
[...]
warning: file 228ebb1a67daf7a1be0584598b30506f7a5109: remove failed: Read-only file system

  Cleanup          : webkit2gtk4.1-2.40.5-1.fc38.x86_64                                                                                                                                                                            53/98 
warning: file libwebkit2gtk-4.1.so.0.8.5: remove failed: Read-only file system
warning: file ab532395965d79f06b0b2d31d8b85719f813ad: remove failed: Read-only file system
[...]
warning: file 8f859a7460f53e8e8f301e2dcd991d52678d56: remove failed: Read-only file system

[...]

  Cleanup          : btrfs-progs-6.3.3-1.fc38.x86_64                                                                                                                                                                               98/98 
warning: file 5a646f478ac939d737d81ff1e3d881c54a9830: remove failed: Read-only file system
[...]
warning: file 9f36c43cd6446394f6d6a5b50881e099784dc9: remove failed: Read-only file system

  Running scriptlet: container-selinux-2:2.222.0-1.fc38.noarch                                                                                                                                                                     98/98 
error: error creating temporary file /var/tmp/rpm-tmp.cXrt4M: Read-only file system
error: Couldn't create temporary file for %posttrans(container-selinux-2:2.222.0-1.fc38.noarch): Read-only file system

Error in POSTTRANS scriptlet in rpm package container-selinux
  Running scriptlet: btrfs-progs-6.3.3-1.fc38.x86_64                                                                                                                                                                               98/98 
/usr/sbin/ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Read-only file system
error: error creating temporary file /var/tmp/rpm-tmp.sgcOEu: Read-only file system
error: Couldn't create temporary file for %transfiletriggerin(systemd-253.9-1.fc38.x86_64): Read-only file system

Error in <unknown> scriptlet in rpm package btrfs-progs
error: error creating temporary file /var/tmp/rpm-tmp.FpbRXC: Read-only file system
error: Couldn't create temporary file for %transfiletriggerin(systemd-udev-253.9-1.fc38.x86_64): Read-only file system

[...]

Error in <unknown> scriptlet in rpm package btrfs-progs
[Errno 30] Read-only file system: '/var/lib/dnf/rpmdb_lock.pid'
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Failed to store expired repos cache: [Errno 30] Read-only file system: '/var/cache/dnf/expired_repos.json'
[Errno 30] Read-only file system: '/var/cache/dnf/tempfiles.json'

My immediate thought is that the disk is simply old and dnf just happens to write on an unreliable part of it, causing it to fail everytime. But then again the machine is only 5 years old.
But maybe it is something else? Could it be resolved by dnf commands alone?
Could it be a btrfs issue? I’m using one (home) partition (one uuid at least) comprising two devices.

The history you describe sounds likely to be a failed disk. At first signs of disk problems it is best to treat the disk as “read-only” and make sure you have good copies all important data.

Over 5 years ago I found it necessary to proactively replace spinning disks when warranty ended. Our workload consisted of loading and processing volumes of data that were moved on to file servers when complete, so close to worst case for mechanical disk wear. I think modern manufacturing of disks has reduced variability, although each batch of new disks did have a dud or two (so it was necessary to buy a couple spares to ensure that processing could continue while waiting for warranty replacements).

You can use smartmontools to check “drive health” and other properties such as power-on hours and number of spinup cycles. In my experience, “bad health” is always bad news, but heath “OK” is often not OK.

Current SSD’s are both faster and more reliable than mechanical disks.

You can run btrfs scrub start -Bd / and then report the results. It doesn’t verify the file system is correct but it will verify every metadata and data block with its stored checksum.

You would need to use btrfs check --readonly /dev on an unmounted file system to do a file system consistency check, i.e. it verifies the file system metadata is correct.

But this sort of problem can happen with any file system. It sounds to me like it’s an interrupted update or upgrade. This can usually be fixed with dnf remove --duplicates

@gnwiii it looks like installing smarttools also turns the file system readonly :roll_eyes:

[peer@fedora ~]$ sudo dnf install smartmontools
Fedora 38 - x86_64 - Updates                    120 kB/s |  17 kB     00:00    
Fedora 38 - x86_64 - Updates                    1.9 MB/s | 2.8 MB     00:01    
Fedora Modular 38 - x86_64 - Updates                                                                                     197 kB/s |  17 kB     00:00    
Dependencies resolved.
=========================================================================================================================================================
 Package                                       Architecture                   Version                              Repository                       Size
=========================================================================================================================================================
Installing:
 smartmontools                                 x86_64                         1:7.4-1.fc38                         updates                         645 k
Installing dependencies:
 smartmontools-selinux                         noarch                         1:7.4-1.fc38                         updates                          31 k

Transaction Summary
=========================================================================================================================================================
Install  2 Packages

Total download size: 676 k
Installed size: 2.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): smartmontools-selinux-7.4-1.fc38.noarch.rpm                                                                       237 kB/s |  31 kB     00:00    
(2/2): smartmontools-7.4-1.fc38.x86_64.rpm                                                                               2.2 MB/s | 645 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                    1.7 MB/s | 676 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                 1/1 
  Running scriptlet: smartmontools-selinux-1:7.4-1.fc38.noarch                                                                                       1/2 
  Installing       : smartmontools-selinux-1:7.4-1.fc38.noarch                                                                                       1/2 
  Running scriptlet: smartmontools-selinux-1:7.4-1.fc38.noarch                                                                                       1/2 
libsemanage.semanage_direct_install_info: Overriding smartmon module at lower priority 100 with module at priority 200.
rm: cannot remove '/var/lib/rpm-state/file_contexts.pre': Read-only file system
Failed to set unit properties on smartd.service: Unit smartd.service not found.

  Installing       : smartmontools-1:7.4-1.fc38.x86_64                                                                                               2/2 
Error unpacking rpm package smartmontools-1:7.4-1.fc38.x86_64
[Errno 30] Read-only file system: '/var/lib/dnf/rpmdb_lock.pid'
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Failed to store expired repos cache: [Errno 30] Read-only file system: '/var/cache/dnf/expired_repos.json'
[Errno 30] Read-only file system: '/var/cache/dnf/tempfiles.json'

@chrismurphy on a rescued (as described above) system btrfs scrub start -Bd / returns

ERROR: scrubbing / failed for device id 1: ret=-1, errno=5 (Input/output error)

Scrub device /dev/nvme0n1p5 (id 1) canceled
Scrub started:    Sun Sep 24 13:02:55 2023
Status:           aborted
Duration:         0:00:15
Total to scrub:   3.55GiB
Rate:             242.57MiB/s
Error summary:    no errors found

Scrub device /dev/nvme0n1p6 (id 2) done
Scrub started:    Sun Sep 24 13:02:55 2023
Status:           finished
Duration:         0:00:46
Total to scrub:   18.64GiB
Rate:             415.00MiB/s
Error summary:    no errors found

And from a live usb, sudo btrfs check --readonly /dev/nvme0n1p6 yields

[liveuser@localhost-live ~]$ sudo btrfs check --readonly /dev/nvme0n1p6
Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p6
UUID: 8e5668e8-73f5-4944-a1ff-542b1690fda5
[1/7] checking root items
parent transid verify failed on 71071121408 wanted 2171588 found 74436
parent transid verify failed on 71071121408 wanted 2171588 found 74436
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
[2/7] checking extents
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
[3/7] checking free space tree
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
parent transid verify failed on 71071121408 wanted 2171588 found 74436
Ignoring transid failure
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
ERROR: transid errors in file system
found 48696057856 bytes used, error(s) found
total csum bytes: 46250652
total tree bytes: 1229455360
total fs tree bytes: 1087537152
total extent tree bytes: 76824576
btree space waste bytes: 251920684
file data blocks allocated: 180573790208
 referenced 67654963200

(same for sudo btrfs check --readonly /dev/nvme0n1p5)

You should not be using the problematic drive until you understand the reason for the problems. Use smartmontools on a Live USB or install fedora to another drive. I find a small SSD in an external USB3 case performs well and i very useful for troubleshooting and test installs.

Need to see a complete dmesg to get an idea what might be going on.

parent transid verify failed on 71071121408 wanted 2171588 found 74436

Is this being run from Live USB media? Or is the file system mounted at the time? The wanted and found values are so far apart they are pretty outlandish and I do not recommend trying to repair.

It might be possible to mount using mount -o ro,rescue=usebackuproot,nologreplay,ibadroots which will skip over broken parts of the file system, and hopefully permit copying out important files.

rescue=all adds idatacsums which I don’t recommend in a first attempt because it will permit copying out corrupt files. You probably want to copy out known good files first.