oracle/weblogic-image-tool

Error: invalid in patch location

senthil13 opened this issue · 7 comments

I'm getting below error while creating image tool, could you please check why the error is occurring. I am tryin to build latest wls image with no internet option

cache.dir=/jenkins/wls_img_cache
32097173_12.2.1.3.0=/jenkins/stage/p32097173_12213201001_Generic.zip
jdk_8u271=/jenkins/server-jre-8u271-linux-x64.tar.gz
wls_12.2.1.3.0=/jenkins/stage/fmw_12.2.1.3.0_wls.jar
27774698_12.2.1.3.0=/jenkins/stage/p27774698_122130_Generic.zip
28186730_13.9.4.2.4=/jenkins/stage/p28186730_139424_Generic.zip
29637821_12.2.1.3.0=/jenkins/stage/p29637821_122130_Generic.zip
31961038_12.2.1.3.0=/jenkins/stage/p31961038_122130_Generic.zip

Error logs

[Nov 16, 2020 10:21:07 PM] [INFO]   Deleted the directory "/u01/oracle/.patch_storage/patch_unzip/31961038/files"
[Nov 16, 2020 10:21:07 PM] [INFO]   Deleted the file "/u01/oracle/.patch_storage/patch_unzip/31961038/README.html"
[Nov 16, 2020 10:21:07 PM] [INFO]   Deleted the directory "/u01/oracle/.patch_storage/patch_unzip/31961038"
[Nov 16, 2020 10:21:07 PM] [INFO]   Deleted the directory "/u01/oracle/.patch_storage/patch_unzip"
[Nov 16, 2020 10:21:07 PM] [INFO]   Finishing UtilSession at Mon Nov 16 22:21:07 GMT 2020
[Nov 16, 2020 10:21:07 PM] [INFO]   Log file location: /u01/oracle/cfgtoollogs/opatch/opatch2020-11-16_22-20-49PM_1.log
[Nov 16, 2020 10:21:07 PM] [INFO]   Stack Description: java.lang.RuntimeException: The patch type is invalid in patch location: /u01/oracle/.patch_storage/patch_unzip/6880880/
                                    	at oracle.glcm.opatch.common.impl.PatchFactoryImpl.createPatch(PatchFactoryImpl.java:42)
                                    	at oracle.opatch.opatchutil.CommonAPIUtil.getCommonAPIPatch(CommonAPIUtil.java:80)
                                    	at oracle.opatch.opatchutil.OPatchUtilHelper.validatePatchSubType(OPatchUtilHelper.java:2042)
                                    	at oracle.opatch.opatchutil.OPatchUtilHelper.getPatchesToApply(OPatchUtilHelper.java:911)
                                    	at oracle.opatch.opatchutil.OPatchUtilHelper.getPatchesToApply(OPatchUtilHelper.java:1331)
                                    	at oracle.opatch.opatchutil.NApply.legacy_process(NApply.java:534)
                                    	at oracle.opatch.opatchutil.NApply.legacy_process(NApply.java:368)
                                    	at oracle.opatch.opatchutil.NApply.process(NApply.java:348)
                                    	at oracle.opatch.opatchutil.OUSession.napply(OUSession.java:1105)
                                    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                                    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                                    	at java.lang.reflect.Method.invoke(Method.java:498)
                                    	at oracle.opatch.UtilSession.process(UtilSession.java:355)
                                    	at oracle.opatch.OPatchSession.process(OPatchSession.java:2650)
                                    	at oracle.opatch.OPatch.process(OPatch.java:779)
                                    	at oracle.opatch.OPatch.main(OPatch.java:829)
                                    Caused by: java.lang.RuntimeException: The patch type is invalid in patch location: /u01/oracle/.patch_storage/patch_unzip/6880880/
                                    	... 17 more
                                    Caused by: oracle.glcm.opatch.common.api.PatchNotFoundException: The patch type is invalid in patch location: /u01/oracle/.patch_storage/patch_unzip/6880880/
                                    	... 17 more
Removing intermediate container 398f182a4e93
[SEVERE ] docker command failed with error: The command '/bin/sh -c /u01/oracle/OPatch/opatch napply -silent -oh /u01/oracle -phBaseDir /tmp/imagetool/patches  && test $? -eq 0  && /u01/oracle/OPatch/opatch util cleanup -silent -oh /u01/oracle  || (cat /u01/oracle/cfgtoollogs/opatch/opatch*.log && exit 1)' returned a non-zero code: 1

@senthil13 The patch file for 6880880 seems to be bad. Can you apply the same patch files outside of Docker images on a normal VM or machine? I don't see 6880880 in your list of patch files. Do you know where this is coming from?

Hi Derk, @ddsharpe
Thanks for responding quickly. 6880880 is the opatch patch number, when you exact the optach patch file it will have a folder with 6880880 only.

Archive:  /jenkins/stage/p28186730_139424_Generic.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  07-07-2020 11:03   6880880/
     9603  07-30-2020 03:38   6880880/README.txt
 45879285  07-07-2020 11:03   6880880/opatch_generic.jar
       10  07-07-2020 11:03   6880880/version.txt
