0

I've only recently switched to Ubuntu 18.04 from Windows 10, maybe I am missing something I can't understand. I've already searched most of the previously asked question on the topic, but with no luck.

Upon executing sudo apt-get update, this happens:

Hit:1 http://ro.archive.ubuntu.com/ubuntu bionic InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                                        
Hit:3 http://ro.archive.ubuntu.com/ubuntu bionic-updates InRelease                                  
Hit:4 http://ro.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                    
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                       
Hit:6 http://dl.google.com/linux/chrome/deb stable Release               
sh: 1: /usr/lib/cnf-update-db: not found           
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

Edit: the contents of apt policy command-not-found:

command-not-found:
  Installed: 18.04.5
  Candidate: 18.04.5
  Version table:
 *** 18.04.5 500
        500 http://ro.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://ro.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages
        100 /var/lib/dpkg/status
     18.04.4 500
        500 http://ro.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        500 http://ro.archive.ubuntu.com/ubuntu bionic/main i386 Packages

sudo apt-get -f install also didnt help, with the result being:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfwup1 libwayland-egl1-mesa linux-headers-5.3.0-28 linux-headers-5.3.0-28-generic linux-image-5.3.0-28-generic
  linux-modules-5.3.0-28-generic linux-modules-extra-5.3.0-28-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I'm not proficient with Ubuntu, and I'm afraid I might delete or modify a critical file which could potentially cause more errors

Andy
  • 1
  • 1
  • This is not a trivial problem. You seem to be missing an essential package called command-not-found. Please execute apt policy command-not-found, edit your question, and add the output of this command to the question. – Jos Apr 07 '20 at 09:24
  • https://askubuntu.com/questions/1074763/error-when-trying-sudo-apt-get-update-python-related? – muru Apr 07 '20 at 10:13
  • @Jos I've updated the question – Andy Apr 07 '20 at 10:20
  • Okay, so the package command-not-found is in fact installed on your system, but the script file /usr/lib/cnf-update-db was not found. Is it in fact there, i.e. does ls -l /usr/lib/cnf-update-db give any results? If so, it may have been a one time glitch. If not, you should somehow reinstall the package. – Jos Apr 07 '20 at 10:28
  • Thank you for your replies. Yes, the /usr/lib/cnf-update-db file exists. I can't execute the sudo apt-get update command no matter how many times i try, or from whichever terminal. – Andy Apr 07 '20 at 10:30
  • A permissions problem perhaps? The file should be -rwxr-xr-x and owned by root:root. – Jos Apr 07 '20 at 10:36

0 Answers0