Solskogen
Posts: 24
Joined: Tue Sep 27, 2016 6:07 am

command-not-found not working

Thu Jul 11, 2019 1:22 pm

Code: Select all

pi@raspberrypi:~$ command-not-found vim
Could not find the database of available applications, run update-command-not-found as root to fix this
Sorry, command-not-found has crashed! Please file a bug report at:
http://www.debian.org/Bugs/Reporting
Please include the following information with the report:

command-not-found version: 0.3
Python version: 3.7.3 final 0
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
Exception information:

local variable 'cnf' referenced before assignment
Traceback (most recent call last):
  File "/usr/share/command-not-found/CommandNotFound/util.py", line 23, in crash_guard
    callback()
  File "/usr/bin/command-not-found", line 93, in main
    if not cnf.advise(args[0], options.ignore_installed) and not options.no_failure_msg:
UnboundLocalError: local variable 'cnf' referenced before assignment
pi@raspberrypi:~$ sudo update-command-not-found
Traceback (most recent call last):
  File "/usr/sbin/update-command-not-found", line 26, in <module>
    col.create(db)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 94, in create
    self._fill_commands(con)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 132, in _fill_commands
    self._parse_single_contents_file(con, f, fp.stdout)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 271, in _parse_single_contents_file
    priority = component_priorities[component]
KeyError: 'rpi'

SkyRise
Posts: 179
Joined: Tue Jan 24, 2012 1:20 pm

Re: command-not-found not working

Thu Jul 11, 2019 1:39 pm

It appears to be a known Debian issue:

https://bugs.debian.org/cgi-bin/bugrepo ... bug=916783

User avatar
scruss
Posts: 3155
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: command-not-found not working

Thu Jul 11, 2019 1:48 pm

The sudo apt-file update step that command-not-found requires seems to fail under buster too:

Code: Select all

$ sudo apt-file update
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Get:3 http://raspbian.raspberrypi.org/raspbian buster/main armhf Contents (deb) [39.7 MB]
Get:4 http://archive.raspberrypi.org/debian buster/main armhf Contents (deb) [703 kB]
Get:5 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Contents (deb) [211 kB]
Get:6 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Contents (deb) [780 kB]
Get:7 http://raspbian.raspberrypi.org/raspbian buster/rpi armhf Contents (deb) [328 B]
Fetched 41.4 MB in 1min 15s (555 kB/s)                                         
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 26, in <module>
    col.create(db)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 94, in create
    self._fill_commands(con)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 132, in _fill_commands
    self._parse_single_contents_file(con, f, fp.stdout)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 271, in _parse_single_contents_file
    priority = component_priorities[component]
KeyError: 'rpi'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
On a 3B+ under Stretch, update-command-not-found takes a very long time, so it may not be worthwhile having this function on a small computer like a Raspberry Pi.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

Return to “Raspberry Pi OS”