81

I am running sudo update-manager -d and start the upgrade process. I select upgrade option and when then manager enters Setting new software channels it throws an error.

Could not calculate the upgrade

An unresolvable problem occurred while calculating the upgrade.

 This can be caused by:
 * Upgrading to a pre-release version of Ubuntu
 * Running the current pre-release version of Ubuntu
 * Unofficial software packages not provided by Ubuntu

If none of this applies, then please report this bug using the command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal.

I have disabled all unofficial and third party packages, I am not running a pre-release version since I am at 13.04 and I am trying to update to beta 2 which is not a pre-release. Before I fill a bug report, since its happening to both of my systems I would like to figure out if anyone else had same issues.

EDIT: added output for comment.

$ sudo dpkg -l | grep -w "rc"`
rc google-chrome-beta 31.0.1650.16-1 amd64 The web browser from Google
ii sysv-rc 2.88dsf-13.10ubuntu15 all System-V-like runlevel change mechanism

$ cat /etc/apt/sources.list

deb http://dk.archive.ubuntu.com/ubuntu/ raring main restricted
deb-src http://dk.archive.ubuntu.com/ubuntu/ raring main restricted

deb http://dk.archive.ubuntu.com/ubuntu/ raring-updates main restricted
deb-src http://dk.archive.ubuntu.com/ubuntu/ raring-updates main restricted

deb http://dk.archive.ubuntu.com/ubuntu/ raring universe
deb-src http://dk.archive.ubuntu.com/ubuntu/ raring universe
deb http://dk.archive.ubuntu.com/ubuntu/ raring-updates universe
deb-src http://dk.archive.ubuntu.com/ubuntu/ raring-updates universe

deb http://dk.archive.ubuntu.com/ubuntu/ raring multiverse
deb-src http://dk.archive.ubuntu.com/ubuntu/ raring multiverse
deb http://dk.archive.ubuntu.com/ubuntu/ raring-updates multiverse
deb-src http://dk.archive.ubuntu.com/ubuntu/ raring-updates multiverse

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

deb http://extras.ubuntu.com/ubuntu raring main
deb-src http://extras.ubuntu.com/ubuntu raring main
deb http://dk.archive.ubuntu.com/ubuntu/ raring-proposed multiverse universe restricted main

$ lsb_release -c
Codename:   raring

$ sudo apt-get -y install aptitude && \
      sudo rename 's/\.list$/.list.disable/' /etc/apt/sources.list.d/*.list && \
      sudo aptitude update && \
      aptitude search '?narrow(?installed, !?archive(raring))'`

i   dropbox                       - cloud synchronization engine - CLI and Nautilus extension                      
i   google-chrome-stable          - The web browser from Google                                                    
i   google-talkplugin             - Google Talk Plugin                                                             
i   libdrm-intel1                 - Userspace interface to intel-specific kernel DRM services -- runtime           
i   libdrm-nouveau2               - Userspace interface to nouveau-specific kernel DRM services -- runtime         
i   libdrm-radeon1                - Userspace interface to radeon-specific kernel DRM services -- runtime          
i   libdrm2                       - Userspace interface to kernel DRM services -- runtime                          
i   libegl1-mesa                  - free implementation of the EGL API -- runtime                                  
i   libegl1-mesa-drivers          - free implementation of the EGL API -- hardware drivers                         
i   libgbm1                       - generic buffer management API -- runtime                                       
i   libgl1-mesa-dri               - free implementation of the OpenGL API -- DRI modules                           
i   libgl1-mesa-glx               - free implementation of the OpenGL API -- GLX runtime                           
i   libglapi-mesa                 - free implementation of the GL API -- shared library                            
i A libgles2-mesa                 - free implementation of the OpenGL|ES 2.x API -- runtime                        
i   libllvm3.3                    - Low-Level Virtual Machine (LLVM), runtime library                              
i   libopenvg1-mesa               - free implementation of the OpenVG API -- runtime                               
i   libxatracker1                 - X acceleration library -- runtime                                              
i   nodejs                        - Node.js event-based server-side javascript engine                              
id  nvidia-persistenced           - Load the NVIDIA kernel driver and create device files                          
id  nvidia-settings-331           - Tool for configuring the NVIDIA graphics driver                                
i   simplescreenrecorder          - A feature-rich screen recorder that supports X11 and OpenGL.                   
i A simplescreenrecorder-lib      - A feature-rich screen recorder that supports X11 and OpenGL.                   
i   sublime-text                  - Sublime Text is a sophisticated text editor for code, markup and prose         
i   vokoscreen                    - easy to use screencast creator                                                 
i   xserver-common                - common files used by various X servers                                         
i   xserver-xorg-core             - Xorg X server - core server                                                    
i   xserver-xorg-input-synaptics  - Synaptics TouchPad driver for X.Org server                                     
i   xserver-xorg-video-ati        - X.Org X server -- AMD/ATI display driver wrapper                               
i   xserver-xorg-video-cirrus     - X.Org X server -- Cirrus display driver                                        
i   xserver-xorg-video-intel      - X.Org X server -- Intel i8xx, i9xx display driver                              
i   xserver-xorg-video-mach64     - X.Org X server -- ATI Mach64 display driver                                    
i   xserver-xorg-video-nouveau    - X.Org X server -- Nouveau display driver                                       
i   xserver-xorg-video-r128       - X.Org X server -- ATI r128 display driver                                      
i   xserver-xorg-video-radeon     - X.Org X server -- AMD/ATI Radeon display driver                                
i   xserver-xorg-video-vmware     - X.Org X server -- VMware display driver        
muru
  • 197,895
  • 55
  • 485
  • 740
