0

When I try sudo apt update command on Ubuntu 20.04.3 LTS x86_64 this traceback comes. How can I fix it please

Traceback (most recent call last):                                        
  File "/usr/lib/cnf-update-db", line 8, in <module>                      
    from CommandNotFound.db.creator import DbCreator                      
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", lin
e 11, in <module>                                                         
    import apt_pkg                                                        
ModuleNotFoundError: No module named 'apt_pkg'                            
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 /u
sr/lib/cnf-update-db > /dev/null; fi'                                     
E: Sub-process returned an error code```
Dan
  • 1
  • Are you running some kind of script you wrote? – David Oct 08 '21 at 13:33
  • Nope, just installing packages and python libraries – Dan Oct 08 '21 at 13:54
  • 1
    Your question clearly shows a script is running not just a straight forward install of a package. What is the EXACT command you typed to get this error? – David Oct 08 '21 at 13:55
  • I just ran sudo apt update here is my result. sudo apt update [sudo] password for david: Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease Hit:2 http://se.archive.ubuntu.com/ubuntu focal InRelease Get:3 http://se.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Hit:4 http://archive.canonical.com/ubuntu focal InRelease Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Get:6 http://se.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,258 kB] – David Oct 08 '21 at 14:04
  • I was deployed a userbot on my server 6 days ago and was online through screen. Only ran it. Today when I wanted to re-run it saw that it gives library import errors and saw that all my requirement libraries has been uninstalled automatically. I tried to upgrade and update resources then try installing libraries and redeploy but encountered with this error on apt update – Dan Oct 08 '21 at 14:21
  • You need to stop this script. Why would you first tell me no script and then admit there is one? How can you be helped if you are not truthful? – David Oct 08 '21 at 14:32
  • Lol, I didn't say lie. I stopped that script and my bot wasn't functioning, then I do the apt update. That's why I'm asking for solution. Also when it's stopped that error comes. If I knew the solution why would I ask for help then – Dan Oct 09 '21 at 15:04

0 Answers0