I am using ubuntu 18.04. When I try to run sudo apt-get update I am getting the following error. Can anybody try to help me solve this problem?

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

Following this when I try to run sudo apt-get update It completed successfully .


First try

sudo apt-get -f install

If this does not help you, then try the following.

Check which package causing the problem by this command.

sudo dpkg --audit

Then reinstall or reconfigure it.

  • sudo apt-get -f install works fine but sudo dpkg --audit doesn't return anything to the terminal. – Samuel Mideksa May 7 at 8:19
  • Did you try sudo apt update after sudo apt -f install? Still you cannot do sudo apt update normally? – MR. ROBOT May 7 at 8:39
  • yes I tried sudo apt-get update after sudo apt-get -f install and it still can't update properly with the above error message. But sudo apt-get -f install works fine. – Samuel Mideksa May 7 at 9:18
  • Tell me the result of this script on on a terminal if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then echo 'true'; else echo 'false'; fi And tell if you have /dev/null – MR. ROBOT May 7 at 14:25
  • The above command prints false to the terminal. And there is no /dev/null in my home directory. – Samuel Mideksa May 8 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.