-4

I upgraded Ubuntu 18.04 to 20.04 and now everything is broken. apt doesn't work.keep getting dpkg errors when trying to use it. cant install anything. nautilus and terminal doesn't work. lots of icons are not appearing.broken icons broken icons2 broken icons3

some python errors occurring and so on. what to do now? even backup program doesn't work. How to make it work again? I couldn't understand how canonical cant send a proper upgrade

EDIT1: are there any way to remove and reinstall all needed packages? apt actually works but giving different errors.

EDIT2:for making an example, after running sudo apt install terminator Quarter of output is:

.
.
.
dpkg: dependency problems prevent configuration of terminator:
 terminator depends on python3-configobj; however:
  Package python3-configobj is not configured yet.
 terminator depends on python3-gi; however:
  Package python3-gi is not configured yet.
 terminator depends on python3-gi-cairo; however:
  Package python3-gi-cairo is not configured yet.
 terminator depends on python3-psutil; however:
  Package python3-psutil is not configured yet.
 terminator depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package terminator (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of python3-nacl: python3-nacl depends on python3 (>= 3~); however: Package python3 is not configured yet. python3-nacl depends on python3-six; however: Package python3-six is not configured yet. python3-nacl depends on python3:any; however: Package python3 is not configured yet.

dpkg: error processing package python3-nacl (--configure): dependency problems - leaving unconfigured Setting up libgtk-3-common (3.24.20-0ubuntu1) ... dpkg: dependency problems prevent configuration of python3-systemd: python3-systemd depends on python3 (<< 3.9); however: Package python3 is not configured yet. python3-systemd depends on python3 (>= 3.8~); however: Package python3 is not configured yet. python3-systemd depends on python3:any; however: Package python3 is not configured yet.

dpkg: error processing package python3-systemd (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of python3-cffi-backend: python3-cffi-backend depends on python3 (<< 3.9); however: Package python3 is not configured yet. python3-cffi-backend depends on python3 (>= 3.8~); however: Package python3 is not configured yet.

dpkg: error processing package python3-cffi-backend (--configure): dependency problems - leaving unconfigured dpkg: too many errors, stopping Processing triggers for libc-bin (2.31-0ubuntu9.2) ... Processing triggers for dictionaries-common (1.28.1) ... Errors were encountered while processing: python3 python3-psutil apport python3-tz python3-apport python3-cupshelpers python3-monotonic python3-requests-unixsocket python3-six python3-simplejson python3-cups python3-oauthlib python3-chardet python3-configobj python3-secretstorage system-config-printer python3-certifi python3-pexpect python3-cryptography python3-wadllib python3-gi python3-requests python3-ldb python3-idna python3-fasteners python3-urllib3 gnome-shell ubuntu-session ibus gdm3 python3-defer duplicity python3-keyring python3-httplib2 language-selector-common python3-paramiko lsb-release python3-protobuf python3-future python3-rfc3339 python3-macaroonbakery python3-aptdaemon.gtk3widgets python3-ibus-1.0 python3-lazr.restfulclient python3-gi-cairo python3-lib2to3 terminator python3-nacl python3-systemd python3-cffi-backend Processing was halted because there were too many errors.

EDIT3: output of sudo apt-get install aptitude : https://pastecode.io/s/9eo7pji8

output of sudo aptitude dist-upgrade : https://pastecode.io/s/dgnjw0z9

output of apt-cache policy : https://pastecode.io/s/w5rso9um

EDIT4: i tried sudo dpkg --configure -a sudo apt-get install -f and got same errors as apt-get install terminator gives. Just last two rows are:

Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

EDIT5:Suddenly my gnome-terminal started to work. But nautilis still doesnt work. And after running recommended commands:

export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

cd ~/Downloads apt-get download python3-minimal dpkg -l | grep ^ii | grep python sudo -E dpkg -i --force-all ./python3-minimal*.deb

sudo -E dpkg --configure -a sudo -E apt-get install -f sudo -E apt-get install --reinstall python3-minimal sudo -E apt-get install --reinstall $(dpkg -l | grep ^ii | grep python | awk '{print $2}') sudo -E dpkg --configure -a sudo -E apt-get install -f

sudo -E apt-get install aptitude sudo -E aptitude safe-upgrade sudo -E aptitude dist-upgrade

the output is: https://pastecode.io/s/ytobvrny still getting same errors as above.

EDIT6: I just tried something before your posts and removed nvidia driver. After that my gui gone. Then i removed windows(it was dual boot system) and my ttys gone too. I didnt remember my password so couldnt log in for a couple days. Now i cant enter grub for maybe trying recovery mode.

I just use live usb and restored chrome on live usb. Now what can i do? Is it possible to do something from live usb to restore my installed os again? i tried @N0rbert's answer partially before my gui gone but i got similar errors again. But didnt complete to install all downloaded debs.

hepl
  • 27
  • Did you back up first? Unfortunately updates and upgrades can go wrong. If you’ve got backups, it’s probably best to perform a fresh install. – Will Nov 24 '21 at 22:12
  • @Will no unfortunately. and in this situation getting my files cost lot of time – hepl Nov 24 '21 at 22:27
  • @mook765 deleted. – hepl Nov 24 '21 at 22:27
  • 1
    There is an insufficient amount of detail here to begin to offer any solution. Could you [edit] your question to include the exact error messages that you’re seeing? Without this, nobody can offer any solution beyond a nuke and pave … – matigo Nov 24 '21 at 22:31
  • @guiverc yeah i mean 18.04 to 20.04. not 18 or 20 – hepl Nov 24 '21 at 22:31
  • 4
    Boot to a Ubuntu Live DVD/USB, and drag your important files from your original boot disk, to an external disk or flash drive. Then CLEAN reinstall Ubuntu. – heynnema Nov 25 '21 at 01:29
  • 1
    -1 due to the needless rock-thowing ("I couldnt understand how canonical cant send a proper upgrade"). I've release upgraded dozens of systems on that path without a hiccup. I've tested the upgrade on bare metal and in VMs. It is definitely a proper, working upgrade. – user535733 Nov 25 '21 at 02:38
  • Please run sudo apt-get install aptitude; sudo aptitude dist-upgrade; apt-cache policy and add all these outputs to question (if long - use pastebin). Probably you have some third-party repository or PPA which causes all these issues. – N0rbert Nov 25 '21 at 06:16
  • @N0rbert i couldnt access pastebin so i used another one – hepl Nov 25 '21 at 11:18
  • Try sudo dpkg --configure -a with sudo apt-get install -f . – N0rbert Nov 25 '21 at 14:45
  • I added an answer – Error404 Nov 27 '21 at 02:52
  • You can boot from a live USB, and use it to backup the data. Then fresh install. – Archisman Panigrahi Nov 27 '21 at 05:54

2 Answers2

1

please try N0berts answer first

I would recommend reinstalling possibly problematic packages at a low level:
export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

cd ~/Downloads apt-get download python3-minimal sudo -E dpkg -i --force-all ./python3-minimal*.deb

sudo -E dpkg --configure -a sudo -E apt-get install -f sudo -E apt-get install --reinstall python3-minimal sudo -E apt-get install --reinstall $(dpkg -l | grep ^ii | grep python | awk '{print $2}') sudo -E dpkg --configure -a sudo -E apt-get install -f

sudo -E apt-get install aptitude sudo -E aptitude safe-upgrade sudo -E aptitude dist-upgrade

Try to fix each package separately:

mkdir ~/Downloads/debs
cd ~/Downloads/debs
apt-get download devhelp dput gdebi-core python3 python3-psutil apport python3-tz python3-apport python3-cupshelpers python3-monotonic python3-requests-unixsocket python3-six python3-simplejson python3-cups python3-oauthlib python3-chardet python3-configobj python3-secretstorage system-config-printer python3-certifi python3-pexpect python3-cryptography python3-wadllib python3-gi python3-requests python3-ldb python3-idna python3-fasteners python3-urllib3 gnome-shell ubuntu-session ibus gdm3 python3-defer duplicity python3-keyring python3-httplib2 language-selector-common python3-paramiko lsb-release python3-protobuf python3-future python3-rfc3339 python3-macaroonbakery python3-aptdaemon.gtk3widgets python3-ibus-1.0 python3-lazr.restfulclient python3-gi-cairo python3-lib2to3 terminator python3-nacl python3-systemd python3-cffi-backend

sudo dpkg -i --force-all ./devhelp.deb sudo dpkg -i --force-all ./dput.deb sudo dpkg -i --force-all ./gdebi-core.deb sudo dpkg -i --force-all ./python3.deb sudo dpkg -i --force-all ./python3-psutil.deb sudo dpkg -i --force-all ./apport.deb sudo dpkg -i --force-all ./python3-tz.deb sudo dpkg -i --force-all ./python3-apport.deb sudo dpkg -i --force-all ./python3-cupshelpers.deb sudo dpkg -i --force-all ./python3-monotonic.deb sudo dpkg -i --force-all ./python3-requests-unixsocket.deb sudo dpkg -i --force-all ./python3-six.deb sudo dpkg -i --force-all ./python3-simplejson.deb sudo dpkg -i --force-all ./python3-cups.deb sudo dpkg -i --force-all ./python3-oauthlib.deb sudo dpkg -i --force-all ./python3-chardet.deb sudo dpkg -i --force-all ./python3-configobj.deb sudo dpkg -i --force-all ./python3-secretstorage.deb sudo dpkg -i --force-all ./system-config-printer.deb sudo dpkg -i --force-all ./python3-certifi.deb sudo dpkg -i --force-all ./python3-pexpect.deb sudo dpkg -i --force-all ./python3-cryptography.deb sudo dpkg -i --force-all ./python3-wadllib.deb sudo dpkg -i --force-all ./python3-gi.deb sudo dpkg -i --force-all ./python3-requests.deb sudo dpkg -i --force-all ./python3-ldb.deb sudo dpkg -i --force-all ./python3-idna.deb sudo dpkg -i --force-all ./python3-fasteners.deb sudo dpkg -i --force-all ./python3-urllib3.deb sudo dpkg -i --force-all ./gnome-shell.deb sudo dpkg -i --force-all ./ubuntu-session.deb sudo dpkg -i --force-all ./ibus.deb sudo dpkg -i --force-all ./gdm3.deb sudo dpkg -i --force-all ./python3-defer.deb sudo dpkg -i --force-all ./duplicity.deb sudo dpkg -i --force-all ./python3-keyring.deb sudo dpkg -i --force-all ./python3-httplib2.deb sudo dpkg -i --force-all ./language-selector-common.deb sudo dpkg -i --force-all ./python3-paramiko.deb sudo dpkg -i --force-all ./lsb-release.deb sudo dpkg -i --force-all ./python3-protobuf.deb sudo dpkg -i --force-all ./python3-future.deb sudo dpkg -i --force-all ./python3-rfc3339.deb sudo dpkg -i --force-all ./python3-macaroonbakery.deb sudo dpkg -i --force-all ./python3-aptdaemon.gtk3widgets.deb sudo dpkg -i --force-all ./python3-ibus-1.0.deb sudo dpkg -i --force-all ./python3-lazr.restfulclient.deb sudo dpkg -i --force-all ./python3-gi-cairo.deb sudo dpkg -i --force-all ./python3-lib2to3.deb sudo dpkg -i --force-all ./terminator.deb sudo dpkg -i --force-all ./python3-nacl.deb sudo dpkg -i --force-all ./python3-systemd.deb sudo dpkg -i --force-all ./python3-cffi-backend

sudo apt-get install --reinstall devhelp dput gdebi-core python3 python3-psutil apport python3-tz python3-apport python3-cupshelpers python3-monotonic python3-requests-unixsocket python3-six python3-simplejson python3-cups python3-oauthlib python3-chardet python3-configobj python3-secretstorage system-config-printer python3-certifi python3-pexpect python3-cryptography python3-wadllib python3-gi python3-requests python3-ldb python3-idna python3-fasteners python3-urllib3 gnome-shell ubuntu-session ibus gdm3 python3-defer duplicity python3-keyring python3-httplib2 language-selector-common python3-paramiko lsb-release python3-protobuf python3-future python3-rfc3339 python3-macaroonbakery python3-aptdaemon.gtk3widgets python3-ibus-1.0 python3-lazr.restfulclient python3-gi-cairo python3-lib2to3 terminator python3-nacl python3-systemd python3-cffi-backend

and then repeat the above commands from a smaller code block.

If N0berts answer didn't work then I am sorry, You need to go on to dangerous commands or complete reinstall

Before running the below commands please do the following(it is optional but let us not take a risk) -

  • install the ubuntu iso file

  • verify it (optional)

  • burn the iso to a cd-dvd-usb etc.

  • backup /home

  • done

Please don't break your system by doing something you shouldn't have done, If you don't understand anything please ask, I am pretty sure that most of the commands will just go above your head, So feel free to ask anything.

First of all start by running

sudo apt --fix-broken install

After running the above command try installing aptitude once again by

sudo apt -f install aptitude 

Let's see if this works or not


If this didn't work then try running this

sudo rm -rf /var/cache/apt/archives/*.deb

After this try installing aptitude once again

If the error is still there then there is no luck for friendly solutions, but you need to forcefully remove all the problem packages

How to do that

See the error message


Errors were encountered while processing:
 python3
 python3-psutil
 apport
 python3-tz
 python3-apport
 python3-cupshelpers
 python3-monotonic
 python3-requests-unixsocket
 python3-six
 python3-simplejson
 python3-cups
 python3-oauthlib
 python3-chardet
 python3-configobj
 python3-secretstorage
 system-config-printer
 python3-certifi
 python3-pexpect
 python3-cryptography
 python3-wadllib
 python3-gi
 python3-requests
 python3-ldb
 python3-idna
 python3-fasteners
 python3-urllib3
 gnome-shell
 ubuntu-session
 ibus
 gdm3
 python3-defer
 duplicity
 python3-keyring
 python3-httplib2
 language-selector-common
 python3-paramiko
 lsb-release
 python3-protobuf
 python3-future
 python3-rfc3339
 python3-macaroonbakery
 python3-aptdaemon.gtk3widgets
 python3-ibus-1.0
 python3-lazr.restfulclient
 python3-gi-cairo
 python3-lib2to3
 terminator
 python3-nacl
 python3-systemd
 python3-cffi-backend
Processing was halted because there were too many errors.

So to fix you need to manually remove them from doing database

how

Do this all in grub recovery mode by pressing the shift key before the boot logo appears and the advanced option for ubuntu > Recovery mode > Drop to a root shell // OR Open a TTY first to run the below commands by pressing ctrl + alt + f5, log in there with your (sudo)username and password

Go to /var/lib/dpkg/info

cd /var/lib/dpkg/info/

Now as we saw the error above we need to delete problem packages

See this line

errors were encountered during processing

It means after this line everything that came is just a package name

So the first package is "python3"

sudo mv python3* $HOME
### WARNING DON'T CLOSE THE SHELL DON'T DO ANYTHING AFTER THAT 

Hey, listen here we are not removing the files but just moving them to some other location, So, in case anything bad happens we can still fix it as we have backup

Then test again

sudo apt -f install aptitude 

Again see the error message (most of the errors were gone after this)

Then do the same with all the error packages again (sudo mv error-package* $HOME)

So after doing the above all, You will see you can install and use apt packages

Now fix everything copy/paste this line (if you are in a try then you need to manually type this)

for package in $(apt-get upgrade 2>&1 | grep "warning: files list file for package '" | grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do apt-get install --reinstall "$package"; done

if this didn't return anything run sudo apt install python3-all, you will still get an error message saying that files for package x are missing, don't bother that error

At last no matter, what happens, You need to run these commands.

MAKE SURE TO RUN-

sudo apt install python3-all
sudo apt install aptitude
sudo aptitude -f upgrade
sudo aptitude -f install --reinstall ubuntu-session
sudo reboot 

Now more it less your problem should be solved

Error404
  • 7,440
  • Hey i tried shift key to enter grub but i didnt work. Esc directly opening boot menu on my computer. Is is possible to run this apt install command for installed os on live usb? Or can i do them with manually placing some folder, files etc.? – hepl Nov 29 '21 at 23:02
  • @hepl You can do this on a normal terminal also and also if you press ctrl + alt + f5 you can enter a tty, it is completely up to you, you can use normal terminal also – Error404 Nov 30 '21 at 01:19
  • no bro i cant use terminal or tty. i dont have a gui when booting the ubuntu. And ctrl + alt f1-f8 doesnt work. Completetly same in this question: link. I just wonder, can i write commands for my crashed os when i booted from live usb(try ubuntu option). – hepl Dec 01 '21 at 21:32
  • https://askubuntu.com/a/92558/1460940 @hepl follow this answer and I think so you will be able to have a terminal – Error404 Dec 02 '21 at 04:24
0

I would recommend to reinstall possibly problematic packages at low level:

export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

cd ~/Downloads apt-get download python3-minimal sudo -E dpkg -i --force-all ./python3-minimal*.deb

sudo -E dpkg --configure -a sudo -E apt-get install -f sudo -E apt-get install --reinstall python3-minimal sudo -E apt-get install --reinstall $(dpkg -l | grep ^ii | grep python | awk '{print $2}') sudo -E dpkg --configure -a sudo -E apt-get install -f

sudo -E apt-get install aptitude sudo -E aptitude safe-upgrade sudo -E aptitude dist-upgrade

Try to fix each package separately:

mkdir ~/Downloads/debs
cd ~/Downloads/debs
apt-get download devhelp dput gdebi-core python3 python3-psutil apport python3-tz python3-apport python3-cupshelpers python3-monotonic python3-requests-unixsocket python3-six python3-simplejson python3-cups python3-oauthlib python3-chardet python3-configobj python3-secretstorage system-config-printer python3-certifi python3-pexpect python3-cryptography python3-wadllib python3-gi python3-requests python3-ldb python3-idna python3-fasteners python3-urllib3 gnome-shell ubuntu-session ibus gdm3 python3-defer duplicity python3-keyring python3-httplib2 language-selector-common python3-paramiko lsb-release python3-protobuf python3-future python3-rfc3339 python3-macaroonbakery python3-aptdaemon.gtk3widgets python3-ibus-1.0 python3-lazr.restfulclient python3-gi-cairo python3-lib2to3 terminator python3-nacl python3-systemd python3-cffi-backend

sudo dpkg -i --force-all ./devhelp.deb sudo dpkg -i --force-all ./dput.deb sudo dpkg -i --force-all ./gdebi-core.deb sudo dpkg -i --force-all ./python3.deb sudo dpkg -i --force-all ./python3-psutil.deb sudo dpkg -i --force-all ./apport.deb sudo dpkg -i --force-all ./python3-tz.deb sudo dpkg -i --force-all ./python3-apport.deb sudo dpkg -i --force-all ./python3-cupshelpers.deb sudo dpkg -i --force-all ./python3-monotonic.deb sudo dpkg -i --force-all ./python3-requests-unixsocket.deb sudo dpkg -i --force-all ./python3-six.deb sudo dpkg -i --force-all ./python3-simplejson.deb sudo dpkg -i --force-all ./python3-cups.deb sudo dpkg -i --force-all ./python3-oauthlib.deb sudo dpkg -i --force-all ./python3-chardet.deb sudo dpkg -i --force-all ./python3-configobj.deb sudo dpkg -i --force-all ./python3-secretstorage.deb sudo dpkg -i --force-all ./system-config-printer.deb sudo dpkg -i --force-all ./python3-certifi.deb sudo dpkg -i --force-all ./python3-pexpect.deb sudo dpkg -i --force-all ./python3-cryptography.deb sudo dpkg -i --force-all ./python3-wadllib.deb sudo dpkg -i --force-all ./python3-gi.deb sudo dpkg -i --force-all ./python3-requests.deb sudo dpkg -i --force-all ./python3-ldb.deb sudo dpkg -i --force-all ./python3-idna.deb sudo dpkg -i --force-all ./python3-fasteners.deb sudo dpkg -i --force-all ./python3-urllib3.deb sudo dpkg -i --force-all ./gnome-shell.deb sudo dpkg -i --force-all ./ubuntu-session.deb sudo dpkg -i --force-all ./ibus.deb sudo dpkg -i --force-all ./gdm3.deb sudo dpkg -i --force-all ./python3-defer.deb sudo dpkg -i --force-all ./duplicity.deb sudo dpkg -i --force-all ./python3-keyring.deb sudo dpkg -i --force-all ./python3-httplib2.deb sudo dpkg -i --force-all ./language-selector-common.deb sudo dpkg -i --force-all ./python3-paramiko.deb sudo dpkg -i --force-all ./lsb-release.deb sudo dpkg -i --force-all ./python3-protobuf.deb sudo dpkg -i --force-all ./python3-future.deb sudo dpkg -i --force-all ./python3-rfc3339.deb sudo dpkg -i --force-all ./python3-macaroonbakery.deb sudo dpkg -i --force-all ./python3-aptdaemon.gtk3widgets.deb sudo dpkg -i --force-all ./python3-ibus-1.0.deb sudo dpkg -i --force-all ./python3-lazr.restfulclient.deb sudo dpkg -i --force-all ./python3-gi-cairo.deb sudo dpkg -i --force-all ./python3-lib2to3.deb sudo dpkg -i --force-all ./terminator.deb sudo dpkg -i --force-all ./python3-nacl.deb sudo dpkg -i --force-all ./python3-systemd.deb sudo dpkg -i --force-all ./python3-cffi-backend

sudo apt-get install --reinstall devhelp dput gdebi-core python3 python3-psutil apport python3-tz python3-apport python3-cupshelpers python3-monotonic python3-requests-unixsocket python3-six python3-simplejson python3-cups python3-oauthlib python3-chardet python3-configobj python3-secretstorage system-config-printer python3-certifi python3-pexpect python3-cryptography python3-wadllib python3-gi python3-requests python3-ldb python3-idna python3-fasteners python3-urllib3 gnome-shell ubuntu-session ibus gdm3 python3-defer duplicity python3-keyring python3-httplib2 language-selector-common python3-paramiko lsb-release python3-protobuf python3-future python3-rfc3339 python3-macaroonbakery python3-aptdaemon.gtk3widgets python3-ibus-1.0 python3-lazr.restfulclient python3-gi-cairo python3-lib2to3 terminator python3-nacl python3-systemd python3-cffi-backend

and then repeat above commands from smaller code block.

Do not try to remove files from /var/lib/dpkg/info/ - it is dangerous and may get situation even worse, up to completely reinstall.

N0rbert
  • 99,918
  • Interesting approach. Did you ever try just removing everything which throws errors and then reinstalling from the highest level down (so dependencies are installed automatically)? This is what I mainly do when confronted with such a situation. I see a lot more low-level work with your approach, but maybe it is better in a really botched situation. – emk2203 Nov 27 '21 at 12:08