Interrupted installation leaves broken packages - how to recover?

Hello everyone.
I have recently decided to start using C language. For this reason, I am trying to download and install a compiler for C, gcc is my first option.
When I use command sudo dnf install gcc it throws an error:
Error in %preun scriptlet: Preformatted textkernel-core-0:6.17.10-100.fc41.x86_64
Scriptlet output:
/bin/kernel-install: error while loading shared libraries: /usr/lib64/systemd/libsystemd-shared-258.3-2.fc43.so: file too short
/bin/kernel-install: error while loading shared libraries: /usr/lib64/systemd/libsystemd-shared-258.3-2.fc43.so: file too short

[RPM] %preun(kernel-core-6.17.10-100.fc41.x86_64) scriptlet failed, exit status 127

Updating dnf throws the same error.
Please, I don’t know what to do.

Magzhan

This seems to show that the systemd-shared RPM is corrupted.
Can you run sudo rpm -V systemd-shared to verify that ?

If it is effectively corrupted try to reinstall it with: sudo dnf reinstall systemd-shared

Please, when replying use the </> button to paste your text.

2 Likes

Francis, thank you for your guidance.

sudo rpm -V systemd-shared

results in

Unsatisfied dependencies for systemd-shared-258.2-1.fc43.x86_64:
        systemd-shared < 258.3-2.fc43 conflicts with (installed) systemd-libs-258.3-2.fc43.x86_64
Unsatisfied dependencies for systemd-shared-258.3-2.fc43.x86_64:
        systemd-libs < 258.3-2.fc43 conflicts with (installed) systemd-shared-258.3-2.fc43.x86_64
S.5......    /usr/lib64/systemd/libsystemd-shared-258.3-2.fc43.so

Then I typed

sudo dnf reinstall systemd-share

And it gives this reply:

Repositories loaded.
Failed to resolve the transaction:
No match for argument: systemd-share
You can try to add to command line:
  --skip-unavailable to skip unavailable packages

How do you think what can I do?

The package is systemd-shared rather than systemd-share.

1 Like

Right.

This looks like a partial (probably interrupted) update that included
systemd-shared-258.3-2.

Try first reinstalling systemd-shared, but if it fails try:

sudo dnf distro-sync \
    --refresh \
    --releasever=43 \
    --allowerasing \
    --skip-broken \
    --setopt=protected_packages=
3 Likes

I think this has solved the problem…
You have eyes of an eagle! Thank you, P G!

Francis, thank you for your effort!
Your first suggestion helped well. Seems like I just had a typo in my command.

Yes, thanks, but I fear that fixing systemd-shared is not sufficient.
What gives dnf check ?

2 Likes

It says a lot of scary words…

duplicate with "zlib-ng-0:2.3.2-2.fc43.x86_64"
zlib-ng-0:2.3.2-2.fc43.x86_64
 duplicate with "zlib-ng-0:2.3.2-1.fc43.x86_64"
zlib-ng-compat-0:2.3.2-1.fc43.x86_64
 installed conflict "zlib(x86-64)" from "zlib-ng-compat-0:2.3.2-2.fc43.x86_64"
 duplicate with "zlib-ng-compat-0:2.3.2-2.fc43.x86_64"
zlib-ng-compat-0:2.3.2-2.fc43.x86_64
 installed conflict "zlib(x86-64)" from "zlib-ng-compat-0:2.3.2-1.fc43.x86_64"
 duplicate with "zlib-ng-compat-0:2.3.2-1.fc43.x86_64"
Check discovered 733 problem(s) in 691 package(s)

and more of such sort.

Duplicate packages is normal when a global update has been interrupted.

The dnf distro-sync command mentioned earlier should correct that.

Apply it preferably from a textual console, in case your graphical session freezes during
such a huge dnf transaction.

1 Like

This could result from running out of space on storage device, an update that runs a longish background task that gets interrupted by a reboot or shutdown. I’ve had remote updates using cockpit that stalled until I visited the system and hit the return/enter key. The damage is rarely limited to a single file, so the dnf distro-sync … should be used.

1 Like

Indeed, an update has been interrupted.
I ran the dnf distro-sync command with all the flags you mentioned. As the result now
dnf check says that instead of 700-ish problems there are only 234 left.
Should I be worried?

Yes. Can you paste the dnf check output ?
Or at least some part of it.

1 Like

No worries, just that you have some work left to do. On misbehaving systems it is a good idea to specify the dnf version – on Fedora 43, use dnf5 rather than dnf. You should also read the man pages for commands so you understand what they are doing.

Here, dnf 5distro sync says "Nothing to do. " on 3 systems and upgrades one package on the 4th system. dnf5 check just returns to the prompt – in Linux “no news is good news”.

From man dnf5-check :