---------                     -------
 45888898                     4 files

Also I found one more difference, in older version(1.1.1) when I add opatch patch it will be list like below (patch number and then optach word)

jdk_8u192=/stage/server-jre-8u192-linux-x64.tar.gz
wls_12.2.1.3.0=/stage/fmw_12.2.1.3.0_wls_Disk1_1of1.zip
28186730_opatch=/stage/p28186730_139400_Generic.zip

But in new version(1.9.5) its adding like below.

28186730_13.9.4.2.4=/jenkins/stage/p28186730_139424_Generic.zip

@senthil13 We had to change the naming of the OPatch binary in the local cache due to changes from Oracle's OPatch team in their release numbering. The changes from 1.1.1 to 1.9.x should not play a factor in this case. The patch is still being applied in the same manner, its just the key in the cache changed. The OPatch patch 28186730 should not be applied as a normal patch since its actually an installer that replaces the existing OPatch binaries.

Can you attach the full stdout from the failed run so that I can see what the Dockerfile is trying to do here? And the command that you used to run? Also, it would be good to enable logging for the Image Tool for that same run and attach it as well. In logging.properties, change the top line to include the FileHandler, and change the logging level to FINER (near the middle of the file), the default is INFO.

Hi Derk,
We are running through script, and its failing to complete. When I tried to run from the server (docker machine where the build run) manually (each command)and then, I was able to build the image successfully. Only difference is on successful run after installing the WebLogic and then opatch its passing to the next step of installing other patches.

Success run

OPatch detects the Middleware Home as "/u01/oracle"

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   31961038  27774698  29637821  32097173

Do you want to proceed? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
All checks passed.

Failure Run

OPatch detects the Middleware Home as "/u01/oracle"

Verifying environment and performing prerequisite checks...
�[91mUtilSession failed: The patch type is invalid in patch location: /u01/oracle/.patch_storage/patch_unzip/6880880/
�[0mLog file location: /u01/oracle/cfgtoollogs/opatch/opatch2020-11-17_16-29-12PM_1.log

OPatch failed with error code 73
[Nov 17, 2020 4:29:14 PM] [INFO]    CUP_LOG: Trying to load HomeOperations object
[Nov 17, 2020 4:29:14 PM] [INFO]    CUP_LOG: HomeOperations object created. CUP2.0 is enabled

The command I used for build the script is

imagetool create --fromImage OS_BUILD_NAME --tag WLS_BUILD_NAME --jdkVersion=8u271 --patches 29637821,27774698,31961038,32097173

attaching the build log.
build.log

@senthil13 Thank you. I found the issue. Creating a fix now. You should not include the OPatch patch in the list of --patches, and the code that was supposed to prevent that was incomplete. Omit 28186730 from your list of patches, and it should work fine. The change that I am submitting today will skip the patch when it finds it in the list. If you need to specify a specific OPatch patch, use --opatchBugNumber. But, there is rarely a need to do so. The patch for OPatch that you specified is the default.

In the failed run build.log, I see that you included 28186730 in the list of patches because I see it twice in this list:

[WARNING] No credentials provided, skipping validation of patches
[INFO ] Using patch 32097173_12.2.1.3.0 from cache: /jenkins/stage/p32097173_12213201001_Generic.zip
[INFO ] Using patch 27774698_12.2.1.3.0 from cache: /jenkins/stage/p27774698_122130_Generic.zip
[INFO ] Using patch 28186730_13.9.4.2.4 from cache: /jenkins/stage/p28186730_139424_Generic.zip
[INFO ] Using patch 29637821_12.2.1.3.0 from cache: /jenkins/stage/p29637821_122130_Generic.zip
[INFO ] Using patch 31961038_12.2.1.3.0 from cache: /jenkins/stage/p31961038_122130_Generic.zip
[INFO ] Using patch 28186730_13.9.4.2.4 from cache: /jenkins/stage/p28186730_139424_Generic.zip

If you do not include it in the list of --patches, you should not see the same error. You can also try the branch that I just pushed if you want to test the fix, opatch-patch-detect.

@ddsharpe
I tested by only passing patches not OPATCH patch number it went through fine/success with the automated script.

Success
Patching list - 32097173_12.2.1.3.0,27774698_12.2.1.3.0,29637821_12.2.1.3.0,31961038_12.2.1.3.0

Failure
Patching list - 32097173_12.2.1.3.0,27774698_12.2.1.3.0,28186730_13.9.4.2.4,29637821_12.2.1.3.0,31961038_12.2.1.3.0

How I am getting using earlier in the script is
PATCH_LIST=$(imagetool cache listItems | grep -Eiv "Cache|jdk|wls|opatch" | awk -vORS=, -F'=' '{print $1}' | sed 's/,$/\n/')

now I added in my script
PATCH_LIST=$(imagetool cache listItems | grep -Eiv "Cache|jdk|wls|opatch|28186730" | awk -vORS=, -F'=' '{print $1}' | sed 's/,$/\n/')

Thanks for the help, I will download the new version and test once its merged to the master branch.