2

I've somehow broken my Ubuntu 14.04 install.

A project I'm working on required me to install Jupyter notebook, which created some path issues (apparently I should have installed with anaconda rather than pip?). In any event, to fix this I tried uninstalling everything, and reinstalling with anaconda. Jupyter still didn't work, and now Python didn't work either. Turns out it went deeper than that though, my Ubuntu crashed altogether and I had to use recovery mode to reinstall enough things to get it back to a state where I could login without a safe mode.

What I've gathered now is somewhere along the line I uninstalled something in Python, or Python completely. In trying to fix it, I've had it tell me I cannot remove it in the current state, rather, need to reinstall first. Doing so caused issues, because apparently I needed a working version of Python to install what I needed to install ... rather circular. Python is broken, but need Python to fix Python.

For example, trying to individually fix the python packages, with something like:

sudo dpkg --configure python3-apt

returns an error "package is in a very bad inconsistent state; you should reinstall it before attempting configuration". Trying to reinstall fails.

I've tried pretty much any solution I've found online that looked reasonable, no luck. It isn't just a python path issue. Both:

sudo apt-get install -f

and

sudo apt install --reinstall python3-apt

returns a bunch of stuff, but the end says a lot:

Errors were encountered while processing:
/var/cache/apt/archives/python3-apt_0.9.3.5ubuntu3_amd64.deb
/var/cache/apt/archives/python3-distupgrade_1%3a0.220.10_all.deb
/var/cache/apt/archives/python3-update-manager_1%3a0.196.25_all.deb
/var/cache/apt/archives/update-manager_1%3a0.196.25_all.deb
/var/cache/apt/archives/python3-problem-report_2.14.1-0ubuntu3.29_all.deb
/var/cache/apt/archives/python3-apport_2.14.1-0ubuntu3.29_all.deb
/var/cache/apt/archives/software-properties-common_0.92.37.8_all.deb
/var/cache/apt/archives/software-properties-gtk_0.92.37.8_all.deb
/var/cache/apt/archives/python3-software-properties_0.92.37.8_all.deb  
/var/cache/apt/archives/python3-uno_1%3a4.2.8-0ubuntu5.3_amd64.deb

The only reasonable thing I've come across and haven't tried is to reinstall Ubuntu altogether (see here). I have backed up all of my files onto an external drive (in case it all crashes), but, I don't know how to do that sort of Ubuntu reinstall + don't want to risk not being able to figure it out. Someone else installed Ubuntu for me onto my laptop. Dual boot. The Windows 8 still works fine.

List of programs errors have occurred with:

ubuntu-release-upgrader-gtk 
python3-uno 
python3-apt 
apport-gtk 
update-manager-core 
python3-update-manager 
python3-crypto 
python3-louis 
update-notifier 
unattended-upgrades 
ubuntu-release-upgrader-core 
python3-distupgrade 
python3-apport 
python3-problem-report 
python3-software-properties 
update-manager 
apport 
update-notifier-common 
software-properties-gtk 
flashplugin-installer 
software-properties-common

When I tried to fix update-manager, it won't let me due to unmet dependencies with other packages. When I try to fix those packages, it won't let me fix them either, owing to unmet dependencies with the previous package. Circular again.

Whenever I try to install anything, before it asks whether I agree to install X MB to my machine, it shows (but never actually does install these things):

The following extra packages will be installed:
    python3-apport python3-apt python3-distupgrade python3-problem-report
    python3-software-properties python3-uno python3-update-manager
    software-properties-common software-properties-gtk update-manager
Suggested packages:
    python3-launchpadlib python3-apt-dbg python-apt-doc
The following packages will be upgraded:
    python3-apport python3-apt python3-distupgrade python3-problem-report
    python3-software-properties python3-uno python3-update-manager
    software-properties-common software-properties-gtk update-manager
10 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
22 not fully installed or removed.

Also, I cannot open Ubuntu Software Center or Software Updater.

Requested outputs:

which python 
which python3

both return nothing. Immediately allows me to enter a new terminal command, without any error message or output whatsover. Somewhere along the line I think I uninstalled python3, but python2.7 is still present.

echo $PATH

returns

/home/myname/MESA/mesasdk/bin:/home/myname/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/mynames/bin:/usr/lib/jvm/jdk1.7.0/bin:/opt/intel/bin

