Getting dependency error when trying to install packages such as vim to noble chroot

Asked by Juozas Pocius

I'm getting dependency conflict when trying to install packages such as vim to Ubuntu Noble chroot. The dependency version it wants is older then what is available in repositories. Running apt-get install vim fails with error as shown below, with workaround inluded near the end of this post:

(chroot) $ sudo apt-get install vim
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:
 vim : Depends: vim-common (= 2:9.1.0016-1ubuntu3) but 2:9.1.0016-1ubuntu6 is to be installed
       Depends: vim-runtime (= 2:9.1.0016-1ubuntu3) but 2:9.1.0016-1ubuntu6 is to be installed
E: Unable to correct problems, you have held broken packages.

Apt-cache policy shows older version of vim available while in launchpad the newer version is shown, also the amd64 package version 2:9.1.0016-1ubuntu6 is missing from repositories, no amd64 deb within repository pool directory of repository files

(chroot) $ apt-cache policy vim
vim:
  Installed: (none)
  Candidate: 2:9.1.0016-1ubuntu3
  Version table:
     2:9.1.0016-1ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages

If vim was installed before, it would be uninstalled by upgrading vim-common and vim-runtime

My sources list file:

(chroot) $ cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu noble main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu noble-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu noble-backports main restricted universe multiverse

Contents of /etc/lsb-release

(chroot) $ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu Noble Numbat (development branch)"

Host is Ubuntu 22.04 LTS, using schroot 1.6.10 to access Ubuntu Noble chroot

Edit: This is caused by broken apt repositories for Ubuntu Noble caused by mitigation of the related cve not yet being completed.
Workaround: Add pinning override to apt config to make noble-updates be more prefered than noble by also allowing downgrade to older version that might be uploaded later than the compromised ones.

To do that, add an apt pinning override, e.g. create a new file in /etc/apt/preferences.d/, where pinning > 1000 means allowing downgrade and installing vim and other packages correctly:

Package: *
Pin: release a=noble-updates
Pin-Priority: 1002

Package: *
Pin: release a=noble
Pin-Priority: 1001

Apt cache policy should return something like this:

Package files:
 100 /var/lib/dpkg/status
     release a=now
1002 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages
     release v=24.04,o=Ubuntu,a=noble-updates,n=noble,l=Ubuntu,c=multiverse,b=amd64
     origin archive.ubuntu.com
1002 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages
     release v=24.04,o=Ubuntu,a=noble-updates,n=noble,l=Ubuntu,c=universe,b=amd64
     origin archive.ubuntu.com
1002 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages
     release v=24.04,o=Ubuntu,a=noble-updates,n=noble,l=Ubuntu,c=restricted,b=amd64
     origin archive.ubuntu.com
1002 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
     release v=24.04,o=Ubuntu,a=noble-updates,n=noble,l=Ubuntu,c=main,b=amd64
     origin archive.ubuntu.com
1001 http://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 archive.ubuntu.com
1001 http://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 archive.ubuntu.com
1001 http://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 archive.ubuntu.com
1001 http://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 archive.ubuntu.com
Pinned packages:

Also don't forget to check for obsolete packages by running apt list ?obsolete and remove them or install an alternative dependency if needed by checking package depends by running apt-cache depends or something alike.

Finaly you can run apt upgrade and apt dist-upgrade then to "downgrade" versions to ones provided by -updates archive.

After package rebuild in repositories complete, repositories cleaned and dependencies resolved (e.g. packages in 'noble' archive are not newer than in 'noble-updates' and all required packages available in 'noble', a.k.a. main archive, no conflicts, etc.) it would be safe to remove file in /etc/apt/preferences.d/ to restore original pinning and upgrade normally.

Edit: added a newline between pinning rules above, w/o gap pinning might not work properly.

Edit2: The noble repositories appear now to fixed as correct dependencies are downloaded when installing it, also bootstrapping the release should work again as long as latest debootstrap version is used, before I could not ever bootstrap minbase w/o an error.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Pramod Gavali (prgavali) said :
#1

Same error for `build-essential`

