Debian 명령을 찾을 수 없음 오류 - 할당 전에 참조된 로컬 변수 'cnf'

Debian 명령을 찾을 수 없음 오류 - 할당 전에 참조된 로컬 변수 'cnf'

Debian Buster 운영 체제 및 소프트웨어 패키지를 새로 설치한 후: command-not-found

실행 명령:

$ curl
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: Debian
Description:    Debian 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/lib/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

루트로 게시해도 update-command-not-found문제가 해결되지 않습니다. 버그 리포트가 있지만 아직 수정되지 않은 것 같습니다.

답변1

직관적이지 않지만 오류는 즉시 사라집니다 apt update.

# apt update
Hit:1 http://deb.debian.org/debian buster InRelease
Get:2 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Hit:3 http://security.debian.org/debian-security buster/updates InRelease
Get:4 http://deb.debian.org/debian buster/main amd64 Contents (deb) [36.1 MB]
Get:5 http://deb.debian.org/debian buster-updates/main amd64 Contents (deb) [42.3 kB]
Fetched 36.2 MB in 7s (5,009 kB/s)                                                                                                                                    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

# curl

Command 'curl' not found, but can be installed with:

apt install curl

추신. 궁금한 분들을 위해 말씀드리자면 새로 설치 시 데이터베이스가 누락되었기 때문입니다.

ls -l /var/lib/command-not-found
total 0

그 후 apt update우리는:

ls -l /var/lib/command-not-found
total 2504
-rw-r--r-- 1 root root 2560000 Jul 29 12:34 commands.db
-rw-r--r-- 1 root root     983 Jul 29 12:34 commands.db.metadata

답변2

변경 권한은 다음 위치에 있습니다.

sudo chmod o+r /var/lib/command-not-found/commands.db*

하지만 그 전에

권한 변수 상태 정보 확인

ls -l /var/lib/command-not-found

total 2588

-rw-r----- 1 root root 2834432 Dec 18 05:25 commands.db
-rw-r----- 1 root root    4712 Dec 18 05:25 commands.db.metadata

그것은해야한다:

ls -l /var/lib/command-not-found

total 2588

-rw-r--r-- 1 root root 2641920 Jan 16 00:27 commands.db
-rw-r--r-- 1 root root    1175 Jan 16 00:27 commands.db.metadata

관련 정보