yaobin.wen

Yaobin's Blog

View on GitHub
31 July 2018

How to Debug Debian Package

by yaobin.wen

Use the “Maintainer script flowcharts” to debug the installation scripts.

Debug Debian Package Installation

Today I was trying to use the oracle-java8-installer Debian package to install Java 8 to my Ubuntu 14.04.

Weirdly, the installation succeeded on some machines but failed on some others. The failure was caused by the unauthorized accesss to the target package. The oracle-java8-installer package uses wget to download the Java 8 installation file from Oracle’s official website. Oracle requires the user to agree the license before downloading, which is handled by the oracle-java8-installer. If the user agrees with the license, the installer downloads with the header Cookie: oraclelicense=a to indicate the license acceptance by the user. Then an AuthParam is appended to the URL:

http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz?AuthParam=1533080203_1cd7184c1597c2025098221ab6c8d57a

On those computers that failed, the AuthParam was missing, hence the unauthorized access error. Because the Java 8 installation file was not downloaded successfully, the installation would surely not succeed, either.

To debug this issue, I did the following things:

More About oracle-java8-installer

The installer source code can be found here.

The direct cause of the installation (or downloading) failure was that, on the failed computers, the APT configuration has an http_proxy set and the download from Oracle’s website was not set as “DIRECT”. Once I set it as “DIRECT” download, the Java 8 installation file could be downloaded successfully.

The root cause seems to be the presence of http_proxy, which is usually the apt-cache-ng proxy, caused the AuthParam missing from the URL that wget uses. But I haven’t figured out why that happened.

Tags: Tech