Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've added the oracle-java7-installer ppa to my apt-cacher-ng server and to my clients. I cannot get it to install.

Any ideas on how I can do this? I think it fails when it tries to download the installation from Oracle. This is what happens when I try to install it:

admin@vgjs001:~$ sudo apt-get install oracle-java7-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 x11-common xfonts-encodings xfonts-utils
Suggested packages:
  default-jre equivs binfmt-support visualvm ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-gothic
  ttf-sazanami-gothic ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming firefox firefox-2 iceweasel
  mozilla-firefox iceape-browser mozilla-browser epiphany-gecko epiphany-webkit epiphany-browser galeon midbrowser
  moblin-web-browser xulrunner xulrunner-1.9 konqueror chromium-browser midori google-chrome
The following NEW packages will be installed:
  gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 oracle-java7-installer x11-common xfonts-encodings
  xfonts-utils
0 upgraded, 9 newly installed, 0 to remove and 10 not upgraded.
Need to get 4 269 kB/4 347 kB of archives.
After this operation, 7 548 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
Get:1 "hyperlink-1" "repo-1" gsfonts all 1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1 [3 374 kB]
Get:2 "hyperlink-2" "repo-2"  libfontenc1 amd64 1:1.1.0-1 [15,4 kB]                         
Get:3 "hyperlink-3" "repo-3"  libxfont1 amd64 1:1.4.4-1 [133 kB]                            
Get:4 "hyperlink-4" "repo-4"  x11-common all 1:7.6+12ubuntu1 [57,7 kB]                      
Get:5 "hyperlink-5" "repo-5"  xfonts-encodings all 1:1.0.4-1ubuntu1 [583 kB]                
Get:6 "hyperlink-6" "repo-6"  xfonts-utils amd64 1:7.6+1 [96,4 kB]                          
Get:7 "hyperlink-7" "repo-7"  gsfonts-x11 all 0.22 [9 108 B]                                
Fetched 3 232 kB in 33s (95,1 kB/s)                                                                                   
Preconfiguring packages ...
Selecting previously unselected package java-common.
download failed
Oracle JDK 7 is NOT installed.
dpkg: error processing oracle-java7-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1) ...
Setting up libfontenc1 (1:1.1.0-1) ...
Setting up libxfont1 (1:1.4.4-1) ...
Setting up x11-common (1:7.6+12ubuntu1) ...
Setting up xfonts-encodings (1:1.0.4-1ubuntu1) ...
Setting up xfonts-utils (1:7.6+1) ...
Setting up gsfonts-x11 (0.22) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
share|improve this question
    
I have the same issue... –  Tony Oct 22 '12 at 1:34

4 Answers 4

apt-cacher-ng has a very restrictive URL regex that only allows for some types of packages to be downloaded. The Java package from Oracle doesn't match it. The solution is modifying the config where the regex is defined.

In particular the URL of the package is something like yada-yada.tar.gz?AuthParam=abcdacbd_123123123123, so we have to adjust in consequence.

Basically:

  1. In /etc/apt-cacher-ng/acng.conf, uncomment the line beginning with PfilePattern
  2. Modify it to replace \.tar\.gz with \.tar\.gz(\?AuthParam=.*)?

For reference, the entire line in my config file is:

PfilePattern = .*(\.deb|\.rpm|\.dsc|\.tar\.gz\.gpg|\.tar\.gz(\?AuthParam=.*)?|\.diff\.gz|\.diff\.bz2|\.jigdo|\.template|changelog|copyright|\.udeb|\.diff/.*\.gz|vmlinuz|initrd\.gz|(Devel)?ReleaseAnnouncement(\\?.*)?)$
share|improve this answer
    
This no longer seems to work with Oracle Java 8. –  detly Oct 26 '13 at 22:30
    
...which I suspect is due to the downloader needing to use cookies instead of a query string to download the package. –  detly Oct 26 '13 at 22:44
    
