21

I made a terrible mistake and upgraded to 18.04 without making a backup in a different partition by doing:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt-get autoremove
sudo apt install update-manager-core
sudo do-release-upgrade -d

Then I did update and upgrade commands after a restart. There are now many issues with unmet dependencies and broken packages that the sudo apt-get -f install commands cannot fix. UPDATE The first part of the output from the sudo apt install -f error log is:

    Reading package lists...
Building dependency tree...
Reading state information...
Correcting dependencies... failed.
The following packages have unmet dependencies:
 gnome-calendar : Depends: gsettings-desktop-schemas (>= 3.21.2) but 3.18.1-1ubuntu1 is installed
 gnome-session : Depends: gnome-shell (>= 3.25.91-0ubuntu4~) but it is not installed
                 Depends: gnome-session-bin (>= 3.28.1-0ubuntu2) but 3.18.1.2-1ubuntu1.16.04.2 is installed
                 Depends: gnome-session-common (= 3.28.1-0ubuntu2) but 3.18.1.2-1ubuntu1.16.04.2 is installed
                 Depends: xwayland but it is not installed
                 Recommends: fonts-cantarell but it is not installed
                 Recommends: adwaita-icon-theme-full
                 Recommends: gnome-themes-extra but it is not installed
 gnome-settings-daemon : Depends: libgnome-desktop-3-17 (>= 3.17.92) but it is not installed
                         Depends: gsettings-desktop-schemas (>= 3.20) but 3.18.1-1ubuntu1 is installed
 hplip : Depends: python3 (< 3.6) but 3.6.5-3 is installed
 libc-dev-bin : Depends: libc6 (< 2.24) but 2.27-3ubuntu1 is installed
 libc6-dbg : Depends: libc6 (= 2.23-0ubuntu10) but 2.27-3ubuntu1 is installed
 libc6-dev : Depends: libc6 (= 2.23-0ubuntu10) but 2.27-3ubuntu1 is installed
 libgmime-3.0-0 : Depends: libgpgme11 (>= 1.7.0) but 1.6.0-1 is installed
 libreoffice-avmedia-backend-gstreamer : Depends: libreoffice-core (= 1:5.1.6~rc2-0ubuntu1~xenial3) but 1:6.0.3-0ubuntu1 is installed
 libreoffice-base-core : Depends: libreoffice-core (= 1:5.1.6~rc2-0ubuntu1~xenial3) but 1:6.0.3-0ubuntu1 is installed
 libreoffice-calc : Depends: libreoffice-base-core (= 1:6.0.3-0ubuntu1) but 1:5.1.6~rc2-0ubuntu1~xenial3 is installed
                    Depends: liborcus-0.13-0 (>= 0.13.3) but it is not installed
 libreoffice-core : Depends: libgpgmepp6 (>= 1.10.0) but it is not installed
                    Depends: liborcus-0.13-0 (>= 0.13.3) but it is not installed
                    Depends: libpoppler73 (>= 0.62.0) but it is not installed
                    Depends: libxmlsec1 (>= 1.2.25) but it is not installed
                    Depends: libxmlsec1-nss (>= 1.2.25) but it is not installed
 libreoffice-gnome : Depends: libreoffice-gtk3 but it is not installed
 libreoffice-gtk : Depends: libreoffice-gtk2 but it is not installed
 libreoffice-math : Depends: libreoffice-core (= 1:5.1.6~rc2-0ubuntu1~xenial3) but 1:6.0.3-0ubuntu1 is installed
 libreoffice-writer : Depends: libreoffice-base-core (= 1:6.0.3-0ubuntu1) but 1:5.1.6~rc2-0ubuntu1~xenial3 is installed
                      Depends: libabw-0.1-1 but it is not installed
                      Depends: libepubgen-0.1-1 (>= 0.1.0) but it is not installed
 libtotem0 : Depends: libgnome-desktop-3-17 (>= 3.17.92) but it is not installed
 libwayland-egl1-mesa : Depends: libegl1 but it is not installed
 libwebkitgtk-1.0-0 : Depends: libjavascriptcoregtk-1.0-0 (= 2.4.11-0ubuntu0.1) but 2.4.11-3ubuntu3 is installed
                      Depends: libwebkitgtk-1.0-common (>= 2.4.11) but it is not installable
 nautilus : Depends: libgnome-desktop-3-17 (>= 3.18.1) but it is not installed
 python3-brlapi : Depends: python3 (< 3.6) but 3.6.5-3 is installed
 python3-cffi-backend : Depends: python3 (< 3.6) but 3.6.5-3 is installed
 python3-crypto : Depends: python3 (< 3.6) but 3.6.5-3 is installed