OPTIONS
       --dependencies
              Show missing dependencies and conflicts.

       --duplicates
              Show duplicated packages.

       --obsoleted
              Show obsoleted packages.

Run dnf5 check <option> separately for each option to see how many of each type of problem you have.

1 Like

Sure. Here it is:

 installed conflict "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-scdaemon-0:2.4.9-4.fc43.x86_64"
 installed conflict "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-utils-0:2.4.9-4.fc43.x86_64"
 installed conflict "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-verify-0:2.4.9-4.fc43.x86_64"
 installed conflict "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-wks-0:2.4.9-4.fc43.x86_64"
 obsoleted by "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-0:2.4.9-4.fc43.x86_64"
 obsoleted by "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-g13-0:2.4.9-4.fc43.x86_64"
 obsoleted by "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-scdaemon-0:2.4.9-4.fc43.x86_64"
 obsoleted by "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-utils-0:2.4.9-4.fc43.x86_64"
 obsoleted by "gnupg2 < 2.4.9-1.fc42.1" from "gnupg2-wks-0:2.4.9-4.fc43.x86_64"
 duplicate with "gnupg2-0:2.4.9-4.fc43.x86_64"
gnupg2-0:2.4.9-4.fc43.x86_64
 duplicate with "gnupg2-0:2.4.8-4.fc43.x86_64"
gnupg2-dirmngr-0:2.4.8-4.fc43.x86_64
 duplicate with "gnupg2-dirmngr-0:2.4.9-4.fc43.x86_64"
gnupg2-dirmngr-0:2.4.9-4.fc43.x86_64
 duplicate with "gnupg2-dirmngr-0:2.4.8-4.fc43.x86_64"

most of the rest inform duplication.

A similar (worse) problem was in this topic:

Il suggest to try first to remove duplicates with:

sudo dnf reinstall --refresh \
         --allowerasing --skip-unavailable \
         --setopt=protected_packages= \
         $(dnf rq --duplicates --latest-limit=1 --qf="%{name}.%{arch}\n")
1 Like

Done.
Most of the programs seem to be reinstalled successfully, but some return an error.
Here are the warning messages:

Error in sysusers scriptlet: NetworkManager-openvpn-1:1.12.5-2.fc43.x86_64  
Scriptlet output:                                                           
/usr/bin/systemd-sysusers: error while loading shared libraries: libsystemd-                          
[RPM] %sysusers(NetworkManager-openvpn-1:1.12.5-2.fc43.x86_64) scriptlet failed
.
.
.
 Error in sysusers scriptlet: tcpdump-14:4.99.6-1.fc43.x86_64                
Scriptlet output:
/usr/bin/systemd-sysusers: error while loading shared libraries: libsystemd-
[RPM] %sysusers(tcpdump-14:4.99.6-1.fc43.x86_64) scriptlet failed, exit stat

Finally, in the end, the message says

Transaction failed: Rpm transaction failed.

dnf check returns nothing. Is it a good sign?

A very good one yes, but see below.

The /usr/bin/systemd-sysusers: error while loading shared libraries: libsystemd-<truncated name>
should have been corrected when reinstalling systemd-shared because
/usr/bin/systemd-sysusers uses only that systemd library:

ldd /usr/bin/systemd-sysusers | grep systemd
        libsystemd-shared-258.3-2.fc43.so => /usr/lib64/systemd/libsystemd-shared-258.3-2.fc43.so (0x00007f9e1f800000)

rpm -qf  /usr/lib64/systemd/libsystemd-shared-258.3-2.fc43.so
systemd-shared-258.3-2.fc43.x86_64

This is weird, since you said that you reinstalled it.

Never mind, a last thing to verify, not shown by dnf check, is that all the RPMs are not
corrupted. Proceed as follows:

  • sudo rpm -Va
  • then paste its output here
1 Like

Here it is:

missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/drivers/regulator/tps68470-regulator.ko.xz
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/drivers/reset
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/drivers/reset/reset-gpio.ko.xz
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/drivers/reset/reset-tps380x.ko.xz
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/drivers/rtc
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/drivers/rtc/rtc-ab-eoz9.ko.xz
missing    
.
.
.
xz
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/net/rds/rds_rdma.ko.xz
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/net/rds/rds_tcp.ko.xz
missing     /lib/modules/6.17.12-300.fc43.x86_64/kernel/net/rose/rose.ko.xz
S.5....T.  c /etc/selinux/targeted/contexts/files/file_contexts.local

And hundreds of similar messages

I would like to have the full output.

Execute:

  • sudo rpm -Va |& fpaste

then paste in this topic the URL obtained.

Example on my machine:

sudo rpm -Va |& fpaste
Uploading (1.3KiB)...
https://paste.centos.org/view/2e46b4e6
1 Like