2

I hope you can help me. I installed Ubuntu 18.04 a few days ago and, while trying to configure it and installing new packaged and software, I think I did something bad. I think it could be related with installing python. Anyway, netiher the gnome-terminal or gnome-tweaks can´t start anymores. Also, when I try to update (sudo apt-get update) it gives me the following error:

sh 1: /usr/lib/cnf-update-db: not found
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Succes 'if /usr/bin/test -w /var/lib/command-not-found -a -e /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

I am relativeley new to Linux so I have no clue how can I fix this. Any idea? Even to restore defult configurations/settings?

Thank you very much!

  • 1
    Have you tried sudo apt-get -f install? – valiano Sep 12 '18 at 21:22
  • If I try that it returns me another error: Sub-process /usr/bin/dpkg returned an error code(1) – Fernando Sep 12 '18 at 21:24
  • Some of the suggestion soutions here might help: askubuntu.com/questions/688338/… – valiano Sep 12 '18 at 21:28
  • 1
    If you enter python --version what version do you have default (it should be 2.7.x; it's 2.7.15+ on my 18.10 box) Python (2.7) & Python3 (3.6.6 on my box) are installed by default, and Ubuntu still requires python to run 2.7; you use python3 if you need python 3.x (did you try and make python3 default??). For @valiano's suggestion; the actual error was above your post (dpkg returned code was from calling routine, the subprocess it called reported the error earlier in the output & you only listed the end summary.. I'd re-run sudo apt-get -f install and paste output to your question – guiverc Sep 12 '18 at 23:48
-1

It is, as suggested by guiverc, most likey Python version releated. It seams that many Python tutorials this days suggesting to change the default Python version from 2 to 3. While this is nice and practical for Python development, it breaks the package system.

So check where the link /usr/bin/python is poiting to:

$ ls -la /usr/bin/python
lrwxrwxrwx 1 root root 9 Jan 24  2017 /usr/bin/python -> python2.7

It sould point to python2, not to any python3 executable. If it points to python3 then do the following (man ln):

$ sudo rm -f /usr/bin/python
$ sudo ln -s /usr/bin/python2.7 /usr/bin/python

After that, the apt-get will start to work again.

  • I ended up re-installing Ubuntu since I had installed a few days ago anyway. But thank you very much for you answer, it totally makes sense what you say about the python pointing. It made me understand the problem and it may help another person. – Fernando Sep 14 '18 at 7:09

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.