Can't upgrade from 22.04 to 24.04, complains about held broken packages

Ubuntu Version: 22.04 LTS

Desktop Environment (if applicable):GNOME

Problem Description: I am trying to upgrade the system to 24.04, but it keeps complaining about ubuntu-desktop, ubuntu-gnome-desktop and update-manager. I have tried to uninstall them, reinstall them, but to no avail.

Relevant System Information:

Screenshots or Error Messages: The main.log file shows:

2025-02-11 18:21:15,701 DEBUG Marking 'ubuntu-desktop' for upgrade
2025-02-11 18:21:16,856 WARNING Can't mark 'ubuntu-desktop' for upgrade (E:No es poden corregir els problemes, teniu paquets retinguts que estan trencats.)
2025-02-11 18:21:16,857 DEBUG Marking 'ubuntu-gnome-desktop' for upgrade
2025-02-11 18:21:17,735 WARNING Can't mark 'ubuntu-gnome-desktop' for upgrade (E:No es poden corregir els problemes, teniu paquets retinguts que estan trencats.)
2025-02-11 18:21:17,803 DEBUG denylist expr 'update-manager$' matches 'update-manager'
2025-02-11 18:21:17,804 DEBUG The package 'update-manager' is marked for removal but it's in the removal deny list
2025-02-11 18:21:56,694 ERROR Dist-upgrade failed: 'El paquet «update-manager» estĂ  marcat per a eliminar-lo, perĂČ apareix a la llista negra de fitxers a eliminar.'
2025-02-11 18:21:56,720 DEBUG abort called
2025-02-11 18:21:56,722 DEBUG openCache()

The localized messages mean “Unable to correct problems, you have held broken packages”.

What I’ve Tried: I have tried removing other packages that might cause problems (like non-free Brother drivers), but the result is still the same. I have tried removing both ubuntu-desktop and ubuntu-gnome-desktop, but nothing.


For the record, if I remove ubuntu-desktop and ubuntu-gnome-desktop and retry, main.log shows:

2025-02-11 19:38:21,944 DEBUG none of the '['ubuntu-desktop', 'kubuntu-desktop', 'xubuntu-core', 'xubuntu-desktop', 'ubuntustudio-desktop', 'lubuntu-desktop', 'ubuntu-gnome-desktop', 'ubuntu-mate-core', 'ubuntu-mate-desktop', 'ubuntukylin-desktop', 'ubuntu-budgie-desktop']' meta-pkgs installed
2025-02-11 19:38:21,945 DEBUG guessing 'ubuntu-gnome-desktop' as missing meta-pkg
2025-02-11 19:38:22,949 ERROR failed to mark 'ubuntu-gnome-desktop' for install (E:No es poden corregir els problemes, teniu paquets retinguts que estan trencats.)
2025-02-11 19:38:48,485 DEBUG denylist expr 'update-manager$' matches 'update-manager'
2025-02-11 19:38:48,485 DEBUG The package 'update-manager' is marked for removal but it's in the removal deny list
2025-02-11 19:38:51,115 ERROR Dist-upgrade failed: 'El paquet «update-manager» estĂ  marcat per a eliminar-lo, perĂČ apareix a la llista negra de fitxers a eliminar.'
2025-02-11 19:38:51,146 DEBUG abort called

And dpkg --get-selections | grep hold gives absolutely nothing, and I have done apt update and apt upgrade several times without errors.

You could try the suggestions discussed at the link below to ‘fix broken packages’.

https://www.geeksforgeeks.org/how-to-fix-broken-package-in-ubuntu/

I have already tried those commands, everything seems OK.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

just thinking outload what about?
check /var/log/dist-upgrade/main.log to see what is actually the problem and modify the sudo dpkg – remove & reinstall command example below to the actual package at fault
example

sudo dpkg --remove --force-remove-reinstreq ubuntu-desktop

after completed it might allow you to

sudo do-release-upgrade

and then upgrade might work 
 might not

Please post the COMPLETE output of sudo apt update and of sudo apt upgrade