:~# apt install build-essential
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:
 cpp-13 : Depends: gcc-13-base (= 13.2.0-13ubuntu1) but 13.2.0-16ubuntu1 is to be installed
 cpp-13-x86-64-linux-gnu : Depends: gcc-13-base (= 13.2.0-13ubuntu1) but 13.2.0-16ubuntu1 is to be installed
 g++-13 : Depends: gcc-13-base (= 13.2.0-13ubuntu1) but 13.2.0-16ubuntu1 is to be installed
 g++-13-x86-64-linux-gnu : Depends: gcc-13-base (= 13.2.0-13ubuntu1) but 13.2.0-16ubuntu1 is to be installed
                           Depends: libstdc++-13-dev (= 13.2.0-13ubuntu1) but it is not going to be installed
 gcc-13 : Depends: gcc-13-base (= 13.2.0-13ubuntu1) but 13.2.0-16ubuntu1 is to be installed
 gcc-13-x86-64-linux-gnu : Depends: gcc-13-base (= 13.2.0-13ubuntu1) but 13.2.0-16ubuntu1 is to be installed
                           Depends: libcc1-0 (>= 13.2.0-13ubuntu1) but it is not going to be installed
                           Depends: libgcc-13-dev (= 13.2.0-13ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Revision history for this message
Juozas Pocius (juozaspo) said (last edit ):
#2

By adding workaround in description above, build essential installs fine, but not if it is not include. We need to wait until the packages in the repository are rebuilt so everything would work fine again.

$ sudo apt-get install --no-install-recommends build-essential
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu bzip2 cpp cpp-13 cpp-13-x86-64-linux-gnu cpp-x86-64-linux-gnu dpkg-dev g++ g++-13 g++-13-x86-64-linux-gnu g++-x86-64-linux-gnu gcc gcc-13 gcc-13-base gcc-13-x86-64-linux-gnu gcc-x86-64-linux-gnu libasan8 libatomic1
  libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libgcc-13-dev libgomp1 libgprofng0 libhwasan0 libisl23 libitm1 libjansson4 liblsan0 libmpc3 libmpfr6 libnsl-dev libquadmath0 libsframe1 libstdc++-13-dev libtirpc-dev libtsan2
  libubsan1 linux-libc-dev lto-disabled-list make patch rpcsvc-proto xz-utils
Suggested packages:
  binutils-doc gprofng-gui bzip2-doc cpp-doc gcc-13-locales cpp-13-doc debian-keyring g++-multilib g++-13-multilib gcc-13-doc gcc-multilib manpages-dev autoconf automake libtool flex bison gdb gcc-doc gcc-13-multilib gdb-x86-64-linux-gnu glibc-doc gnupg | sq | sqop
  | pgpainless-cli git bzr libstdc++-13-doc make-doc ed diffutils-doc
Recommended packages:
  fakeroot gnupg | sq | sqop | pgpainless-cli libalgorithm-merge-perl manpages manpages-dev libc-devtools libfile-fcntllock-perl liblocale-gettext-perl
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu build-essential bzip2 cpp cpp-13 cpp-13-x86-64-linux-gnu cpp-x86-64-linux-gnu dpkg-dev g++ g++-13 g++-13-x86-64-linux-gnu g++-x86-64-linux-gnu gcc gcc-13 gcc-13-base gcc-13-x86-64-linux-gnu gcc-x86-64-linux-gnu
  libasan8 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libgcc-13-dev libgomp1 libgprofng0 libhwasan0 libisl23 libitm1 libjansson4 liblsan0 libmpc3 libmpfr6 libnsl-dev libquadmath0 libsframe1 libstdc++-13-dev
  libtirpc-dev libtsan2 libubsan1 linux-libc-dev lto-disabled-list make patch rpcsvc-proto xz-utils
0 upgraded, 52 newly installed, 0 to remove and 0 not upgraded.
Need to get 73.1 MB of archives.
After this operation, 271 MB of additional disk space will be used.
Do you want to continue? [Y/n]
<..etc..>

Revision history for this message
Bernard Stafford (bernard010) said (last edit ):
#3

Ubuntu Noble 24.04 still has 25 bug reports outstanding, 9 of which have fixes released.
Patience until the final release, 04-25-2024.
You can help by making bug reports.
This documents the needed fixes to improve Ubuntu.
Even listing your workaround on the bug report.
https://ubuntu.com/blog/the-keys-to-successful-bug-reporting

Can you help with this problem?

Provide an answer of your own, or ask Juozas Pocius for more information if necessary.

To post a message you must log in.