"apt-file update"를 실행한 후에도 apt-file이 여전히 "캐시 비어 있음"을 보고하는 이유는 무엇입니까?

"apt-file update"를 실행한 후에도 apt-file이 여전히 "캐시 비어 있음"을 보고하는 이유는 무엇입니까?

apt-file updateapt-file을 실행한 후에도 캐시가 비어 있다고 보고하는 이유를 아는 사람이 있습니까 apt update?

[pop-os ~][I]% apt-file search /usr/lib/android-sdk/tools/bin/sdkmanager
E: The cache is empty. You need to run "apt update" first.
[pop-os ~][I]% apt-file update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
[pop-os ~][I]% sudo !!
sudo apt-file update
Hit:1 http://apt.pop-os.org/proprietary cosmic InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu cosmic InRelease          
Hit:3 http://us.archive.ubuntu.com/ubuntu cosmic-updates InRelease                           
Hit:4 http://ppa.launchpad.net/nextcloud-devs/client/ubuntu cosmic InRelease                 
Hit:5 http://us.archive.ubuntu.com/ubuntu cosmic-security InRelease      
Hit:6 http://repository.spotify.com stable InRelease                                         
Hit:7 http://us.archive.ubuntu.com/ubuntu cosmic-backports InRelease                         
Get:8 http://apt.pop-os.org/proprietary cosmic all Contents (deb) [102 kB]                   
Hit:9 http://ppa.launchpad.net/system76/pop/ubuntu cosmic InRelease                  
Get:10 http://us.archive.ubuntu.com/ubuntu cosmic amd64 Contents (deb) [40.9 MB]             
Get:11 http://apt.pop-os.org/proprietary cosmic i386 Contents (deb) [276 B]                  
Get:12 http://apt.pop-os.org/proprietary cosmic amd64 Contents (deb) [2,605 kB]              
Get:13 http://us.archive.ubuntu.com/ubuntu cosmic i386 Contents (deb) [40.2 MB]              
Get:14 http://us.archive.ubuntu.com/ubuntu cosmic-updates i386 Contents (deb) [5,178 kB]     
Get:15 http://us.archive.ubuntu.com/ubuntu cosmic-updates amd64 Contents (deb) [6,997 kB]    
Get:16 http://us.archive.ubuntu.com/ubuntu cosmic-security i386 Contents (deb) [3,784 kB]    
Get:17 http://us.archive.ubuntu.com/ubuntu cosmic-security amd64 Contents (deb) [5,296 kB]   
Get:18 http://us.archive.ubuntu.com/ubuntu cosmic-backports amd64 Contents (deb) [3,773 B]   
Get:19 http://us.archive.ubuntu.com/ubuntu cosmic-backports i386 Contents (deb) [3,772 B]    
Fetched 105 MB in 21s (4,952 kB/s)                                                           
Reading package lists... Done
Building dependency tree       
Reading state information... Done
148 packages can be upgraded. Run 'apt list --upgradable' to see them.
sudo -E apt-file update  20.30s user 1.16s system 95% cpu 22.585 total
[pop-os ~][I]% apt-file search /usr/lib/android-sdk/tools/bin/sdkmanager
E: The cache is empty. You need to run "apt update" first.
[pop-os ~][I]% apt update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
[pop-os ~][I]% sudo !!
sudo apt update
Hit:1 http://apt.pop-os.org/proprietary cosmic InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu cosmic InRelease                                   
Hit:3 http://us.archive.ubuntu.com/ubuntu cosmic-updates InRelease                           
Hit:4 http://us.archive.ubuntu.com/ubuntu cosmic-security InRelease                          
Hit:5 http://ppa.launchpad.net/nextcloud-devs/client/ubuntu cosmic InRelease                 
Hit:6 http://us.archive.ubuntu.com/ubuntu cosmic-backports InRelease     
Get:7 http://apt.pop-os.org/proprietary cosmic i386 Contents (deb) [276 B]                   
Hit:8 http://repository.spotify.com stable InRelease                                         
Get:9 http://apt.pop-os.org/proprietary cosmic all Contents (deb) [102 kB]                   
Hit:10 http://ppa.launchpad.net/system76/pop/ubuntu cosmic InRelease                 
Get:11 http://us.archive.ubuntu.com/ubuntu cosmic amd64 Contents (deb) [40.9 MB]       
Get:12 http://apt.pop-os.org/proprietary cosmic amd64 Contents (deb) [2,605 kB]              
Get:13 http://us.archive.ubuntu.com/ubuntu cosmic i386 Contents (deb) [40.2 MB]              
Get:14 http://us.archive.ubuntu.com/ubuntu cosmic-updates i386 Contents (deb) [5,178 kB]     
Get:15 http://us.archive.ubuntu.com/ubuntu cosmic-updates amd64 Contents (deb) [6,997 kB]    
Get:16 http://us.archive.ubuntu.com/ubuntu cosmic-security amd64 Contents (deb) [5,296 kB]   
Get:17 http://us.archive.ubuntu.com/ubuntu cosmic-security i386 Contents (deb) [3,784 kB]    
Get:18 http://us.archive.ubuntu.com/ubuntu cosmic-backports i386 Contents (deb) [3,772 B]    
Get:19 http://us.archive.ubuntu.com/ubuntu cosmic-backports amd64 Contents (deb) [3,773 B]   
Fetched 105 MB in 21s (4,963 kB/s)                                                           
Reading package lists... Done
Building dependency tree       
Reading state information... Done
148 packages can be upgraded. Run 'apt list --upgradable' to see them.
sudo -E apt update  20.24s user 1.15s system 95% cpu 22.470 total
[pop-os ~][I]% apt-file search /usr/lib/android-sdk/tools/bin/sdkmanager
E: The cache is empty. You need to run "apt update" first.
[pop-os ~][I]% sudo !!
sudo apt-file search /usr/lib/android-sdk/tools/bin/sdkmanager
E: The cache is empty. You need to run "apt update" first.