The thing is I have already removed both packages, but then my second post happens: the installer guesses it’s ubuntu-gnome-desktop and still fails to mark it for update.

Here you are:

joanc@lenovo700:~$ sudo apt upgrade
S'està llegint la llista de paquets
 Fet 
S'està construint l'arbre de dependùncies
 Fet
S'està llegint la informació de l'estat
 Fet  
S'està calculant l'actualització
 Fet
El paquets segĂŒents s'han instal·lat automĂ ticament i ja no sĂłn necessaris:
  cheese libreoffice-draw libreoffice-gnome libreoffice-impress
  libreoffice-pdfimport usb-creator-common usb-creator-gtk
Empreu «sudo apt autoremove» per a suprimir-los.
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  vlc-plugin-qt libvlc5 python2.7-minimal libimage-magick-perl
  python3-jupyter-core vlc-data python3-tornado libvlccore9 libheif1 dcmtk vlc
  imagemagick vlc-bin libopusfile0 libjs-jquery-ui libpathplan4 vlc-l10n
  graphviz libgvpr2 libgvc6 libdcmtk16 libopenexr25 libmagick++-6.q16-8
  python-setuptools python3-scipy libcgraph6 libmagickcore-6.q16-6-extra
  vlc-plugin-samba libcdt5 libimage-magick-q16-perl libmagickwand-6.q16-6
  libpython2.7 vlc-plugin-notify jupyter-core imagemagick-6.q16
  python-pkg-resources libmagickcore-6.q16-6 vlc-plugin-access-extra
  vlc-plugin-skins2 libgsl27 vlc-plugin-video-splitter liblab-gamut1
  imagemagick-6-common vlc-plugin-video-output libgslcblas0 python2.7
  libde265-0 libpython2.7-minimal libpmix2 libvlc-bin libpython2.7-stdlib
  vlc-plugin-base vlc-plugin-visualization
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 actualitzats, 0 nous a instal·lar, 0 a suprimir i 0 no actualitzats.

might work so that you can retry 
 do-release-upgrade but I base that on what you report.

but I would look at /var/log/dist-upgrade/main.log file as it probably would show failed packages

Didn’t work either, same as the gui-based updater.

or even LANG=C sudo apt update, that way nobody needs google translate to read the output :wink:

2 Likes

Update:

joanc@lenovo700:~$ LANG=C sudo apt update
[sudo] password for joanc: 
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:2 http://es.archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://es.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Hit:4 http://es.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:5 http://es.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [753 kB]
Get:6 http://es.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2.316 kB]
Get:7 http://es.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [757 kB]
Get:8 http://es.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1.187 kB]
Fetched 5.270 kB in 2s (2.285 kB/s)                        
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

Upgrade:

joanc@lenovo700:~$ LANG=C sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  cheese libreoffice-draw libreoffice-gnome libreoffice-impress
  libreoffice-pdfimport usb-creator-common usb-creator-gtk
Use 'sudo apt autoremove' to remove them.
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  vlc-plugin-qt libvlc5 python2.7-minimal libimage-magick-perl
  python3-jupyter-core vlc-data python3-tornado libvlccore9 libheif1 dcmtk vlc
  imagemagick vlc-bin libopusfile0 libjs-jquery-ui libpathplan4 vlc-l10n
  graphviz libgvpr2 libgvc6 libdcmtk16 libopenexr25 libmagick++-6.q16-8
  python-setuptools python3-scipy libcgraph6 libmagickcore-6.q16-6-extra
  vlc-plugin-samba libcdt5 libimage-magick-q16-perl libmagickwand-6.q16-6
  libpython2.7 vlc-plugin-notify jupyter-core imagemagick-6.q16
  python-pkg-resources libmagickcore-6.q16-6 vlc-plugin-access-extra
  vlc-plugin-skins2 libgsl27 vlc-plugin-video-splitter liblab-gamut1
  imagemagick-6-common vlc-plugin-video-output libgslcblas0 python2.7
  libde265-0 libpython2.7-minimal libpmix2 libvlc-bin libpython2.7-stdlib
  vlc-plugin-base vlc-plugin-visualization
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 Likes

