Fedora’s command-not-found doesn’t work

I’ve recently installed Fedora 19. Packagekit-command-not-found is installed. But its own examples don’t work. When I enter gedti the output is:

bash: gedti: command not found... Similar command is: 'gedit'

And it works correctly but when I enter powertop, the output is:

bash: powertop: command not found...

With no suggestion about the package. Why? Should I edit some configuration files or update some cache or … ?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

There is definitely some weirdness with PackageKit. I already had powertop installed but wanted to test out what you’re having issues with.

$ rpm -ql PackageKit-command-not-found
/etc/PackageKit/CommandNotFound.conf
/etc/profile.d/PackageKit.sh
/usr/libexec/pk-command-not-found

So from the above you can run the command that PackageKit will run to do the search like so:

$ /usr/libexec/pk-command-not-found <command>

Example

$ /usr/libexec/pk-command-not-found powertop
bash: powertop: command not found...

$ which powertop
/usr/bin/powertop

Running it a 2nd time I got it to recommend powertop:

$ /usr/libexec/pk-command-not-found powertop
bash: powertop: command not found...
Install package 'powertop' to provide command 'powertop'? [N/y]

So why isn’t it finding powertop?

I think that ultimately the root cause is the timeout that’s defined in the config file: /etc/PackageKit/CommandNotFound.conf:

MaxSearchTime=2000

This timeout is to cap how long PackageKit will take to do it’s query. The query is not against your local Yum cache, it’s searching live against Yum repositories that you have configured on the internet. Therefore if you want it to be more thorough vs. more performant you have the following trade-off:

# aggressive find
MaxSearchTime=15000

# more responsive
MaxSearchTime=250


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x