Distro는 Pop!_OS(Ubuntu의 파생물)이지만 Pop!_OS 태그를 찾을 수 없습니다.

답변1

/var/lib/apt/lists/Pop!_OS 22.04에서 apt를 삭제한 후 다시 업데이트하여 이 문제를 해결할 수 있었습니다 .

sudo rm -rf /var/lib/apt/lists/*_*
sudo apt-get update
apt-file search sdkmanager

여기서 팁을 찾았습니다.https://unix.stackexchange.com/a/575356/243015

편집: apt-get install <foo>apt-file을 실행한 후 다시 작동이 종료됩니다.

답변2

원래 문제에 대한 해결책은 아니지만 논평할 만큼 평판이 좋지 않습니다...

또한 이 오류가 발생했으며 대안으로 Ubuntu 패키지 검색을 사용하는 것이 좋습니다.https://packages.ubuntu.com/search?keywords=search

제 생각에는 검색을 해보세요https://packages.ubuntu.com괜찮습니다. 하지만 터미널에서 이 작업을 수행하고 싶습니다. 그래서 apt-search검색어를 실행하고 HTML을 구문 분석하여 멋진 출력을 제공하는 이라는 작은 Python CLI 애플리케이션을 작성했습니다 .

여기에서 찾을 수 있습니다:https://pypi.org/project/apt-search/

pip/install을 사용하여 pipx다음과 같이 사용할 수 있습니다 .

apt-search /usr/lib/android-sdk/tools/bin/sdkmanager
# No package found for file '/usr/lib/android-sdk/tools/bin/sdkmanager'!

apt-search sdkmanager
# sdkmanager: /usr/bin/sdkmanager
# sdkmanager: /usr/share/bash-completion/completions/sdkmanager

답변3

YMMV, 다음은 이러한 문제를 해결했습니다.

당신은 일을:

sudo apt update
sudo apt-file update

하지만 너는 없어

sudo apt-get update

(가장 최근 OP)에서apt-file 매뉴얼 페이지:

업데이트:
이 작업은 단순히 apt update 또는 apt-get 업데이트를 호출합니다(tty 사용 가능 여부에 따라 다름).

일반 apt 업데이트 또는 apt-get 업데이트와 직접 비교하여 이 방법을 사용하는 유일한 이점은 (Dir::Etc::apt-file-main 구성 옵션을 통해) apt 파일 관련 구성을 구성한 경우입니다. 이 경우 구성이 자동으로 포함됩니다.

apt-file update호출하지 않지만 apt-get update실제로 데이터베이스에 의존하는 버그가 있는 것 같습니다 .

관련 정보