Skip to content

Conversation

@JakubVanek
Copy link
Contributor

@JakubVanek JakubVanek commented May 25, 2020

Related to ev3dev-lang-java/ev3dev-lang-java#728 (comment)

The problem is that the ca-certificates-java package relies on jri-N-ev3 for the java command; however jri-N-ev3 also depends on ca-certificates java.

The proper fix would be to specify a self-dependency as outlined in adoptium/installer#105 (comment). This will probably somehow break the dependency cycle so that jri-N-ev3 is installed first and only then the ca-certificates-java package gets installed.

This is nice, but the installation failure damages the system cacerts file and simple apt install --reinstall is not enough to fix this, instead AFAIK all java packages have to be uninstalled and then reinstalled again.

Let's instead ship the cacerts that ship with other AdoptOpenJDK builds. This will fix cacerts error from the start. If the user wants to use ca-certificates-java, this actually makes it possible to do so -
they just need to install the package after jri-N-ev3 and then symlink /usr/lib/jvm/jri-N-ev3/lib/security/cacerts to /etc/ssl/certs/java/cacerts which is managed by ca-certificates-java.

Nothing is perfect, though. The potential issue with Adopt's CA certificates is that they seem pretty old (~ 3 years). It seems that this is going to change: adoptium/adoptium-support#13 That change will however impact the JDK build script and not the packaging script.

Related to ev3dev-lang-java/ev3dev-lang-java#728 (comment)

The problem is that ca-certificates-java relies on jri-N-ev3
for the java-command; however jri-N-ev3 also depends on
ca-certificates java.

The proper fix would be to specify a self-dependency
as outlined in adoptium/installer#105 (comment) .
This will probably somehow break the dependency cycle
so that jri-N-ev3 is installed first and only then
the ca-certificates-java package gets installed.

This is nice, but the installation failure damages the system cacerts
file and simple --reinstall is *not* enough to fix this,
instead AFAIK all java packages have to be uninstalled and
then reinstalled again.

Let's instead ship the cacerts that ship with other AdoptOpenJDK builds.
This will fix cacerts error from the start. If the user wants to use
ca-certificates-java, this actually makes it possible to do so -
they just need to install the package after jri-N-ev3 and then
symlink /usr/lib/jvm/jri-N-ev3/lib/security/cacerts to
/etc/ssl/certs/java/cacerts which is managed by ca-certificates-java.

Nothing is perfect, though. The potential issue with Adopt's
CA certificates is that they seem pretty old (~ 3 years).
It seems that this is going to change: adoptium/adoptium-support#13
This change will however impact the JDK build script and
not the packaging script.
@jabrena
Copy link
Member

jabrena commented May 25, 2020

I need to understand better the change.
I have few questions about it:

  • Why a JDK doesn´t have any issue but the JRI has an issue with cacerts?
  • If the change is required for the JRI? is later someone install a complete JDK, the user will not hae any side effect?

@JakubVanek
Copy link
Contributor Author

JakubVanek commented May 25, 2020

I need to understand better the change.
I have few questions about it:

  • Why a JDK doesn´t have any issue but the JRI has an issue with cacerts?

This is because JDK is self-contained and so it does not have cacerts symlinked to /etc/ssl/certs/java/cacerts (location on Debian where the cacerts are managed by ca-certificates-java).

  • If the change is required for the JRI? is later someone install a complete JDK, the user will not hae any side effect?

No, there will be no effect from this PR, as the JDK bundles the cacerts that were used when building Java. This change just brings the certificates from JDK to JRI too.

@JakubVanek
Copy link
Contributor Author

I have not included the installation failure, here it is:

root@38e77256607a:/build# apt install ./jri-14-ev3_14.0.0~36-1_armel.deb  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'jri-14-ev3' instead of './jri-14-ev3_14.0.0~36-1_armel.deb'
The following additional packages will be installed:
  ca-certificates-java java-common libavahi-client3 libcups2 libgif7 libnspr4 libnss3
