Python 3 broke DNF

Python 3 was recently updated and now dnf no longer works. I get the following when I try to run dnf:

/usr/bin/dnf: line 21: from: command not found
/usr/bin/dnf: line 22: import: command not found
/usr/bin/dnf: line 25: syntax error near unexpected token (' /usr/bin/dnf: line 25: def suppress_keyboard_interrupt_message():’

looks like vi and vim are also broken. The were both updated as well and when I tried to vi /usr/bin/dnf, I get zip zero noda. ls -l on /usr/bin/vi and /usr/bin/vim show empty files.

I wonder what else broke in this update? Anyone else having issues?

I’m using Rocky v9.1.

Thank you

Daryl

I’m not seeing any issues on any Rocky Linux 9 machine with the recent updates.

[root@xmpp01 ~]# rpm -qi vim-enhanced | grep 'Build Date'
Build Date  : Tue 28 Feb 2023 10:09:17 AM MST
[root@xmpp01 ~]# rpm -qi python3 | grep 'Build Date'
Build Date  : Tue 28 Feb 2023 09:06:52 AM MST
[root@xmpp01 ~]# dnf module list
Last metadata expiration check: 2:20:07 ago on Sun 05 Mar 2023 02:56:36 PM MST.
Rocky Linux 9 - AppStream
Name                 Stream               Profiles                                           Summary
maven                3.8                  common [d]                                         Java project management and project comprehension tool
nodejs               18 [x]               common [d], development, minimal, s2i              Javascript runtime
php                  8.1                  common [d], devel, minimal                         PHP scripting language
ruby                 3.1                  common [d]                                         An interpreter of object-oriented scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@xmpp01 ~]# file /usr/bin/vim
/usr/bin/vim: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=0a9f31c21c3e2839483246b797e12023e62007a0, for GNU/Linux 3.2.0, stripped

Your issues may stem from file system corruption or even a botched update (this means stopping updates in the middle of it via ctrl+c or a power outage). What I would suggest is trying to download the RPM’s from Index of /pub/rocky/9/ and using rpm directly to try to reinstall the broken packages.

1 Like

I’ll give that a try.

Thank you

Daryl

I re-installed all of Python3 and all is now better.

Thank you

1 Like