10

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.

  • Try sudo apt-get install -f and dpkg --configure -a. – N0rbert May 4 '18 at 21:32
  • 1
    @N0rbert OP says install -f already run. – WinEunuuchs2Unix May 4 '18 at 23:20
  • 1
    You can try aptitude, this is sometimes more successful in fixing a bad package tree. – Sebastian Stark May 5 '18 at 0:12
  • Why did you use the -d on do-release-upgrade? Honestly, the simplest fix is to do a clean install, if you can. – chaskes May 5 '18 at 22:57
  • Did the -d because I was apparently feeling footloose and fancy free on a Friday morning and the internet told me to, so all around a truly awful set of decisions. Needless to say, I've learned my lesson.. clean installs or at least being patient for the first release will be my go-to in the future. – k.mat27 May 7 '18 at 15:20
7

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.

  • Is removing the dependency line a quick fix to allow me to install the versions the packages are requesting in order to make these packages work? What was your next move after that? I edited my original question to show a few of the python version related errors because I'm concerned that they're integral to the function of 18.04 as a whole, but if you had success with this I would consider giving it a try. – k.mat27 May 7 '18 at 15:23
  • 1
    Basically I think this allows "apt get" to continue rather than bombing out and refusing to do anything because it gets a lot of dependency errors. After I got the dependencies removed from each package that warned, I ran "apt-get install -f" and then I think "apt get upgrade", which proceeded to do the setup / install of about 800 packages. It seemed like it had gotten hung in the middle of the 18.04 upgrade, with a bunch of installs pending. After upgrade completed everything seems to be normal and I'm running what seems to be a stable 18.04 system. – dmattp May 7 '18 at 21:18
  • 1
    Also be sure to back up the "status" file before editing! If you bork the file with manual edits you'll have to restore from backup. – dmattp May 7 '18 at 21:19
  • After backing up the status file, I gave your solution a shot. I had to repeat the steps a couple of times and then had to uninstall one hanger-on (something I don't use anyway), which I did through Synaptic. I can now install things, which is great, but as a caveat to others who may try this I still cannot use the Software & Updates and gnome things that came standard with 16.04...which is fine by me, but could be bad for others. Thank you! I'll be patient with the real release of 18.04 - which I will welcome by backing up again and performing a clean install...lesson learned. – k.mat27 May 9 '18 at 18:52
  • It worked on my system. I removed all the unmet dependencies from /var/lib/dpkg/status – Fahad Naeem Dec 27 '18 at 11:17
9

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,

  • And what should we do with your malformed command as sudo dpkg –configure -a (typographic will not work in terminal)? Looks like copy and and paste without critical thinking. Please edit your answer and be more accurate next time! – N0rbert May 5 '18 at 9:11
  • Well excuse me for the typo! My bad. Answer edited. – Dave May 5 '18 at 22:33
  • Please do not post the same answer to many questions. Posting the same answer everywhere is not a "one thing for all" solution, and unless you can really confirm that all your suggested solutions truly fix the problems being stated then you should strongly reconsider posting the same answer everywhere. – Thomas Ward May 7 '18 at 1:17
  • Hi Dave, are there any negative consequences that could arise from trying to delete the locked file and its presence in the cache directory? Following that, should I go back to trying your Method 1 suggestion again (after first installing aptitude!) or is it likely to result in the same problem? – k.mat27 May 7 '18 at 15:15
  • Installing aptitude is a different method from method one, so going back to it would be redundant. As far as removing the locked file, I've always made sure I knew what it is for or if that particular file is locked because, for some reason, the dependencies did not get in installed (which was my case a few times). In my case, I removed the files, then re-installed using a package manager. I highly recommend Synaptic Package Manager as it can help fix unmet dependencies. – Dave May 8 '18 at 0:39
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.

  • Really appreciate the answer to the xterm portion of the question, especially since I realize it was off-topic for the rest of the post (my bad). The original question is edited with the output above. Wish I had taken your advice with the clone in the first place, but will do so once I've fixed the current problem and again in the future! – k.mat27 May 7 '18 at 15:17
  • @k.mat27 I'm starting to clone now even before installing nVidia drivers which have caused me all kinds of grief and are hard to "undo". You didn't downvote my answer by accident did you? – WinEunuuchs2Unix May 7 '18 at 23:17
  • No! Wish I could upvote it, actually, but I lack the reputation. – k.mat27 May 9 '18 at 16:31
  • You get 2 points when you click the Check Mark next to an answer to accept it for a question you posted. Plus the author gets 15 points for an accepted answer. More importantly it helps other users find accept answers. You get 5 points for every up vote on a question you post. If you answer a question you get 10 points for every up vote and minus 2 for every down vote. Hope this helps. – WinEunuuchs2Unix May 9 '18 at 17:41
1

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
  • Welcome JWeb777 to Ask Ubuntu! I recommend to edit this answer to expand it with specific details why autoremove inhibits the problem. – abu_bua Jul 25 '18 at 0:21
  • 1
    I'm not sure I understand the request? But the issues this resolved was during the upgrade something went wrong long story short I wound up with a partial upgrade that the Software Update programs installed within Ubuntu couldn't resolve the command line I posted in that order resolved the breaks and brought all the gaps back to a working state with most of the updates done as well with no issues remaining and minimal updating left to do – JWeb777 Aug 13 '18 at 8:08
  • If U were to specify u what u are wanting to know a little more I might have a better answer maybe – JWeb777 Aug 13 '18 at 8:10
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

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!

-1

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
-1

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 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.