Suggested packages:
  default-jre cups-common
The following NEW packages will be installed:
  ca-certificates-java java-common jri-14-ev3 libavahi-client3 libcups2 libgif7 libnspr4 libnss3
0 upgraded, 8 newly installed, 0 to remove and 14 not upgraded.
Need to get 1441 kB/20.8 MB of archives.
After this operation, 86.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://ftp.debian.org/debian stretch/main armel java-common all 0.58+deb9u1 [13.6 kB]
Get:2 http://ftp.debian.org/debian stretch/main armel libavahi-client3 armel 0.6.32-2 [51.3 kB]
Get:3 http://ftp.debian.org/debian stretch/main armel libcups2 armel 2.2.1-8+deb9u5 [275 kB]
Get:4 http://ftp.debian.org/debian stretch/main armel libgif7 armel 5.1.4-0.4 [40.7 kB]
Get:5 http://ftp.debian.org/debian stretch/main armel libnspr4 armel 2:4.12-6 [96.8 kB]
Get:6 http://ftp.debian.org/debian stretch/main armel libnss3 armel 2:3.26.2-1.1+deb9u1 [949 kB]
Get:7 http://ftp.debian.org/debian stretch/main armel ca-certificates-java all 20170929~deb9u3 [15.1 kB]
Get:8 /build/jri-14-ev3_14.0.0~36-1_armel.deb jri-14-ev3 armel 14.0.0~36-1 [19.3 MB]
Fetched 1441 kB in 1s (803 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package java-common.
(Reading database ... 26775 files and directories currently installed.)
Preparing to unpack .../0-java-common_0.58+deb9u1_all.deb ...
Unpacking java-common (0.58+deb9u1) ...
Selecting previously unselected package libavahi-client3:armel.
Preparing to unpack .../1-libavahi-client3_0.6.32-2_armel.deb ...
Unpacking libavahi-client3:armel (0.6.32-2) ...
Selecting previously unselected package libcups2:armel.
Preparing to unpack .../2-libcups2_2.2.1-8+deb9u5_armel.deb ...
Unpacking libcups2:armel (2.2.1-8+deb9u5) ...
Selecting previously unselected package libgif7:armel.
Preparing to unpack .../3-libgif7_5.1.4-0.4_armel.deb ...
Unpacking libgif7:armel (5.1.4-0.4) ...
Selecting previously unselected package jri-14-ev3:armel.
Preparing to unpack .../4-jri-14-ev3_14.0.0~36-1_armel.deb ...
Unpacking jri-14-ev3:armel (14.0.0~36-1) ...
Selecting previously unselected package libnspr4:armel.
Preparing to unpack .../5-libnspr4_2%3a4.12-6_armel.deb ...
Unpacking libnspr4:armel (2:4.12-6) ...
Selecting previously unselected package libnss3:armel.
Preparing to unpack .../6-libnss3_2%3a3.26.2-1.1+deb9u1_armel.deb ...
Unpacking libnss3:armel (2:3.26.2-1.1+deb9u1) ...
Selecting previously unselected package ca-certificates-java.
Preparing to unpack .../7-ca-certificates-java_20170929~deb9u3_all.deb ...
Unpacking ca-certificates-java (20170929~deb9u3) ...
Setting up java-common (0.58+deb9u1) ...
Setting up libgif7:armel (5.1.4-0.4) ...
Setting up libnspr4:armel (2:4.12-6) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libavahi-client3:armel (0.6.32-2) ...
Processing triggers for ca-certificates (20161130+nmu1+deb9u1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Setting up libcups2:armel (2.2.1-8+deb9u5) ...
Setting up libnss3:armel (2:3.26.2-1.1+deb9u1) ...
Setting up ca-certificates-java (20170929~deb9u3) ...
/var/lib/dpkg/info/ca-certificates-java.postinst: line 56: java: command not found
dpkg: error processing package ca-certificates-java (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of jri-14-ev3:armel:
 jri-14-ev3:armel depends on ca-certificates-java; however:
  Package ca-certificates-java is not configured yet.

dpkg: error processing package jri-14-ev3:armel (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for ca-certificates (20161130+nmu1+deb9u1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

/etc/ca-certificates/update.d/jks-keystore: 90: /etc/ca-certificates/update.d/jks-keystore: java: not found
E: /etc/ca-certificates/update.d/jks-keystore exited with code 1.
done.
Errors were encountered while processing:
 ca-certificates-java
 jri-14-ev3:armel
E: Sub-process /usr/bin/dpkg returned an error code (1)

The "fix" does not really work, as the trust store is corrupted:

root@38e77256607a:/build# apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up jri-14-ev3:armel (14.0.0~36-1) ...
update-alternatives: using /usr/lib/jvm/jri-14-ev3/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/jri-14-ev3/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
update-alternatives: using /usr/lib/jvm/jri-14-ev3/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/jri-14-ev3/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/jri-14-ev3/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/jri-14-ev3/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/jri-14-ev3/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
Setting up ca-certificates-java (20170929~deb9u3) ...
Adding debian:ACCVRAIZ1.pem
Adding debian:AC_RAIZ_FNMT-RCM.pem
Adding debian:AC_Raíz_Certicámara_S.A..pem
Adding debian:Actalis_Authentication_Root_CA.pem
Adding debian:AddTrust_External_Root.pem
Adding debian:AddTrust_Low-Value_Services_Root.pem
Adding debian:AffirmTrust_Commercial.pem
Adding debian:AffirmTrust_Networking.pem
Adding debian:AffirmTrust_Premium.pem
Adding debian:AffirmTrust_Premium_ECC.pem
Adding debian:Amazon_Root_CA_1.pem
Adding debian:Amazon_Root_CA_2.pem
Adding debian:Amazon_Root_CA_3.pem
Adding debian:Amazon_Root_CA_4.pem
Adding debian:Atos_TrustedRoot_2011.pem
Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
Adding debian:Baltimore_CyberTrust_Root.pem
Adding debian:Buypass_Class_2_Root_CA.pem
Adding debian:Buypass_Class_3_Root_CA.pem
Adding debian:CA_Disig_Root_R2.pem
Adding debian:CFCA_EV_ROOT.pem
Adding debian:COMODO_Certification_Authority.pem
Adding debian:COMODO_ECC_Certification_Authority.pem
Adding debian:COMODO_RSA_Certification_Authority.pem
Adding debian:Camerfirma_Chambers_of_Commerce_Root.pem
Adding debian:Camerfirma_Global_Chambersign_Root.pem
Adding debian:Certigna.pem
Adding debian:Certinomis_-_Root_CA.pem
Adding debian:Certplus_Class_2_Primary_CA.pem
Adding debian:Certplus_Root_CA_G1.pem
Adding debian:Certplus_Root_CA_G2.pem
Adding debian:Certum_Root_CA.pem
Adding debian:Certum_Trusted_Network_CA.pem
Adding debian:Certum_Trusted_Network_CA_2.pem
Adding debian:Chambers_of_Commerce_Root_-_2008.pem
Adding debian:ComSign_CA.pem
Adding debian:Comodo_AAA_Services_root.pem
Adding debian:Cybertrust_Global_Root.pem
Adding debian:D-TRUST_Root_CA_3_2013.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem
Adding debian:DST_Root_CA_X3.pem
Adding debian:Deutsche_Telekom_Root_CA_2.pem
Adding debian:DigiCert_Assured_ID_Root_CA.pem
Adding debian:DigiCert_Assured_ID_Root_G2.pem
Adding debian:DigiCert_Assured_ID_Root_G3.pem
Adding debian:DigiCert_Global_Root_CA.pem
Adding debian:DigiCert_Global_Root_G2.pem
Adding debian:DigiCert_Global_Root_G3.pem
Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem
Adding debian:DigiCert_Trusted_Root_G4.pem
Adding debian:E-Tugra_Certification_Authority.pem
Adding debian:EC-ACC.pem
Adding debian:EE_Certification_Centre_Root_CA.pem
Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem
Adding debian:Entrust_Root_Certification_Authority.pem
Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem
Adding debian:Entrust_Root_Certification_Authority_-_G2.pem
Adding debian:GDCA_TrustAUTH_R5_ROOT.pem
Adding debian:GeoTrust_Global_CA.pem
Adding debian:GeoTrust_Primary_Certification_Authority.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G3.pem
Adding debian:GeoTrust_Universal_CA.pem
Adding debian:GeoTrust_Universal_CA_2.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem
Adding debian:GlobalSign_Root_CA.pem
Adding debian:GlobalSign_Root_CA_-_R2.pem
Adding debian:GlobalSign_Root_CA_-_R3.pem
Adding debian:Global_Chambersign_Root_-_2008.pem
Adding debian:Go_Daddy_Class_2_CA.pem
Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_ECC_RootCA_2015.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2015.pem
Adding debian:Hongkong_Post_Root_CA_1.pem
Adding debian:ISRG_Root_X1.pem
Adding debian:IdenTrust_Commercial_Root_CA_1.pem
Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem
Adding debian:Izenpe.com.pem
Adding debian:LuxTrust_Global_Root_2.pem
Adding debian:Microsec_e-Szigno_Root_CA_2009.pem
Adding debian:NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem
Adding debian:Network_Solutions_Certificate_Authority.pem
Adding debian:OISTE_WISeKey_Global_Root_GA_CA.pem
Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem
Adding debian:OpenTrust_Root_CA_G1.pem
Adding debian:OpenTrust_Root_CA_G2.pem
Adding debian:OpenTrust_Root_CA_G3.pem
Adding debian:QuoVadis_Root_CA.pem
Adding debian:QuoVadis_Root_CA_1_G3.pem
Adding debian:QuoVadis_Root_CA_2.pem
Adding debian:QuoVadis_Root_CA_2_G3.pem
Adding debian:QuoVadis_Root_CA_3.pem
Adding debian:QuoVadis_Root_CA_3_G3.pem
Adding debian:S-TRUST_Universal_Root_CA.pem
Adding debian:SSL.com_EV_Root_Certification_Authority_ECC.pem
Adding debian:SSL.com_EV_Root_Certification_Authority_RSA_R2.pem
Adding debian:SSL.com_Root_Certification_Authority_ECC.pem
Adding debian:SSL.com_Root_Certification_Authority_RSA.pem
Adding debian:SZAFIR_ROOT_CA2.pem
Adding debian:SecureSign_RootCA11.pem
Adding debian:SecureTrust_CA.pem
Adding debian:Secure_Global_CA.pem
Adding debian:Security_Communication_RootCA2.pem
Adding debian:Security_Communication_Root_CA.pem
Adding debian:Sonera_Class_2_Root_CA.pem
Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G2.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem
Adding debian:Starfield_Class_2_CA.pem
Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem
Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem
Adding debian:SwissSign_Gold_CA_-_G2.pem
Adding debian:SwissSign_Platinum_CA_-_G2.pem
Adding debian:SwissSign_Silver_CA_-_G2.pem
Adding debian:Swisscom_Root_CA_2.pem
Adding debian:Symantec_Class_1_Public_Primary_Certification_Authority_-_G4.pem
Adding debian:Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem
Adding debian:Symantec_Class_2_Public_Primary_Certification_Authority_-_G4.pem
Adding debian:Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem
Adding debian:T-TeleSec_GlobalRoot_Class_2.pem
Adding debian:T-TeleSec_GlobalRoot_Class_3.pem
Adding debian:TC_TrustCenter_Class_3_CA_II.pem
Adding debian:TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem
Adding debian:TWCA_Global_Root_CA.pem
Adding debian:TWCA_Root_Certification_Authority.pem
Adding debian:Taiwan_GRCA.pem
Adding debian:TeliaSonera_Root_CA_v1.pem
Adding debian:TrustCor_ECA-1.pem
Adding debian:TrustCor_RootCert_CA-1.pem
Adding debian:TrustCor_RootCert_CA-2.pem
Adding debian:Trustis_FPS_Root_CA.pem
Adding debian:TÜRKTRUST_Elektronik_Sertifika_Hizmet_Sağlayıcısı_H5.pem
Adding debian:USERTrust_ECC_Certification_Authority.pem
Adding debian:USERTrust_RSA_Certification_Authority.pem
Adding debian:UTN_USERFirst_Email_Root_CA.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
Adding debian:VeriSign_Universal_Root_Certification_Authority.pem
Adding debian:Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:Visa_eCommerce_Root.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:thawte_Primary_Root_CA.pem
Adding debian:thawte_Primary_Root_CA_-_G2.pem
Adding debian:thawte_Primary_Root_CA_-_G3.pem
done.
Processing triggers for ca-certificates (20161130+nmu1+deb9u1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
W: APT had planned for dpkg to do more than it reported back (3 vs 7).
   Affected packages: ca-certificates-java:armel

CA certificate database corruption can be discovered by running this command:

root@38e77256607a:/build# file /etc/ssl/certs/java/cacerts 
/etc/ssl/certs/java/cacerts: data

Compared to

kuba@oggy-kuba:~$ file /etc/ssl/certs/java/cacerts 
/etc/ssl/certs/java/cacerts: Java KeyStore

@jabrena
Copy link
Member

jabrena commented May 25, 2020

I am going to read in detail the comments, tomorow, I will approve it.

@jabrena
Copy link
Member

jabrena commented May 25, 2020

Note: Good engineering research :)

@JakubVanek
Copy link
Contributor Author

I have created an alternative fix for the issue: #64. However it has its issues too.

@jabrena
Copy link
Member

jabrena commented May 25, 2020

Wait, tomorrow we will discuss. 2 CPUS process better the issues.

@JakubVanek
Copy link
Contributor Author

Continuing in ev3dev-lang-java/ev3dev-lang-java#731

@jabrena
Copy link
Member

jabrena commented May 26, 2020

Hi @JakubVanek, what is the value for this particular PR. I observe that the build remove the dependency wit cacerts but later, it is necessary another PR. Why not merge all PR in a unique PR. It could be better to understand the whole picture.

This one is clear: Remove the dependency.

@JakubVanek
Copy link
Contributor Author

Hi @JakubVanek, what is the value for this particular PR. I observe that the build remove the dependency wit cacerts but later, it is necessary another PR. Why not merge all PR in a unique PR. It could be better to understand the whole picture.

Yes, it makes things a little more complicated, but it follows single reponsibility principle.

(another summary: ev3dev-lang-java/ev3dev-lang-java#731 (comment))

#61 and #64 are two different solutions to one problem, #62 is a solution to another problem that we haven't yet experienced but might (outdated cacerts in JDK/JRI tarpkg)

This one is clear: Remove the dependency.

This is not that clear, ev3dev-lang-java/ev3dev-lang-java#731 (comment) lists the pros and cons.

@JakubVanek JakubVanek mentioned this pull request May 28, 2020
@JakubVanek JakubVanek closed this May 28, 2020
@JakubVanek JakubVanek deleted the bugfix/cacerts-from-adopt branch May 28, 2020 20:08
@JakubVanek JakubVanek restored the bugfix/cacerts-from-adopt branch August 24, 2020 09:11
@JakubVanek
Copy link
Contributor Author

reopening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants