7

I'm running Ubuntu 16.04 and all of a sudden, APT is broken and I can't open a terminal. More specifically, I'm getting the red circle with a white minus sign in the toolbar at the top and when I click on it, it says A problem occurred when checking for the updates. When I click on Terminal, the mouse pointer changes to a circle for a few seconds and nothing happens.

I realize this has been asked many times, but I have tried a few of the other solutions (e.g. running apt-get -f install, apt-get update, apt-get upgrade, commenting out PPA's in sources.list).

Here is the contents of my sources.list

# deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution. deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution. deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team. deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

I also have PPA's under /etc/apt/sources.list.d:

  • dropbox.list
  • gerardpuig-ubuntu-ppa-xenial.list
  • atlassian-hipchat4.list
  • jonathonf-ubuntu-python-3_6-xenial.list
  • libreoffice-ubuntu-ppa-xenial.list
  • pgdg.list

I also noticed that even though I ran update/upgrade/dist-upgrade and rebooted, when I log into TTY1, it still says I have 94 packages to upgrade.

The only thing I was doing prior to this was working with some python code. I don't think I made any changes though. I did change the default Python symlink to point to Python2, but I switched it back to Python3 and unfortunately that did not fix anything.

Thanks.

2
  • Ubuntu also has python2 no need to have done that, I am thinking that's where the issue is coming from. Please post the commands you used to alter the default python and so forth May 29, 2017 at 5:48
  • @George I simply deleted the symlink, then reset it (pointing to python2) and then deleted it and reset it back to python3.6. Any thoughts? I can't open terminal but managed to get into tty1.
    – Brooks
    Jun 1, 2017 at 1:27

3 Answers 3

8

To alternate between python 3.X version just run:

sudo update-alternatives --config python3

To restore software updates just type the number of python 3.5.

2
  • 1
    this said it had no alternatives for python3 :(, but resetting the symlink worked, although that now means I have to invoke my python3.6 scripts with a few extra characters each time.
    – bluppfisk
    Apr 16, 2018 at 2:56
  • In Ubuntu 18.04, pick python 3.6. I can NOT believe this is an issue. Apr 17, 2021 at 17:42
7

Turns out, at some point after installing python3, I switched the /usr/bin/python3 symlink to point to python3.6 instead of the default python3.5 runtime.

Resetting the symlink to point to /usr/bin/python3.5 fixed everything.

1
  • I actually removed the symlink and created a new one without the number 3 in it (python) as python3.8 was the only installation on my Ubuntu 20.04. I reverted things back to how they were and it started working again. Thanks @Brooks.
    – Mike
    Aug 31, 2020 at 20:48
3

to be precise, in my case helped: open Terminal (or UXTerm or Xterm if Terminal doesn't work) and type two commands:

sudo rm /usr/bin/python3
sudo ln -s /usr/bin/python3.5 /usr/bin/python3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .