Debain 8 apt-get "E: The package jre1.8.0-45 needs to be reinstalled"

Lately I've been having some trouble using apt-get using debain 8. when ever I attempt to install packages, I receive the following output...

[email protected]:~$ sudo apt-get install teksyndicate
[sudo] password for michael:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.
[email protected]:~$

I think this may have been the result of purging packages using apt-get, but this was roughly a month ago when the uni semester ended. As for java being installed, the command java -version retunes the following output...

[email protected]:~$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
[email protected]:~$

Thanks in advance for any help
-Michael

Try:
sudo apt-get autoremove
sudo apt-get -f install

and see what it says

The first command returns the same error.

[email protected]:~$ sudo apt-get autoremove
[sudo] password for michael:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.
[email protected]:~$

Run the second and see if it comes back with any dependencies it needs to fix

Still returns the same error.

[email protected]:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.

Try:

su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update

Which should add a repository for java, and then try fixing your dependencies again

Still hasn't made any difference.

[email protected]:~$ su -
Password:
[email protected]:~# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
[email protected]:~# /etc/apt/sources.list.d/webupd8team-java.list
-su: /etc/apt/sources.list.d/webupd8team-java.list: No such file or directory
[email protected]:~# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
[email protected]:~# echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
[email protected]:~# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.PIwpw6fuZg --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyring /etc/apt/trusted.gpg.d/lvillani-i3.gpg --keyring /etc/apt/trusted.gpg.d/pipelight-stable.gpg --keyring /etc/apt/trusted.gpg.d/team-xbmc-ppa.gpg --keyring /etc/apt/trusted.gpg.d/webupd8team-java.gpg --keyring /etc/apt/trusted.gpg.d/webupd8team-y-ppa-manager.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: key EEA14886: "Launchpad VLC" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
[email protected]:~# apt-get update
--
--(UPDATING)
--
E: Some index files failed to download. They have been ignored, or old ones used instead.
[email protected]:~# sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.
[email protected]:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.
[email protected]:~# apt-get install teksyndicate
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.
[email protected]:~#

Before you add the webupd8 PPA make sure you delete your /usr/java folder.

Then purge any remaining files with;

sudo dpkg -r --force-all jdk1.8.0-45

The problem is you broke up single commands into multiple commands, partially my fault for the way that the code block I pasted displayed.

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list <--- That is one command

@thirdmortal is right though, you should clear out the residual files and purge before hand

I've deleted the folder /usr/java folder (please tell me if there is a safer way) and followed up with the command that thirdmortal recomended. but it doesn't appear that apt is finding java with the PPA gived by Raate.

[email protected]:~# rm -rf /usr/java
[email protected]:~# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
[email protected]:~# sudo dpkg -r --force-all jdk1.8.0-45
dpkg: warning: ignoring request to remove jdk1.8.0-45 which isn't installed
[email protected]:~# apt-get install teksyndicate
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.
[email protected]:~#

As Raate advised;

su -

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list

echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886

apt-get update

apt-get install oracle-java8-installer

exit

edit; apologies; thought you were using ubuntu lol.

1 Like

doesn't appear to have made any change

[email protected]:~# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
[email protected]:~# echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
[email protected]:~# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.fRedw05DNN --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyring /etc/apt/trusted.gpg.d/lvillani-i3.gpg --keyring /etc/apt/trusted.gpg.d/pipelight-stable.gpg --keyring /etc/apt/trusted.gpg.d/team-xbmc-ppa.gpg --keyring /etc/apt/trusted.gpg.d/webupd8team-java.gpg --keyring /etc/apt/trusted.gpg.d/webupd8team-y-ppa-manager.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: key EEA14886: "Launchpad VLC" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
[email protected]:~# apt-get update

(UPDATE)

E: Some index files failed to download. They have been ignored, or old ones used instead.
[email protected]:~# apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package jre1.8.0-45 needs to be reinstalled, but I can't find an archive for it.
[email protected]:~#

Try purging again;

sudo dpkg --purge --force-all jdk1.8.0-45

[email protected]:~# sudo dpkg --purge --force-all jdk1.8.0-45
dpkg: warning: ignoring request to remove jdk1.8.0-45 which isn't installed
[email protected]:~#

What's the output of;

java -version

and,

dpkg -l | grep openjdk

[email protected]:~# java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
[email protected]:~# dpkg -l | grep openjdk
ii openjdk-7-jdk:amd64 7u79-2.5.5-1 amd64 OpenJDK Development Kit (JDK)
ii openjdk-7-jre:amd64 7u79-2.5.5-1 amd64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-7-jre-headless:amd64 7u79-2.5.5-1 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
[email protected]:~# ^C
[email protected]:~#

Looks like you have conflicting versions, ie openjdk and oracle.

What is the output of;

dpkg -l | grep oracle-java

[email protected]:~# dpkg -l | grep oracle-java
[email protected]:~#

?!

lol, I would remove everything java related and start again. So remove any PPA's you have in your sources list, ie; /etc/apt/sources.list/

Remove openjdk;

sudo apt-get purge openjdk-7-*

Check java is no longer installed;

java -version

Do an update and search for any obsolete packages;

sudo apt-get update
aptitude search '?obsolete'

Perform some magic;

apt-get --fix-broken aptitude install

Reinstall java.