Problem
I keep getting the error Unable to correct problems, you have held broken packages. when trying to install packages, for example sqlite3 or opam (as well as many other packages, but not all)
sudo apt install sqlite3 mathieu-laptop
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
sqlite3 : Depends: libsqlite3-0 (= 3.45.1-1ubuntu2) but 3.45.1-1ubuntu2.1 is to be installed
E: Unable to correct problems, you have held broken packages.
Same problem for opam:
sudo apt install opam mathieu-laptop
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
bzip2 : Depends: libbz2-1.0 (= 1.0.8-5.1) but 1.0.8-5.1build0.1 is to be installed
E: Unable to correct problems, you have held broken packages.
I've done all the typical fixes I could find, nothing seems to do anything:
mathieu@mathieu-laptop Downloads $ sudo apt update
Hit:1 http://au.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:3 https://download.sublimetext.com apt/stable/ InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
mathieu@mathieu-laptop Downloads $ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
vlc-plugin-qt libvlc5 libzvbi-common vlc-data libvlccore9 vlc
python3-virtualenv vlc-bin vlc-l10n libcjson1 libavdevice60 ffmpeg
libpostproc57 vlc-plugin-samba libavcodec60 libzvbi0t64 vlc-plugin-notify
libavutil58 libswscale7 vlc-plugin-access-extra vlc-plugin-skins2
vlc-plugin-video-splitter libswresample4 vlc-plugin-video-output
libavformat60 libvlc-bin vlc-plugin-base vlc-plugin-visualization
libavfilter9
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mathieu@mathieu-laptop Downloads $ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
vlc-plugin-qt libvlc5 libzvbi-common vlc-data libvlccore9 vlc
python3-virtualenv vlc-bin vlc-l10n libcjson1 libavdevice60 ffmpeg
libpostproc57 vlc-plugin-samba libavcodec60 libzvbi0t64 vlc-plugin-notify
libavutil58 libswscale7 vlc-plugin-access-extra vlc-plugin-skins2
vlc-plugin-video-splitter libswresample4 vlc-plugin-video-output
libavformat60 libvlc-bin vlc-plugin-base vlc-plugin-visualization
libavfilter9
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mathieu@mathieu-laptop Downloads $ sudo apt install -f
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mathieu@mathieu-laptop Downloads $ sudo dpkg --get-selections | grep hold
mathieu@mathieu-laptop Downloads $ apt-mark showhold
mathieu@mathieu-laptop Downloads $
Hypothesis
My best explanation is this: I broke something by installing a package from .deb file using apt (apparently you're not supposed to do that), I then resolved an "held broken packages" error by errors by sudo apt install <dependency-name>=required-version (I forgot which one though), and now my system is in a broken state because it thinks that this dependency is required.
Question
- How can I figure out what's going on?
- Is there an easy way to revert to a sane state? (ie. not as drastic as re-installing ubuntu)
Update
Please edit your question to explain why you disabled or deleted the noble-updates repository, and why you cannot re-enable it
As far as I recall, I didn't ever disable or enable noble-updates. Is it safe to add as is? If yes, I don't have a problem with adding it. From anther answer from the commenter it seems that it was part of default, and this seems to roughly agree
$ apt-policy
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
release v=24.04,o=Ubuntu,a=noble-security,n=noble,l=Ubuntu,c=main,b=amd64
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages
release v=24.04,o=Ubuntu,a=noble-security,n=noble,l=Ubuntu,c=universe,b=amd64
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Packages
release v=24.04,o=Ubuntu,a=noble-security,n=noble,l=Ubuntu,c=multiverse,b=amd64
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Packages
release v=24.04,o=Ubuntu,a=noble-security,n=noble,l=Ubuntu,c=restricted,b=amd64
origin security.ubuntu.com
500 http://au.archive.ubuntu.com/ubuntu noble/multiverse amd64 Packages
release v=24.04,o=Ubuntu,a=noble,n=noble,l=Ubuntu,c=multiverse,b=amd64
origin au.archive.ubuntu.com
500 http://au.archive.ubuntu.com/ubuntu noble/universe amd64 Packages
release v=24.04,o=Ubuntu,a=noble,n=noble,l=Ubuntu,c=universe,b=amd64
origin au.archive.ubuntu.com
500 http://au.archive.ubuntu.com/ubuntu noble/restricted amd64 Packages
release v=24.04,o=Ubuntu,a=noble,n=noble,l=Ubuntu,c=restricted,b=amd64
origin au.archive.ubuntu.com
500 http://au.archive.ubuntu.com/ubuntu noble/main amd64 Packages
release v=24.04,o=Ubuntu,a=noble,n=noble,l=Ubuntu,c=main,b=amd64
origin au.archive.ubuntu.com
500 https://download.sublimetext.com apt/stable/ Packages
release o=Sublime Text,a=apt/stable,l=Sublime Text APT Repository,c=
origin download.sublimetext.com
Pinned packages:
Details
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
$ uname -a mathieu-laptop
Linux mathieu-laptop 6.11.0-24-generic #24~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 25 20:14:34 UTC 2 x86_64 x86_64 x86_64 GNU/Linux