I don't really see an option to deal with this. The easiest way is probably to set up a mirror of the packages that doesn't have this requirement (probably against the EULA) or download them from a computer that doesn't use apt-cacher-ng and importing the packages manually. –  GomoX Nov 1 '13 at 17:39
    
I added a different reply below with a different approach (I kept this one because it should be useful FFR on similar problems). –  GomoX Dec 4 '13 at 19:56

I was just battling with this, here are my findings for Ubuntu 14.04 Trusty Tahr.

The installer uses apt-config to determine which proxy to use. Specifically if Acquire::http::Proxy::download.oracle.dom returns DIRECT to determine whether to use the default proxy of to download directly.

Specifically the install runs

# use apt proxy
APT_PROXIES=$(apt-config shell \
http_proxy Acquire::http::Proxy \
https_proxy Acquire::https::Proxy \
ftp_proxy Acquire::ftp::Proxy \
dl_direct Acquire::http::Proxy::download.oracle.com \
)

And later on

if [ "$dl_direct" = "DIRECT" ]; then
    unset http_proxy
    unset https_proxy
    unset ftp_proxy
fi

If you use the following apt config then the installer with download directly:

Acquire::http::Proxy "http://my.proxy.com:3142";
Acquire::http::Proxy {
        download.oracle.com DIRECT;
};

While this works it is somewhat annoying as the download takes forever and that somewhat defeats the purpose of the proxy.

I found that the installer checks a debconf variable to check whether to use a local file. The property checked is oracle-java8-installer/local and it is a string.

Specifically the installer runs:

db_get oracle-java8-installer/local
if [ -d "$RET" -a -f "$RET"/$FILENAME ]; then

    echo "Installing from local file $RET/$FILENAME"
    cp -f -p "$RET"/$FILENAME ${FILENAME}_TEMP
    mv -f ${FILENAME}_TEMP $FILENAME
else # no local file

So if you have the JDK downloaded and in a directory /jdk/dir then you need to run the following command before running the installer:

sudo debconf-set-selections <<< 'debconf oracle-java8-installer/local string /jdk/dir/'

Note the trailing / on the directory - this is required.

share|improve this answer
    
Thanks for this. I was about half way to working out how to use a local file by reading the postinstall source, but you've saved me working out how to actually set the configuration -- debconf is unusually poorly documented, it seems. I hadn't found "debconf-set-selections", which does at least have a man page; I was trying to figure out how to use "debconf-set", which lacks one entirely. –  Jules May 31 at 5:22

You can use the DIRECT option in the apt preferences to avoid passing through the proxy for the Java packages from Oracle. This is not a perfect solution but should allow your users to install the packages at the expense of extra traffic.

The configuration snippet (for the client computers, not the apt-cacher-ng server) is:

Acquire::http::Proxy {
    *.oracle.com DIRECT;
};

You can put this into a /etc/apt/apt.conf.d/99proxy file to make sure it overrides any previous apt proxy configuration.

share|improve this answer
    
Nope :/ I changed it to *.java.net too, since that's where the script seems to be looking, but no luck. It still sends the request through the proxy. –  detly Dec 5 '13 at 8:27
    
I suspect that the script does some non-apt-ish detection of HTTP proxy settings, but I haven't checked yet. –  detly Dec 5 '13 at 8:32

First you need to remove openjdk for this run the following command from your terminal:

sudo apt-get purge openjdk*

If you installed java 7 from any other PPA and you are having problem with java then you have to do following steps before installing the PPA mentioned here:

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update

Install oracle java 7 in ubuntu 13.04/12.10/12.04 Open the terminal and run the following commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

You can check the java version by searching java in dashboard.

share|improve this answer
    
The question is about installing from this PPA through apt-cacher-ng, which poses extra problems because it acts as a proxy. This doesn't answer the question. –  detly Nov 3 '13 at 0:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.