and

E: Error, pkgProblemResolver::Resolve generated breaks,   
this may be caused by held packages.  

Trying to fix broken packages in Synaptic produces this error message:

E: Error, pkgProblemResolver::Resolve generated breaks,   
this may be caused by held packages.     

It doesn't look like there's anything wrong with the sources.list file, and it appears to have been updated when I tried the install. I barely know what I'm doing and am happy to provide more detail on error messages. If there's a way to enable scrolling up in xterm, which is what I'm now using since Gnome terminal can't be opened.

I'd like to remove all 47 broken packages and held packages, reinstall them correctly or not install them for now if that's an option (i.e., for things like LibreOffice, which isn't a current need), and be able to use the Gnome terminal.

I'm looking for beginner steps for how to fix all these problems. Is there a guide about how to start? An obvious post that I have missed in my searches for answers? I think this post is heading in the right direction, but it is a little over my head. Any help is much appreciated. I am wondering if it would be genuinely easier to start from a fresh 16.04 install.

k.mat27
  • 321

10 Answers10

15

Here are a couple of things to try.

Method One:

This is the easiest one to try. Instead of using sudo apt-get install PACKAGENAME, where PACKAGENAME is the package you’re trying to install with the apt system, use sudo apt-get install -f. The -f parameter will attempt to correct a system which has broken dependencies, after which you’ll be able to install the package in question.

Open a Terminal and type in:

sudo apt-get install -f

and press ENTER.

Now type in:

sudo dpkg --configure -a

and press ENTER.

Now one more time:

sudo apt-get install -f

Method Two:

Aptitude is an alternative of apt-get which you can use as a higher-level package manager. You can use it to try and install your package with it, instead of apt-get, but first you need to install aptitude.

Open a Terminal and type in:

sudo apt-get install aptitude

and press ENTER.

Now type in:

sudo aptitude install PACKAGENAME

and press ENTER.

PACKAGENAME is the package you’re installing. This will try to install the package via aptitude instead of apt-get, which should potentially fix the unmet dependencies issue.

IF THOSE DO NOT WORK

The broken package is mot likely locked and needs to be deleted. To delete the locked file, open a Terminal and type in:

sudo rm /var/lib/apt/lists/lock

and press ENTER.

The locked file may also need to be deleted in the cache directory. To do that, open a Terminal and type in:

sudo rm /var/cache/apt/archives/lock

I upgraded from 16.04 and was having a lot of different issues. I found it much easier to do a fresh install. A fresh or clean install is always the route to go in my opinion.

Hope this helps,

Dave
  • 1,454
11

I had the exact same problem. I had to go edit /var/lib/dpkg/status and clear out the entire Depends: line from the packages that were complaining.
I'm not sure what other problems that may cause, but it was the only thing that got apt-get install -f working again.

abu_bua
  • 11,313
dmattp
  • 134
7

With root privileges, go to var/lib/dpkg/status and delete the contents of status file.

Then sudo dpkg --configure -a and then sudo apt-get install -f

Then install what you want i.e.

sudo apt-get install nvidia-390 
Bukenya
  • 71
  • 1
  • 2
3

I want to add to this discussion by saying when using the Software Updater to do the upgrade to 18.04 and running into an issue the solution is to open the terminal and type:

sudo apt-get autoremove

followed by what initially caused things to go wrong here that lead to this discussion which as is follows:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt-get autoremove
sudo apt install update-manager-core
sudo do-release-upgrade -d
karel
  • 122,292
  • 133
  • 301
  • 332
JWeb777
  • 31
1

"If there's a way to enable scrolling up in xterm" since you can't scroll up you can send all output to a file by using:

sudo apt install -f > output.log

Then edit output.log and copy the messages to your question. Your chances of getting a good answer improve with more information.


As far as anyone else wanting to copy their data to a backup partition before upgrading to 18.04 here is the command borrowed from this answer: Bash script to clone Ubuntu to new partition for testing 18.04 LTS upgrade

rsync -haxAX --stats --delete --info=progress2 --info=name0 /* "$TargetMnt" \
      --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}

Before running the command you need to create a backup partition and mount it. After mounting it set:

TargetMnt=/mnt/my_backup_partition_name

Of course an easier method is just running the script linked above. It not only provides for interactive selection of the backup partition but provides validation and modifies grub so you can boot into the backup partition if need be.

PS I'm sad to hear about your problems and the many other problems I've read here in Ask Ubuntu since the release of 18.04. Unfortunately you see similar problems with each new release. Hopefully some day Conical stresses the importance of backing up and/or testing on a clone partition first before upgrading. Especially before the first point release of 18.04.1 which comes in July 26, 2018.

1

What helped me:

  1. to use sudo dpkg --remove [package-name] to remove problematic packages found via sudo dpkg --configure -a (source: https://stackoverflow.com/a/35969176/557223). Some packages couldn't be removed as they were dependencies of another packages.
  2. to run sudo apt-get install -f (it started to working again, yay)
  3. to rename org.freedesktop.systemd1.service file as mentioned in https://askubuntu.com/a/838673
  4. To run sudo apt-get update and dist-upgrade and autoremove, and do-release-upgrade

Kudos to https://ubuntuforums.org/showthread.php?t=2398895&page=2 dragans2's post!

mmalmeida
  • 530
  • 2
  • 4
  • 15
1

I was getting this error on DigitalOcean Ubuntu Server after upgrading from 16.04 to 18.04.

After several trials found this error: All DigitalOcean local packages were overwritten with Ubuntu default one.

Do this to open sources.list:

sudo apt edit-sources

Uncomment DigitalOcean packages and comment Ubuntu packages.

Save and exit, then run :

sudo apt-get update
sudo apt-get upgrade

Voila.

Here is my uncommented list of packages, leaving out all commented lines.

deb http://mirrors.digitalocean.com/ubuntu/ xenial main restricted
deb-src http://mirrors.digitalocean.com/ubuntu/ xenial main restricted
deb http://mirrors.digitalocean.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.digitalocean.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.digitalocean.com/ubuntu/ xenial universe
deb-src http://mirrors.digitalocean.com/ubuntu/ xenial universe
deb http://mirrors.digitalocean.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.digitalocean.com/ubuntu/ xenial-updates universe
Olimjon
  • 7,522
Sparkz
  • 11
0

Indeed I had too many problems upgrading from Xubuntu 16.04 to 18.04. I had to completely remove gstreamer from the system (not working with pulseaudio, which behaves weirdly), apart of many other issues unrelated to this post (nvidia, netplan, baloo). In many years of managing desktops and servers it was my hardest migration. Therefore I don't advise ugrading to 18.04 before it is a stable distribution.

0

if you have system that you can't login then go to tty1 login by cltr + alt + F1 key login to your account and try this sudo apt-get install -f dist-upgrade if asks there for particular solution to apply Y/n use other option by typing "." for other solution then you are listed with other solution to fully upgrade your system. if any problem occurs let me know

0

After upgrade I had an issue with pyhon3.7 libs missing, whole apt/dpkg was blocked. Found missing /usr/lib/python3.7/py_compile.py one level deeper /usr/local/lib/python3.7. Solution which worked for me was backup (rename) whole /usr/lib/python3.7 and replace with sym-link.

Here is the problem (apt install -f). Sorry for czech lang, important stuff is in English

Načítají se seznamy balíků…
Vytváří se strom závislostí…
Načítají se stavové informace…
0 aktualizováno, 0 nově instalováno, 0 k odstranění a 7 neaktualizováno.
39 instalováno nebo odstraněno pouze částečně.
Po této operaci bude na disku použito dalších 0 B.
Nastavuje se balík python3-tk:amd64 (3.6.5-3) …
(null): can't open file '/usr/lib/python3.7/py_compile.py': [Errno 2] No such file or directory
dpkg: chyba při zpracovávání balíku python3-tk:amd64 (--configure):
 installed python3-tk:amd64 package post-installation script subprocess returned error exit status 2
Nastavuje se balík python3-lib2to3 (3.6.5-3) …
(null): can't open file '/usr/lib/python3.7/py_compile.py': [Errno 2] No such file or directory
dpkg: chyba při zpracovávání balíku python3-lib2to3 (--configure):
 installed python3-lib2to3 package post-installation script subprocess returned error exit status 2
dpkg: nesplněné závislosti zamezily konfiguraci balíku python3-distutils:
 python3-distutils závisí na python3-lib2to3 (>= 3.6.4); avšak:
  Balík python3-lib2to3 zatím není zkonfigurován.

...

dpkg: chyba při zpracovávání balíku libsdl-net1.2-dev:amd64 (--configure):
 problém se závislostmi - nechávám nezkonfigurované
dpkg: nesplněné závislosti zamezily konfiguraci balíku libsdl-image1.2-dev:amd64:
 libsdl-image1.2-dev:amd64 závisí na libsdl1.2-dev (>= 1.2.14~); avšak:
  Balík libsdl1.2-dev zatím není zkonfigurován.

dpkg: chyba při zpracovávání balíku libsdl-image1.2-dev:amd64 (--configure):
 problém se závislostmi - nechávám nezkonfigurované
dpkg: nesplněné závislosti zamezily konfiguraci balíku libboost-iostreams1.65-dev:amd64:
 libboost-iostreams1.65-dev:amd64 závisí na libboost-regex1.65-dev (= 1.65.1+dfsg-0ubuntu5); avšak:
  Balík libboost-regex1.65-dev:amd64 zatím není zkonfigurován.

dpkg: chyba při zpracovávání balíku libboost-iostreams1.65-dev:amd64 (--configure):
 problém se závislostmi - nechávám nezkonfigurované
dpkg: nesplněné závislosti zamezily konfiguraci balíku libboost-iostreams-dev:amd64:
 libboost-iostreams-dev:amd64 závisí na libboost-iostreams1.65-dev; avšak:
  Balík libboost-iostreams1.65-dev:amd64 zatím není zkonfigurován.

dpkg: chyba při zpracovávání balíku libboost-iostreams-dev:amd64 (--configure):
 problém se závislostmi - nechávám nezkonfigurované
dpkg: nesplněné závislosti zamezily konfiguraci balíku libboost-regex-dev:amd64:
 libboost-regex-dev:amd64 závisí na libboost-regex1.65-dev; avšak:
  Balík libboost-regex1.65-dev:amd64 zatím není zkonfigurován.

dpkg: chyba při zpracovávání balíku libboost-regex-dev:amd64 (--configure):
 problém se závislostmi - nechávám nezkonfigurované
Při zpracování nastaly chyby:
 python3-tk:amd64
 python3-lib2to3
 python3-distutils
 libglib2.0-dev-bin
 python3-dev
 libglib2.0-dev:amd64
 libgdk-pixbuf2.0-dev
 libibus-1.0-dev:amd64
 libboost-python1.65-dev
 libpango1.0-dev
 libsdl2-dev:amd64
 libharfbuzz-dev:amd64
 dh-python
 libsdl2-ttf-dev:amd64
 libboost-python-dev
 libsdl2-image-dev:amd64
 libpulse-dev:amd64
 libicu-le-hb-dev:amd64
 libcairo2-dev:amd64
 libnotify-dev:amd64
 libatk1.0-dev:amd64
 libgtk2.0-dev
 librsvg2-dev:amd64
 libicu-dev
 libass-dev:amd64
 libxml2-dev:amd64
 libsdl2-mixer-dev:amd64
 libsdl1.2-dev
 libsdl-ttf2.0-dev:amd64
 libboost-all-dev
 libboost-regex1.65-dev:amd64
 libbluray-dev:amd64
 libsdl-gfx1.2-dev:amd64
 libsdl-mixer1.2-dev:amd64
 libsdl-net1.2-dev:amd64
 libsdl-image1.2-dev:amd64
 libboost-iostreams1.65-dev:amd64
 libboost-iostreams-dev:amd64
 libboost-regex-dev:amd64