0

I am trying to install openjdk-11-jre-headless or default-jre on my ubuntu machine but no mather what I do I get some error messages while doing it.

" The following packages have unmet dependencies:
 openjdk-11-jre-headless : Depends: initscripts but it is not installable
E: Unable to correct problems, you have held broken packages " 

" The following packages have unmet dependencies:
 default-jre : Depends: default-jre-headless (= 2:1.11-68ubuntu1~18.04.1) but it is not going to be installed
               Depends: openjdk-11-jre but it is not going to be installed
E: Unable to correct problems, you have held broken packages. "

I have tried already these commands to fix the problem but no luck..

  • sudo apt-get update --fix-missing
  • sudo apt-get update
  • sudo apt-get clean
  • sudo apt-get autoremove
  • sudo dpkg reconfigure -a
  • sudo apt install -f

I tried the same thing with aptitude:

  • aptitude install default-jre but no luck...

Any ideas how to fix the " broken package " and dependency issuses?

Detailed system information

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic

Apt-update:

- Hit:1 example/packages/live/example bionic InRelease 
- Hit:2 ee.archive.ubuntu.com/ubuntu bionic InRelease 
- Hit:3 ee.archive.ubuntu.com/ubuntu bionic-updates InRelease 
- Hit:4 ee.archive.ubuntu.com/ubuntu bionic-backports InRelease 
- Hit:5 ee.archive.ubuntu.com/ubuntu bionic-security InRelease 
- Hit:6 ppa.launchpad.net/nginx/stable/ubuntu trusty InRelease 
- Hit:7 ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty InRelease 
- Hit:8 adoptopenjdk.jfrog.io/adoptopenjdk/deb bionic InRelease 
  • take note -example is a valid repo i chose to rename–
Reading package lists... Done Building dependency tree Reading state information... 
Done All packages are up to date.

Screenshot of apt-cache policy:

  • apt-cache policy default-jre
  • apt-cache policy default-jre-headless
  • apt-cache policy openjdk-11-jre

apt-cache-policy-results

10

2 Answers 2

1

The problem was caused:

Some the apt repositories contained outdated repositories not needed for the server and software anymore. They caused conflict.

Removing these repos from /etc/apt/sources.d/ repo.list file:

deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty main

After the removal the installation of default-jre and openjdk-11-headless was successful

-1
dpkg --get-selections | grep "\<hold$

If anything comes back as held fix the hold and try the install again

1
  • Hey. Thanks for helping. I tried to find hold packages but there were none.
    – Gryzto
    Jan 27, 2022 at 12:22

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.