Bug 1603032 - dnf command not found
Summary: dnf command not found
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Marek Blaha
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-19 02:56 UTC by Stephen Reaves
Modified: 2026-05-11 09:01 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-07-29 00:19:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Stephen Reaves 2018-07-19 02:56:28 UTC
Description of problem:
After updating to dnf-3.0.3-2, dnf always fails with a '/usr/bin/dnf: line 21: from: command not found" message and just hangs indefinitely.  When I hit Ctrl+C to kill it, it then says "/usr/bin/dnf: line 25: syntax error near unexpected token `('
/usr/bin/dnf: line 25: `def suppress_keyboard_interrupt_message():'".  This happens no matter what I try to do with dnf.



Version-Release number of selected component (if applicable):
dnf-3.0.3-2.fc29.noarch
libdnf-0.15.2-1.fc29.x86_64
python3-dnf-3.0.3-2.fc29.noarch


How reproducible:
Always

Steps to Reproduce:
1. run 'dnf update' or 'dnf install vim' or even 'dnf --version'
2.
3.

Actual results:
$ dnf update
/usr/bin/dnf: line 21: from: command not found
import: unable to open image `sys': Permission denied @ error/blob.c/OpenBlob/2761.
/usr/bin/dnf: line 25: syntax error near unexpected token `('
/usr/bin/dnf: line 25: `def suppress_keyboard_interrupt_message():'

Expected results:


Additional info:

Comment 1 Marek Blaha 2018-07-23 05:30:00 UTC
Hi, it looks like that the dnf command is executed by bash instead of python.
Please, can you paste here an output of the command:

$ head /usr/bin/dnf

The first line of the output should point to python interpreter and look like this:
#!/usr/bin/python3

Comment 2 Stephen Reaves 2018-07-23 22:01:35 UTC
$ head /usr/bin/dnf -n 1
#!/usr/bin/python3

$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 9 Jul 23 17:51 /usr/bin/python3 -> /usr/bin/python3.7

Changing python3 to point to python3.6 gives me a more python looking traceback. Then dnf update gives me
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    From dnf.cli import main
ModuleNotFoundError: No module named 'dnf'

Comment 3 Marek Blaha 2018-07-24 11:51:07 UTC
This is strange and at the moment I have no idea what's going on. Other python scripts are running OK?

You can try to invoke dnf like:
$ /usr/bin/python3 dnf

Comment 4 Stephen Reaves 2018-07-24 22:00:20 UTC
`/usr/bin/python3.7 /usr/bin/dnf --version` gives me no output. `/usr/bin/python3.7 helloworld.py` gives me no output. 

Python3.6 works for a simple print statement but gives me ModuleNotFoundError: No module named 'dnf'

Comment 5 Marek Blaha 2018-07-25 05:28:14 UTC
Hm, probably your python interpreter is somehow broken. You can try to upgrade/reinstall it by using directly the rpm command.

Comment 6 Stephen Reaves 2018-07-26 13:35:48 UTC
I tried to update/reinstall python through yum-deprecated, rpm, and compiling by source.  None of which worked.  yum-deprecated and rpm wouldn't let me update python3.6 or 3.7 because they both had packages that depended on them.  Compiling Python3.7 from source didn't change anything and neither did 3.6.

I know this won't help us figure out the bug, but what would happen if I booted into a live Fedora 28 CD and ran `dnf distro-sync --enablerepo=rawhide --releasever=rawhide --installroot=/dev/whateverMyRootIsOn dnf python3`?  Are there any other packages I should specify?

Comment 7 Stephen Reaves 2018-07-29 00:19:14 UTC
So I got it to work by booting into a live cd, mounting my root partition to /mnt, then running `dnf install --disablerepo=* --enablerepo=rawhide --releasever=29 --installroot=/mnt dnf python3`.  After rebooting, I am on dnf version 3.0.4, python verion 3.6.6 and everything is working as normal.

This also seems to be related to Bug 1599069.


Note You need to log in before you can comment on or make changes to this bug.