where MESA is a program for school.

Can anyone help me navigate out of this mess I've accidentally created? I don't want to mess anything further up. Your help would be greatly appreciated!

Update

I've decided to uninstall Ubuntu 14.04, and reinstall the latest Ubuntu in its' place, following this, as suggested on here. Thank you all who helped me with this issue!

  • sudo apt install --reinstall python3-apt – Kaz Wolfe Sep 20 '18 at 20:43
  • @KazWolfe Thanks! No luck tough. That returns to me some of the same errors: "Errors were encountered while processing: ..." etc. code again – Canada709 Sep 20 '18 at 20:49
  • @karel Checking that out now – Canada709 Sep 20 '18 at 20:49
  • "sudo apt-get remove python" causes an error: "dpkg: error processing package update-manager (--remove): package is in a very bad inconsistent state; you should reinstall it before attempting a removal" – Canada709 Sep 20 '18 at 20:53
  • Please add output of which python and which python3 to the question. – N0rbert Sep 20 '18 at 20:54
  • Hi N0rbert, normally I'd ask how to do so, but update in a brief moment – Canada709 Sep 20 '18 at 21:02
  • As per that webpage's suggestion, I rebooted. Turns out, I somehow uninstalled Ubuntu 14.04 from my laptop completely (whoops! how? no idea ...) Guess I will have to learn how to install a Linux set up after all. Fortunately I have Windows 8 on the dual boot, so my laptop is still use-able. – Canada709 Sep 20 '18 at 21:06
  • The dual boot now gives me different options than before: "Debian GNU/Linux (in place of Ubuntu 14.04), Advanced options for Debian GNU/Linux, Windows Boot Manager (on /dev/sda2), System Setup". Can anyone direct me to the appropriate links for installing Ubuntu 14.04 from scratch (and whether I'll have to properly uninstall any Linux remnants first)? – Canada709 Sep 20 '18 at 21:06
  • Okay, thank you karel! Will I have to uninstall anything left over by Ubuntu 14.04? Or did I already accidentally do that, given that I can no longer log into Ubuntu 14.04? – Canada709 Sep 20 '18 at 21:10
  • Thank you! Should have asked for your help before this happened eh? – Canada709 Sep 20 '18 at 21:18
  • So ... it turns out "Debian GNU/Linux" IS "Ubuntu 14.04". My Ubuntu did NOT uninstall. The boot menu into it just changed colours from purple to blue, and the labels of the boot options changed (aside from Windows). No idea why any of that happened. I decided to run Debian GNU/Linux just to see what might be required to set up Ubuntu, what was already there, etc., and discovered Ubuntu 14.04 was still there. – Canada709 Sep 22 '18 at 05:02
  • @karel Your latest non-reinstall Ubuntu suggestions, with the link for "How to fix "Package is in a very bad inconsistent state” error?", I had tried that, with no luck – Canada709 Sep 22 '18 at 05:03
  • @N0rbert When I run "which python" and "which python3" in terminal, it does nothing. Immediately allows me to enter a new terminal command, without any error message or output whatsover. Somewhere along the line I think I uninstalled python3, but python2.7 is still present. – Canada709 Sep 22 '18 at 05:05
  • Is uninstalling Ubuntu 14.04 (while preserving my /home directory, if appropriate?) and installing Ubuntu 18.04 the quickest solution? Keeping in mind that I apparently am not very good at installing things properly. Or does anyone have anymore suggestions? – Canada709 Sep 22 '18 at 05:09
  • Please check do you have installed Anaconda? Also please add output of echo $PATH to the question. I think that the problem is that you have overridden system Python by Anaconda's. You need to fix PATH variable and start over. See debugging section of this answer to get clues. – N0rbert Sep 22 '18 at 07:15
  • @N0rbert I've updated it. I had installed Anaconda, but it doesn't seem to be in my path, nor does Python? My outputs don't look like the ones in that link you shared. – Canada709 Sep 22 '18 at 16:26
  • @Canada709 then your issue is more difficult to diagnose. – N0rbert Sep 22 '18 at 18:21
  • @N0rbert Thought that might be the case, thank you! – Canada709 Sep 22 '18 at 20:19

1 Answers1

0

Solution is found in the answer here.

I overwrote Ubuntu 14.04 with a new installation of Ubuntu 18.04, after backing up all of my files.