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 .
sudo apt-get -f installworks fine butsudo dpkg --auditdoesn't return anything to the terminal. – Samuel Mideksa May 07 '19 at 08:19sudo apt updateaftersudo apt -f install? Still you cannot dosudo apt updatenormally? – MR. ROBOT May 07 '19 at 08:39sudo apt-get updateaftersudo apt-get -f installand it still can't update properly with the above error message. Butsudo apt-get -f installworks fine. – Samuel Mideksa May 07 '19 at 09:18if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then echo 'true'; else echo 'false'; fiAnd tell if you have/dev/null– MR. ROBOT May 07 '19 at 14:25falseto the terminal. And there is no/dev/nullin my home directory. – Samuel Mideksa May 08 '19 at 06:53ls -l /var/lib/command-not-found/and tell me if you have/usr/lib/cnf-update-db– MR. ROBOT May 08 '19 at 07:08ls -l /var/lib/command-not-found/returnstotal 0andcd /usr/lib/cnf-update-dband the commandbash: cd: /usr/lib/cnf-update-db: Not a directoryreturnsbash: cd: /usr/lib/cnf-update-db: Not a directory. – Samuel Mideksa May 08 '19 at 07:14cnf-update-dbis a file. So you can get to know if it exists or not bycat /usr/lib/cnf-update-db– MR. ROBOT May 08 '19 at 07:18ls -l /var/lib/ | grep 'command-not-found'notls -l /var/lib/command-not-found/. Sorry. – MR. ROBOT May 08 '19 at 07:23drwxr-xr-x 2 root root 4096 ኤፕረ 24 2018 command-not-foundto the command line. – Samuel Mideksa May 08 '19 at 07:35cat /usr/lib/cnf-update-db? It said that there is no file? – MR. ROBOT May 08 '19 at 07:37sudo chmod a+w /var/lib/command-not-found/andsudo apt update. – MR. ROBOT May 08 '19 at 09:01sudo chmod a+w /var/lib/command-not-found/do? The same errorE: 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 codeis getting printed to the terminal. Do I have to delete the file/var/lib/command-not-found/after changing mode? – Samuel Mideksa May 08 '19 at 09:54if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then echo 'true'; else echo 'false';fi? if the answer is yes, it means you need to make the file/dev/nullmanually bytouch /dev/null. And then trysudo apt updateagain. – MR. ROBOT May 08 '19 at 10:01true. The second goes fine but theapt-get updateis not working due to some issues. – Samuel Mideksa May 08 '19 at 10:28if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fion a terminal please. If there is no error during it, it means a error exists somewhere else. – MR. ROBOT May 08 '19 at 11:34bash: /usr/lib/cnf-update-db: /usr/bin/python3: bad interpreter: No such file or directory– Samuel Mideksa May 08 '19 at 11:40bash: /usr/lib/cnf-update-db: /usr/bin/python3: bad interpreter: No such file or directory– Samuel Mideksa May 08 '19 at 12:33sudo apt install python3– MR. ROBOT May 08 '19 at 12:54sudo apt-get install python3works without an error. but when I typepython3 --versionIt is raising the above errorbash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory– Samuel Mideksa May 09 '19 at 07:09sudo rm ~/Anaconda3and removed the line invoking conda in .bashrc file. Was that causing the problem? – Samuel Mideksa May 09 '19 at 07:11sudo apt remove --purge python3and then reinstall it bysudo apt install python3. I hope this solve the problem. – MR. ROBOT May 09 '19 at 07:22E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). The purge also didn't succeed with the following errorE: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). ` – Samuel Mideksa May 09 '19 at 07:26sudo apt --fix-broken install– MR. ROBOT May 09 '19 at 07:27sudo apt --fix-broken install python3but it is not workingE: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).– Samuel Mideksa May 09 '19 at 07:30sudo apt-get check– MR. ROBOT May 09 '19 at 11:03