Im having some issue after updating ubuntu from v20 to v22, and i really need your help.

I surely messed up some python files, and now the vast majority of 'apt' command wont work at all.

Since i already had problems with my ubuntu-desktop, i though i would reinstall it. Problem is, it did uninstall properly, but i can't install it, i always get the same python error :

python3 : Depends: libpython3-stdlib ( = 3.10.11-1+focal1) but it is not going to be installed

python3.10 : Depends: libpython3.10-stdlib (= 3.10.11-1+focal1) but it is not going to be installed

python3.10-minimal : Depends : libpython3.10-minimal (=3.10.11-1+focal1) but it is not going to be installed```

Basically, i've tried everything i could come across online.

Not any apt/apt-get/purge/autoremove/fix-broken,... command work add-apt-repository is broken too

So now im basically stuck on a CLI only ubuntu that can't install anything, and i really don't have a clue on what to do.

While trying to restore my computer I might have messed it up even more than it was, and i might have multiple python installed now, but im not even sure how to check on that.


2 Answers 2


One method: Back up your data, then clean-install Ubuntu 22.04.

"i've tried everything i could come across online" is too vague to understand what you might have done, and a reinstall will be much faster for most folks than the troubleshooting that you don't know how to do anyway.

Going forward, there are two safe ways to have different versions of Python co-exist without destroying your system. You should master at least one of them. It's too late to use them on your current system -- the damage is already done.

  1. Virtualization
  2. Proper use of update-alternatives
  • (ana)conda and pyenv also allow you to install and use multiple versions of Python on the same system in parallel. May 16 at 1:12

Before you try this make a backup of your important data and make a propper install media for jammy!

mkdir $HOME/backup/

Then we move sources.list's from foreign packages sources in this folder.

sudo mv /etc/apt/sources.list.d/* $HOME/backup/

Then we make a backup from your old sources.list.

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

Create a new one

deb http://archive.ubuntu.com/ubuntu jammy main restricted

deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted

deb http://archive.ubuntu.com/ubuntu jammy universe
deb http://archive.ubuntu.com/ubuntu jammy-updates universe

deb http://archive.ubuntu.com/ubuntu jammy multiverse
deb http://archive.ubuntu.com/ubuntu jammy-updates multiverse

deb http://archive.ubuntu.com/ubuntu jammy-security main restricted
deb http://archive.ubuntu.com/ubuntu jammy-security universe
deb http://archive.ubuntu.com/ubuntu jammy-security multiverse
deb http://archive.canonical.com/ubuntu jammy partner

When we try over apt pinning to force packages to jammy version. Create

sudo nano /etc/apt/preferences.d/jammy.pref

with following content.

Package: *
Pin: release n=jammy
Pin-Priority: 1001

Refresh package cache

sudo apt update

First a simulation from partial upgrade Note this is the debian way.

apt -s upgrade

Check the output carefully. If apt tells you are doing something dangerous (remove essential packages) Stop. And install anew like @user535733 told.

If no errors

sudo apt upgrade

Then next simulation

sudo apt -s full-upgrade

Check the ouput again before you make the command for real.

sudo apt full-upgrade

Note this is a dangerous attempt to fix your installation. That's why it is so important to make a backup before and a functional install media.

  • Thanks for your help. Sadly, sudo apt upgrade keep failing for the same python3 unmet dependencies :/
    – laptel
    May 16 at 7:57
  • sudo apt update && sudo apt -f install --reinstall python3=3.10.6-1~22.04 my last idea.
    – nobody
    May 16 at 8:44

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