topless
  • 7,365
  • It looks like its being caused by propriety video drivers. – topless Oct 18 '13 at 12:29
  • Run this command and post the output in your answer after editing: sudo dpkg -l | grep -w "rc" – Saurav Kumar Oct 18 '13 at 19:17
  • @Braiam I have added the output you asked for, apt-get check is Building dependency tree and Reading state information... Done, and dpkg doesn't give an output. – topless Oct 28 '13 at 10:08
  • Could you do the following: sudo apt-get -y install aptitude && sudo rename 's/\.list$/.list.disable/' /etc/apt/sources.list.d/*.list && sudo aptitude update && aptitude search '?narrow(?installed, !?archive(raring))' and paste the results? The first command will install aptitude, second will disable all PPA's, third will update your list and fourth will list all the package that don't comes from the repository. – Braiam Oct 28 '13 at 10:35

10 Answers10

62

What worked for me was removing any broken packages, as they were preventing the upgrade.

First find out which packages are broken:

grep Broken /var/log/dist-upgrade/apt.log

Then remove them:

sudo apt-get remove <packages to remove>

Some might be reinstalled during the upgrade, others you may have to reinstall yourself.

Dennis
  • 403
DaShaun
  • 809
  • 5
  • 8
  • 6
    It looks that I have a big list of xserver-xorg-video-* pacakges that are broken. I am not really sure but I feel like if I start removing them my system will break. Did you manage to remove them successfully? What kind of packages were causing you trouble? – topless Oct 18 '13 at 12:28
  • 2
    I had to remove the same. The "good" versions came back when the upgrade completed. My upgrade was a success. – DaShaun Oct 18 '13 at 19:18
  • 1
    I am having the same issues with the xserver-xorg-video-* packages. How did you remove them? sudo apt-get remove xserver-xorg-video-*? I have a question here with more details. – modulitos May 01 '14 at 18:12
  • 3
    That is exactly what I did 'sudo apt-get remove xserver-xorg-video-*' – DaShaun May 02 '14 at 16:22
  • 3
    For me this was shoing about 25 broken packages, many of which looked like system packages. Jake's answer, on the other hand, showed a single misbehaving package. After uninstalling it, I could upgrade without problems. – Zoltán Jun 01 '14 at 19:52
  • 1
    Note that you may not have to remove all of the broken packages to upgrade. Most of my broken packages were variations of gnuplot. So I used aptitude search gnuplot to see which I had installed (it was gnuplot-x11) and I purged it. Running update-manager after that listed an updated gnuplot package which I then installed. Running update-manager again, I got a complaint about texmaker. Again, used aptitude to search which texmaker package I had installed and then removed it. Ran update-manager again and this time I could start the upgrade process without errors. – Dennis Nov 02 '14 at 16:39
  • 19
    grep Broken grep Broken /var/log/dist-upgrade/apt.log gives me 700+ rows. Definitely can't remove them all. – pasha.zhukov Aug 03 '16 at 18:25
  • It can also help looking at the end of the log, sometimes a broken package keeps trying to install based on a non broken package. It happened with postgresql trying to install postgresql-9.x-postgis, and the scripts. This had some weird gdal dependency inconsistency whith libgdal and libspatialite, which keep uninstalling and installing the deps needed. – Efren Dec 07 '16 at 00:56
  • For me it was boost and ROS packages that were causing the issues. Removed them and now my system is upgrading like normal. – VarunAgrawal Feb 01 '17 at 19:03
  • 2
    It's definitely NOT necessary to remove everything that shows as broken with this method. I only had to remove libopenblas and wine1.8 to get the upgrade to move forward. Even when the upgrade starts working you will see "Broken" entries in the apt.log. – David Baucum Dec 22 '18 at 04:07
  • I only had to remove python2.7-minimal. – Malachi Bazar Feb 22 '21 at 17:10
  • This is the wrong answer; Simply grepping for "Broken" finds hundreds of critical system packages which cannot be removed. Jake's answer is the correct one. – MRule Nov 14 '21 at 12:24
  • I removed packages gnome-shell and ubuntu-desktop from the Broken list. This was enough to get the do-release-upgrade -d going. – rosch Nov 29 '21 at 15:01
  • 1
    I started to remove them one by one, and then suddently the command: sudo do-release-upgrade was not found. Looks like the ubuntu upgrade depends on python?? – Nathan B Nov 20 '22 at 07:20
47

After your system fails to upgrade, check the file /var/log/dist-upgrade/main.log

I found the line:

2013-10-17 15:00:30,543 ERROR Dist-upgrade failed: 'The package 'xubuntu-desktop' is marked for removal but it is in the removal blacklist.'

I manually removed xubuntu-desktop. The upgrade then continued without issue.

Alvar
  • 17,058
Jake
  • 571
  • 2
    Is there any way I keep this package and still update? I have postgresql-9.2 and I dont want to remove it. – Abdulsattar Mohammed Oct 23 '13 at 06:42
  • 1
    you could just re-install it after the upgrade is complete. – ImaginaryRobots Oct 25 '13 at 16:52
  • After i had removed the only ERROR present i got a 2nd different ERROR when running do-release-upgrade again so had to manually remove this one as well. You might have to do this a number of times if you are unlucky enough. It is also possible that one of the other methods might have also highlighted these like hold or broken but I did not try them. – northern-bradley Mar 08 '16 at 10:09
  • Postgres seemed to be the thing that was holding me back. Thanks for pointing that out @AbdulsattarMohammed ! – jocull Apr 13 '16 at 16:18
6

Similar issue here. Last few lines in the "main.log" file indicated in the previous post were:

2013-10-17 23:44:38,233 DEBUG blacklist expr 'unity$' matches 'unity'
2013-10-17 23:44:38,233 DEBUG The package 'unity' is marked for removal but it's in the removal blacklist
2013-10-17 23:44:43,585 ERROR Dist-upgrade failed: 'The package 'unity' is marked for removal but it is in the removal blacklist.'
2013-10-17 23:44:43,586 DEBUG abort called
2013-10-17 23:44:43,592 DEBUG openCache()
2013-10-17 23:44:43,592 DEBUG failed to SystemUnLock() (E:Not locked) 
2013-10-17 23:44:46,786 DEBUG /openCache(), new cache size 41453
2013-10-17 23:44:46,786 DEBUG enabling apt cron job

Manually de-installed unity and upgrade now proceeds. Not quite sure what causes this issue in the first place and whether this is truly a good "solution" but I guess I'll find out after the update is completed?!?

kiri
  • 28,246
  • 16
  • 81
  • 118
4

In my case, the problem was caused by a package that was in hold state. Putting it back to install state resolved the problem.


A possible way to put or remove a package in hold state is using dpkg. First, you get the current state of all packages, and put it into a file:

dpkg --get-selections > myselection

Then, you edit the file and replace install by hold, or vice-versa. Finally, you set the new selection:

sudo dpkg --set-selections < myselection
sudo apt-get update
sudo apt-get upgrade

Other ways are described in How to hold a package back from being upgraded?

4

If you are using the proprietary AMD/ATI fglrx video drivers, removing the fglrx packages and the xorg video driver will likely fix it:

sudo apt-get remove fglrx fglrx-amdcccle-updates
sudo apt-get remove xserver-xorg-video-ati:amd64

In my case, I had the fglrx drivers installed from the xorg-edgers PPA, and removing those packages cleared up my upgrade. Once the upgrade is complete, you can go through the process of setting up the proprietary drivers again.

2

I had the same issue but was easily overcome by running the following in terminal:

sudo apt-get remove
sudo apt-get autoremove
seyDoggy
  • 131
2

Apparently there is a easy way, just add /raring to each package name, like this:

sudo apt-get install dropbox/raring google-chrome-stable/raring google-talkplugin/raring libdrm-intel1/raring libdrm-nouveau2/raring libdrm-radeon1/raring libdrm2/raring libegl1-mesa/raring libegl1-mesa-drivers/raring libgbm1/raring libgl1-mesa-dri/raring libgl1-mesa-glx/raring libglapi-mesa/raring libllvm3.3/raring libopenvg1-mesa/raring libxatracker1/raring nodejsnvidia-persistencednvidia-settings-331/raring simplescreenrecorder/raring sublime-text/raring vokoscreen/raring xserver-common/raring xserver-xorg-core/raring xserver-xorg-input-synaptics/raring xserver-xorg-video-ati/raring xserver-xorg-video-cirrus/raring xserver-xorg-video-intel/raring xserver-xorg-video-mach64/raring xserver-xorg-video-nouveau/raring xserver-xorg-video-r128/raring xserver-xorg-video-radeon/raring xserver-xorg-video-vmware/raring

If it doesn't work, then try the method below.


That was expected, you have several packages that are not from the Ubuntu repositories that are critical for the installation. You should downgrade them, one by one (I haven't found a efficient way to do this) and then attempt the upgrade. I will make one as example:

$ apt-cache policy libdrm2
libdrm2:
  Installed: 2.4.43-0ubuntu1.1
  Candidate: 2.4.43-0ubuntu1.1
  Version table:
 *** 2.4.43-0ubuntu1.1 0
        100 /var/lib/dpkg/status
     2.4.43-0ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ raring/main amd64 Packages

In your case, something like this should appear. You should take note of the version that has a url, in this case 2.4.43-0ubuntu1 that has http://archive.ubuntu.com/ubuntu/, save the pair for later in a text file using the format <package>=<version>.

If you see something like:

fluxgui:
  Installed: 1.1.8
  Candidate: 1.1.8
  Version table:
 *** 1.1.8 0
        100 /var/lib/dpkg/status

notice that doesn't have a url, then that package can be removed:

sudo apt-get remove fluxgui

Then you finish your list should looks like:

libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1

(again and example, but you might be have an idea)

Once you have your list complete, type sudo apt-get -f install and paste your complete list, so it should looks like:

sudo apt-get -f install libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1 libdrm2=2.4.43-0ubuntu1

If you want to do it somewhat faster, you could use apt-cache policy libdrm2 libgbm1 with several package names.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • well the first approach didn't resolve the issue, today I will have some time to go through the one by one steps you suggest. It would be nice to provide the command though for reverting the first changes since now it cannot actually apt-get update. – topless Oct 30 '13 at 10:41
  • @topless if the first command fail, it means that nothing was done. If apt-get update doesn't work, it means another thing. – Braiam Oct 30 '13 at 12:24
  • on apt-get update I get this kind of errors N: Ignoring file 'xorg-edgers-ppa-raring.list.disable' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension – topless Oct 30 '13 at 14:02
  • That's an info/warning, can be ignored, and is expected since we don't want PPA's in the way. – Braiam Oct 30 '13 at 14:07
  • I will include "an eficient way" of removing packages "one-by-one" in my answer below. Its just a collection of all the tips i have got from all over the place. – nyxee Aug 16 '17 at 12:31
2

I followed several of the answers above, attempting to get the upgrade to work, none of the ones not involving deleting Broken packages worked. I had 144 Broken packages, which seemed completely impractical. I deleted them one at a time, attempting the update after each one. After deleting 3 (perl-base,gnuplot, gnuplot-11), chosen essentially at random, the update succeeded. (14.04 to 16.04).

rdl
  • 81
0

Regarding this answer, which works for me, a bit better variant exists: I've found automated script to remove Broken packages if there are too many. Solution found here.

remove.sh script:

#!/bin/bash
apt update
apt upgrade
cat /var/log/dist-upgrade/apt.log | egrep -o "^Broken\s[a-z:\.0-9-]*" | sed 's/Broken //' | sed 's/:amd64//' > packages.txt
sort -u packages.txt > packages_sorted.txt
while read line; do
        apt remove -y $line 
done < packages_sorted.txt
apt autoremove -y && sudo apt autoclean -y
echo "Done"
apt install -f
dpkg --configure -a

Run:

sudo ./remove.sh

then do sudo do-release-upgrade as usual.

if necessary removed packages could be reinstalled from packages_sorted.txt file or in automated manner:

reinstall.sh script:

#!/bin/bash
while read line; do
        apt install -y $line 
done < packages_sorted.txt
echo "Done"
  • P.S. However upgrade was buggy, so was forced to reinstall from USB. – Aleksey Kontsevich Mar 22 '23 at 22:35
  • Unfortunately, for me, this wiped too much. "Broken" packages seemed to me to be safe to remove but unfortunately I went from working to no terminal, editor or right click for reinstall. If you try this, don't close your terminal window. – Squeeto Na Mar 27 '23 at 15:09
-2

I already answered this a while back if you had done a simple search here before posting the question.

sudo mv /etc/apt/sources.list.d/ /etc/apt/sources.list.d.bak; sudo sed -i 's/raring/saucy/g' /etc/apt/sources.list; sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y; sudo apt-get install -f; sudo aptitude upgrade -y; sudo aptitude dist-upgrade -y; sudo mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d; sudo sed -i 's/raring/saucy/g' /etc/apt/sources.list.d/*; sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y; sudo apt-get install ubuntu-desktop -y

Done, resolves all issues

mmstick
  • 1,907
  • 2
    Please, don't just throw this kind of answers. That procedure is potentially dangerous done without care. – Braiam Oct 28 '13 at 10:21
  • Actually no it's not. It's not dangerous at all. The fact that you think it is dangerous means you don't know much about it. I've run it many times in the past and with many people. If you actually read the entire command you can see I have accounted for all possible issues. All the user needs to do is just watch the output of the command. Ubuntu 13.10 has a lot of issues with upgrading, but this fixes everything neatly and conveniently in one long command. I advise you to look into documentation of how 'do-release-upgrade' works, because it is precisely what this command does. – mmstick Oct 28 '13 at 12:49
  • 1
    @mmstick You can elaborate a bit more on your long command and the issues it resolves, as long as the actual problem and how it tackles it. I see that you are calling multiple times apt-get upgrade and the rest of commands, so maybe again you can split it in line by line, and explain your process and why its working. I don't have the luxury to experiment with high risk, irreversible commands. Thanks for the effort though. We are all here to learn.. – topless Oct 28 '13 at 14:52
  • @mmstick, I am looking for your answer, you mentioned a while back and it looks its after my question, so you could have looked a bit better before replying in rude fashion to me and Braiam. – topless Oct 28 '13 at 14:54
  • @topless: No, I have just answered many questions like yours, dating as far back as a week BEFORE 13.10 came out, which your question is not that early. – mmstick Oct 28 '13 at 16:49
  • @topless. It does what it does, changes sources.list to saucy, moves PPAs out because they interfere with upgrades, normal upgrade, distribution upgrade, aptitude upgrade/dist-upgrade/install -f to fix any additional dependencies and resolve errors, puts PPAs back and converts them to saucy, attempts to upgrade with these PPAs, and installs ubuntu-desktop to pull in any new additions to Ubuntu. Simple and easy to understand. You shouldn't downvote an answer you don't properly understand. – mmstick Oct 28 '13 at 16:51
  • 2
    @mmstick don't be lazy edit your answer, to be complete for future reference. Its good that you contributed early but the problem I faced it for first time with 13.10 upgrade. – topless Oct 29 '13 at 11:32
  • So, is this a valid solution? I have numerous broken packages, mostly from libboost-* and xserver-xorg-video-* and I am not sure whether it is sufficient to simply remove these packages and then upgrade. Should I run this script? What does it do? I have my question here. – modulitos May 01 '14 at 18:23
  • It's a perfectly valid solution. It has a 100% success rate, which I can't say the same for the default upgrade script. You may want to make some modifications for your new case, which I shall post. – mmstick May 02 '14 at 19:09