What is the full output of:

LANG=C sudo apt dist-upgrade

Followed by

LANG=C sudo apt install ubuntu-desktop^

The caret (^) on the end is important.

Please paste the entire output of both. Thanks! :slight_smile:

1 Like

dist-upgrade:

joanc@lenovo700:~$ LANG=C sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  cheese libreoffice-draw libreoffice-gnome libreoffice-impress
  libreoffice-pdfimport usb-creator-common usb-creator-gtk
Use 'sudo apt autoremove' to remove them.
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  vlc-plugin-qt libvlc5 python2.7-minimal libimage-magick-perl
  python3-jupyter-core vlc-data python3-tornado libvlccore9 libheif1 dcmtk vlc
  imagemagick vlc-bin libopusfile0 libjs-jquery-ui libpathplan4 vlc-l10n
  graphviz libgvpr2 libgvc6 libdcmtk16 libopenexr25 libmagick++-6.q16-8
  python-setuptools python3-scipy libcgraph6 libmagickcore-6.q16-6-extra
  vlc-plugin-samba libcdt5 libimage-magick-q16-perl libmagickwand-6.q16-6
  libpython2.7 vlc-plugin-notify jupyter-core imagemagick-6.q16
  python-pkg-resources libmagickcore-6.q16-6 vlc-plugin-access-extra
  vlc-plugin-skins2 libgsl27 vlc-plugin-video-splitter liblab-gamut1
  imagemagick-6-common vlc-plugin-video-output libgslcblas0 python2.7
  libde265-0 libpython2.7-minimal libpmix2 libvlc-bin libpython2.7-stdlib
  vlc-plugin-base vlc-plugin-visualization
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

As for install ubuntu desktop^: the caret does make a difference! Wow. It’s here.

Shall I hit yes?

1 Like

OK, I hit yes, this is the result. Looks promising, I’m going to retry the upgrade.

Update:
Didn’t work. The update manager crashed, but the end of main.log shows the same error again: Unable to correct problems, you have held broken packages

2025-02-11 22:55:29,762 WARNING Can't mark 'ubuntu-desktop' for upgrade (E:No es poden corregir els problemes, teniu paquets retinguts que estan trencats.)
2025-02-11 22:55:29,845 DEBUG denylist expr 'update-manager$' matches 'update-manager'
2025-02-11 22:55:29,845 DEBUG The package 'update-manager' is marked for removal but it's in the removal deny list
1 Like

Ok, we’re getting somewhere. Please try this and paste the output:

apt-cache policy update-manager

Here you are:
joanc@lenovo700:/var/log/dist-upgrade$ LANG=C apt-cache policy update-manager

update-manager:
  Installed: 1:22.04.21
  Candidate: 1:24.04.9
  Version table:
     1:24.04.9 500
        500 http://es.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://es.archive.ubuntu.com/ubuntu noble-updates/main i386 Packages
     1:24.04.6 500
        500 http://es.archive.ubuntu.com/ubuntu noble/main amd64 Packages
        500 http://es.archive.ubuntu.com/ubuntu noble/main i386 Packages
 *** 1:22.04.21 100
        100 /var/lib/dpkg/status

Your apt policy output shows that at some time in past you had 24.04 (noble) apt sources,
and your apt update output shows apparently changed back to 22.04 (jammy) apt sources.

Indeed, that would make exactly the kind of confusing mess you describe.

1 Like

As a matter of fact, I tried to upgrade a couple weeks ago, the process was interrupted and the sources.list file got changed. But I recovered the old one and it seemed that I had recovered integrity. But you’re right, for some reason update-manager didn’t get it.

I would be inclined to fix the sources.list files to have noble and then sudo apt update and sudo apt dist-upgrade (and perhaps also sudo apt install ubuntu-desktop^ to be sure), because as has been observed, you’re half way between 22.04 and 24.04, and the only way to go is forward, not backwards. You cannot use update-manager to do this.