[SC] OpenSCManager FAILED 5:
Access is denied.

Solutions:
This problem is insufficient permissions, but in their own local operation how insufficient permissions, it is very confused, and then search found
The registry
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ System\EnableLUA changed to 0
Change this value to 0 so that you still have real Administration on your own computer
One more thing to note when creating a service using SC Create is that the following parameter, binpath=, must be correct!
Otherwise, the above errors will also occur!
Author Archives: Robins
Android 9 (P) recovery upgrade Map of ‘@/cache/recovery/block.map’ failed problem analysis guide
Adnroid 9 (P) recovery upgrade Map of ‘@/cache/recovery/block. The Map’ failed problem analysis guide font>
Android 9 (P) development adaptation guide series blog directory:
Adnroid 9 (P) recovery upgrade Map of ‘@/cache/recovery/block. The Map’ failed problem analysis guide font>
Android version 9 (P) solve VNDK library: 87. XXX’s ABI has extend CHANGES
; Android 9 (P) is not extended by the SDK API. ; Android 9 (P) is extended to extend Ethernet functions Android 9 (P) ultimate guide to silent installation/uninstallation of App adaptation
introduction font>
since Android 4.4 will join the Android SELinux, this thing although have security but some puzzling problems in the development of often, this to say today is the problem is due to the SELinux rules lead to the Map of ‘@/cache/recovery/block. The Map’ failed cannot upgrade.
note: this section describes the code in the Android platform P high pass 8953 platform.
The 1. Problem disk
with android version upgrade, the upgrade package is more and more big, when upgrading packages should not be stored in the cache partition, can download updates to the data partition, and then from the upgrade data partition, recently from the load data partition upgrade package upgrade, encountered the following error, the error can be after the defeat of the upgrade in the/cache/recovery/last_log view, specific log is as follows: font>
[ 0.000179] __bionic_open_tzdata: couldn't find any tzdata when looking for Asia/Shanghai!
[ 0.000238] Starting recovery (pid 387) on Thu Jan 1 05:28:26 1970
[ 0.001760] recovery filesystem table
[ 0.001783] =========================
[ 0.001789] 0 /vendor ext4 /dev/block/platform/soc/7824900.sdhci/by-name/vendor 0
[ 0.001794] 1/ext4 /dev/block/bootdevice/by-name/system 0
[ 0.001799] 2 /cache ext4 /dev/block/bootdevice/by-name/cache 0
[ 0.001804] 3 /vendor ext4 /dev/block/bootdevice/by-name/vendor 0
[ 0.001809] 4 /data ext4 /dev/block/bootdevice/by-name/userdata 0
[ 0.001814] 5 /sdcard vfat /dev/block/mmcblk1p1 0
[ 0.001819] 6 /boot emmc /dev/block/bootdevice/by-name/boot 0
[ 0.001823] 7 /recovery emmc /dev/block/bootdevice/by-name/recovery 0
[ 0.001828] 8 /misc emmc /dev/block/bootdevice/by-name/misc 0
[ 0.001833] 9 /tmp ramdisk ramdisk 0
[ 0.001837]
[ 0.003088] I:Boot command: boot-recovery
[ 0.003104] I:Got 3 arguments from boot message
[ 0.047245] locale is [zh-CN]
[ 0.047297] stage is []
[ 0.047321] reason is [(null)]
[ 0.047981] W:Failed to read max brightness: No such file or directory
[ 0.048017] I:Screensaver disabled
[ 0.049631] cannot find/open a drm device: No such file or directory
[ 0.050030] fb0 reports (possibly inaccurate):
[ 0.050049] vi.bits_per_pixel = 32
[ 0.050055] vi.red.offset = 0 .length = 8
[ 0.050060] vi.green.offset = 8 .length = 8
[ 0.050065] vi.blue.offset = 16 .length = 8
[ 0.064662] framebuffer: 0 (1920 x 1080)
[ 0.515251] erasing_text: zh (81 x 38 @ 5031)
[ 0.527722] no_command_text: zh (111 x 38 @ 5031)
[ 0.538287] error_text: zh (65 x 38 @ 5031)
[ 0.993697] installing_text: zh (222 x 38 @ 5922)
[ 1.023212] SELinux: Loaded file_contexts
[ 1.023333] Command: "/sbin/recovery" "--update_package=@/cache/recovery/block.map" "--locale=zh-CN"
[ 1.152498] I:Update location: @/cache/recovery/block.map
[ 1.152563] Opening update package...
[ 1.185800] E:Failed to read /cache/recovery/block.map: No such file or directory
[ 1.202350] E:Map of '@/cache/recovery/block.map' failed
[ 1.235591] E:failed to map file
[ 1.280567] W:Failed to read /sys/class/thermal/thermal_zone53/temp: Invalid argument
[ 1.280665] W:Failed to read /sys/class/thermal/thermal_zone52/temp: Invalid argument
[ 1.280730] W:Failed to read /sys/class/thermal/thermal_zone51/temp: Invalid argument
[ 1.280872] W:Failed to read /sys/class/thermal/thermal_zone49/temp: No such device
[ 1.280936] W:Failed to read /sys/class/thermal/thermal_zone48/temp: No such device
[ 1.281001] W:Failed to read /sys/class/thermal/thermal_zone47/temp: No such device
[ 1.281064] W:Failed to read /sys/class/thermal/thermal_zone46/temp: Invalid argument
[ 1.281127] W:Failed to read /sys/class/thermal/thermal_zone45/temp: Invalid argument
[ 1.287659] I:current maximum temperature: 90000
[ 1.287840] I:@/cache/recovery/block.map
[ 1.287866] I:0
[ 1.287889] I:time_total: 0
[ 1.287911] I:retry: 0
[ 1.287933] I:error: 26
[ 1.287955] I:uncrypt_time: 0
[ 1.287977] I:uncrypt_error: 117
[ 1.287999] I:temperature_start: 90000
[ 1.288021] I:temperature_end: 90000
[ 1.288043] I:temperature_max: 90000
[ 1.288065] I:
[ 1.288093] Installation aborted.
[ 1.303354] Mounted /cache/xxx-recovery
[ 1.336868] mkdir /cache/xxx-recovery error[File exists]
[ 1.356593] Recovery install reason=update_package result=fail on Thu Jan 1 05:28:27 1970
[ 1.356622] !
[ 6.421470] I:Saving locale "zh-CN"
where the key information is as follows:
[ 1.185800] E:Failed to read /cache/recovery/block.map: No such file or directory
[ 1.202350] E:Map of '@/cache/recovery/block.map' failed
[ 1.235591] E:failed to map file
: : : :
130|msm8953_64:/cache/recovery # ls -l
total 448
-rw------- 1 root root 277 2020-05-12 17:48 block.map
-rw-r--r-- 1 root root 271 1970-01-02 15:42 last_install
-rw------- 1 system system 368240 1970-01-02 15:42 last_kmsg
-rw------- 1 root root 5 1970-01-02 15:42 last_locale
-rw------- 1 system system 38 2020-05-12 17:47 uncrypt_file
If does not exist, this is the point.
The 2. Solve problem
we trace the log information before restarting to enter recovery, and check it by logcat-b events | grep avc. The log is shown as follows:
[ 1212.869820@3] type=1400 audit(1209.144:3355): avc: denied { setattr } for pid=4433 comm="Thread-3" name="uncrypt_file" dev="mmcblk0p32" ino=13 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_recovery_file:s0 tclass=file permissive=0
[ 1212.885402@3] type=1400 audit(1212.820:3356): avc: denied { getattr } for pid=4501 comm="uncrypt" path="/data/cache" dev="mmcblk0p65" ino=19 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=dir permissive=0
[ 1212.906032@2] watchdogd: watchdogd started (interval 10, margin 20)!
[ 1212.906143@2] watchdogd: Failed to open /dev/watchdog: No such file or directory
it is obvious from the logs that the SELinux permission issue was encountered while working with /data and /cache partitions. (mmcblk0p32 and mmcblk0p65 correspond to cache and data partition respectively), the corresponding relation can be inquired under the terminal by the following way:
130|msm8953_64:/dev/block/by-name # ls -l | grep cache
lrwxrwxrwx 1 root root 21 1970-01-01 08:00 cache -> /dev/block/mmcblk0p32
msm8953_64:/dev/block/by-name # ls -l | grep data
lrwxrwxrwx 1 root root 21 1970-01-01 08:00 userdata -> /dev/block/mmcblk0p65
msm8953_64:/dev/block/by-name #
found the root point of the problem, we only need to give the corresponding SELinux authority for the upgraded application and recovery, but the SELinux authority encountered above did not continue, we need to know all the required SELinux authority, then we set SELinux as permissive state, and then upgrade again, we observe the log status:
[ 98.295965@1] type=1400 audit(84.812:43): avc: denied { open } for pid=2890 comm="HwBinder:2890_1" path="/sys/module/tvin_hdmirx/parameters/en_4k_2_2k" dev="sysfs" ino=6874 scontext=u:r:system_control:s0 tcontext=u:object_r:sysfs_cec:s0 tclass=file permissive=1
[ 98.313718@1] type=1400 audit(98.244:44): avc: denied { remove_name } for pid=4076 comm="Thread-4" name="update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_file:s0 tclass=dir permissive=1
[ 98.333696@1] type=1400 audit(98.244:44): avc: denied { remove_name } for pid=4076 comm="Thread-4" name="update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_file:s0 tclass=dir permissive=1
[ 98.353378@1] type=1400 audit(98.244:45): avc: denied { unlink } for pid=4076 comm="Thread-4" name="update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 98.373096@1] type=1400 audit(98.244:45): avc: denied { unlink } for pid=4076 comm="Thread-4" name="update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 98.392458@1] type=1400 audit(98.304:46): avc: denied { read } for pid=4076 comm="Thread-4" path="/data/cache/update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 98.618368@2] success set parent gpu_p1_composite rate to 500000000
[ 99.302385@1] success set parent gpu_p0_composite rate to 400000000
[ 100.074360@1] success set parent gpu_p1_composite rate to 285714285
[ 101.234329@3] success set parent gpu_p0_composite rate to 125000000
[ 101.344037@0] aml_snd_card_tv aml_snd_tv: I2S playback disable
[ 101.344244@0] aml_snd_card_tv aml_snd_tv: IEC958 playback disable
[ 120.075238@1] type=1400 audit(98.304:46): avc: denied { read } for pid=4076 comm="Thread-4" path="/data/cache/update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 120.090346@1] type=1400 audit(120.024:47): avc: denied { setattr } for pid=4076 comm="Thread-4" name="uncrypt_file" dev="mmcblk0p32" ino=13 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_recovery_file:s0 tclass=file permissive=1
[ 121.326417@0] success set parent gpu_p1_composite rate to 666666666
[ 121.734307@0] success set parent gpu_p0_composite rate to 500000000
[ 121.897440@1] BT_RADIO going: off
[ 121.897470@1] BCM_BT: going OFF
[ 122.342361@2] success set parent gpu_p1_composite rate to 400000000
[ 123.438484@0] success set parent gpu_p0_composite rate to 285714285
[ 123.556904@1] type=1400 audit(120.024:47): avc: denied { setattr } for pid=4076 comm="Thread-4" name="uncrypt_file" dev="mmcblk0p32" ino=13 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_recovery_file:s0 tclass=file permissive=1
[ 123.572107@1] type=1400 audit(123.508:48): avc: denied { getattr } for pid=4211 comm="uncrypt" path="/data/cache" dev="mmcblk0p65" ino=19 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=dir permissive=1
[ 123.591568@1] type=1400 audit(123.508:48): avc: denied { getattr } for pid=4211 comm="uncrypt" path="/data/cache" dev="mmcblk0p65" ino=19 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=dir permissive=1
[ 123.610598@1] type=1400 audit(123.508:49): avc: denied { getattr } for pid=4211 comm="uncrypt" path="/data/cache/update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 123.631453@1] type=1400 audit(123.508:49): avc: denied { getattr } for pid=4211 comm="uncrypt" path="/data/cache/update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 123.652217@1] type=1400 audit(123.512:50): avc: denied { read } for pid=4211 comm="uncrypt" name="update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 123.672583@1] type=1400 audit(123.512:50): avc: denied { read } for pid=4211 comm="uncrypt" name="update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 123.689809@1] type=1400 audit(123.512:51): avc: denied { open } for pid=4211 comm="uncrypt" path="/data/cache/update.zip" dev="mmcblk0p65" ino=316 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=file permissive=1
[ 124.950389@3] success set parent gpu_p1_composite rate to 125000000
this is easy, add the corresponding rules of SELinux, about the study of SELinux you can refer to the blog Android SELinux development guide , here is not to do too much detail about the rules of SELinux, attached modified git commit record:
diff --git a/device/qcom/sepolicy/private/xxxdroid_share_file.te b/device/qcom/sepolicy/private/xxxdroid_share_file.te
index ea24edb..72f043d 100755
--- a/device/qcom/sepolicy/private/xxxdroid_share_file.te
+++ b/device/qcom/sepolicy/private/xxxdroid_share_file.te
@@ -31,5 +31,11 @@ allow PortPlugInit11 xxxdroid_share_file:file { create write setattr relabelfrom
allow { auth_bpadownload posprintupdate} xxxdroid_share_file:dir { open search write create add_name remove_name setattr relabelfrom relabelto append unlink link rename getattr};
allow { auth_bpadownload posprintupdate} xxxdroid_share_file:file { create write setattr relabelfrom relabelto append rename open getattr read lock };
-allow {zygote bluetooth} xxxdroid_share_file:file {rw_file_perms};
-allow {zygote bluetooth} xxxdroid_share_file:dir {rw_dir_perms};
+allow {zygote bluetooth uncrypt} xxxdroid_share_file:file {rw_file_perms};
+allow {zygote bluetooth uncrypt} xxxdroid_share_file:dir {rw_dir_perms};
+
+allow system_app cache_file:dir { search add_name remove_name write };
+allow system_app cache_file:file { create getattr open write unlink read };
+
+allow uncrypt cache_file:dir getattr;
+allow uncrypt cache_file:file { open read getattr };
where xxxdroid_share_file.te is the policy file we added. If the child boots really encounter this problem, please add the policy according to the actual situation. Now that you have compiled the policy file, try again. Take a look at the success record of recovery. Check it in /cache/recovery/last_log. It’s too much.
[ 0.000181] __bionic_open_tzdata: couldn't find any tzdata when looking for Asia/Shanghai!
[ 0.000238] Starting recovery (pid 383) on Fri Jan 2 07:41:18 1970
[ 0.001824] recovery filesystem table
[ 0.001851] =========================
[ 0.001857] 0 /vendor ext4 /dev/block/platform/soc/7824900.sdhci/by-name/vendor 0
[ 0.001862] 1/ext4 /dev/block/bootdevice/by-name/system 0
[ 0.001867] 2 /cache ext4 /dev/block/bootdevice/by-name/cache 0
[ 0.001872] 3 /vendor ext4 /dev/block/bootdevice/by-name/vendor 0
[ 0.001877] 4 /data ext4 /dev/block/bootdevice/by-name/userdata 0
[ 0.001882] 5 /sdcard vfat /dev/block/mmcblk1p1 0
[ 0.001886] 6 /boot emmc /dev/block/bootdevice/by-name/boot 0
[ 0.001891] 7 /recovery emmc /dev/block/bootdevice/by-name/recovery 0
[ 0.001896] 8 /misc emmc /dev/block/bootdevice/by-name/misc 0
[ 0.001901] 9 /tmp ramdisk ramdisk 0
[ 0.001905]
[ 0.003103] I:Boot command: boot-recovery
[ 0.003121] I:Got 3 arguments from boot message
[ 0.057346] locale is [zh-CN]
[ 0.057379] stage is []
[ 0.057385] reason is [(null)]
[ 0.057390] W:Failed to read max brightness: No such file or directory
[ 0.057395] I:Screensaver disabled
[ 0.058859] cannot find/open a drm device: No such file or directory
[ 0.059139] fb0 reports (possibly inaccurate):
[ 0.059150] vi.bits_per_pixel = 32
[ 0.059156] vi.red.offset = 0 .length = 8
[ 0.059161] vi.green.offset = 8 .length = 8
[ 0.059166] vi.blue.offset = 16 .length = 8
[ 0.072937] framebuffer: 0 (1920 x 1080)
[ 0.521428] erasing_text: zh (81 x 38 @ 5031)
[ 0.533880] no_command_text: zh (111 x 38 @ 5031)
[ 0.544223] error_text: zh (65 x 38 @ 5031)
[ 0.998365] installing_text: zh (222 x 38 @ 5922)
[ 1.029506] SELinux: Loaded file_contexts
[ 1.029631] Command: "/sbin/recovery" "--update_package=@/cache/recovery/block.map" "--locale=zh-CN"
[ 88.676745] wrote 129279 blocks; expected 129279
[ 88.676811] stashed 0 blocks
[ 88.676840] max alloc needed was 4096
[ 88.676930] deleting stash 34a21d3b3dc53f7084ea0b7f275c179b3062f9be
[ 90.216571] Patching firmware images...
[ 90.217492] prepare_partitions: Preparing for primary partition update
[ 90.217700] 'apdp' partition not backup - skip safe update
[ 90.217744] 'keystore' partition not backup - skip safe update
[ 90.217795] 'msadp' partition not backup - skip safe update
[ 90.217825] 'mdtp' partition not backup - skip safe update
[ 90.217860] 'dsp' partition not backup - skip safe update
[ 90.375081] prepare_partitions: Preparing for backup partition update
[ 90.543922] prepare_partitions: Finalizing partitions
[ 90.601289]
[ 90.854443] W:Failed to read /sys/class/thermal/thermal_zone53/temp: Invalid argument
[ 90.854541] W:Failed to read /sys/class/thermal/thermal_zone52/temp: Invalid argument
[ 90.854606] W:Failed to read /sys/class/thermal/thermal_zone51/temp: Invalid argument
[ 90.854752] W:Failed to read /sys/class/thermal/thermal_zone49/temp: No such device
[ 90.854818] W:Failed to read /sys/class/thermal/thermal_zone48/temp: No such device
[ 90.854883] W:Failed to read /sys/class/thermal/thermal_zone47/temp: No such device
[ 90.854946] W:Failed to read /sys/class/thermal/thermal_zone46/temp: Invalid argument
[ 90.855009] W:Failed to read /sys/class/thermal/thermal_zone45/temp: Invalid argument
[ 90.861607] I:current maximum temperature: 90277
[ 90.861798] I:@/cache/recovery/block.map
[ 90.861823] I:1
[ 90.861846] I:time_total: 89
[ 90.861868] I:retry: 0
[ 90.861890] I:target_build: 57
[ 90.861913] I:bytes_written_system: 1574789120
[ 90.861935] I:bytes_stashed_system: 0
[ 90.861956] I:bytes_written_vendor: 529526784
[ 90.861978] I:bytes_stashed_vendor: 0
[ 90.862000] I:uncrypt_time: 20
[ 90.862022] I:temperature_start: 90555
[ 90.862043] I:temperature_end: 90277
[ 90.862065] I:temperature_max: 90555
[ 90.862087] I:
[ 90.862308] Mounted /cache/xxx-recovery
[ 90.882512] mkdir /cache/xxx-recovery error[File exists]
[ 90.902829] Recovery install reason=update_package result=success on Fri Jan 2 07:42:48 1970
[ 90.902859] !
[ 90.948791] I:Saving locale "zh-CN"
after the successful upgrade /cache/recovery directory structure is as follows:
msm8953_64:/cache/recovery # ls -l
total 448
-rw------- 1 root root 277 2020-05-12 17:48 block.map
-rw-r--r-- 1 root root 271 1970-01-02 15:42 last_install
-rw------- 1 system system 368240 1970-01-02 15:42 last_kmsg
-rw------- 1 root root 5 1970-01-02 15:42 last_locale
-rw-r----- 1 root root 49067 1970-01-02 15:42 last_log
-rw------- 1 system system 38 2020-05-12 17:47 uncrypt_file
epilogue font>
ok, I don’t need to say more about this problem, but if you do encounter this problem, make sure you go through the logcat-b events | grep avc to see the problem and then add the corresponding permissions.
write at the end
readers reader friends, upgrade the Android P recovery Map of ‘@/cache/recovery/block. The Map’ failed problem analysis guide already all finished, not what to say. In the end, readers, if this post is helpful to you, follow up with thumb up, and of course, if there are any mistakes or shortcomings, you can also post them.
Monkey stress test (4)-adb opendir failed, Permission denied solution
The article directories
I. Problem description ii. Occurrence Step III. Solution – switch to root user
I. Problem description
Consult IDE log for more details (Help | Show Log),read failed, socket might closed or timeout,
Error:Read timed out
Consult IDE log for more details (Help | Show Log)
Modify Gradle for version adaptation:


2020.3.20 bluetooth remote control report error:
read failed, socket might closed or timeout, read ret: -1
bt socket closed, read return: -1
This general error will be tried catch, because IO operations are involved, so it is difficult to find without debug.
I don’t know how to solve it after I find it;
My practice, bluetooth transmission do not disconnect operation, no matter how do not love to send such instructions.
The reason for this error is that a Socket of Client or service is closed, so the message cannot be sent or accepted. Since there is a catch, the application will not crash.
python3 ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833) Error
File “/Library/Frameworks/ Versions/3.6/lib/python3.6/urllib/request.py” on line 1318, do_open
encode_chunked = req.has_header(transmit encoded))
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py” on line 1239 in request
self. _send_request(method, url, body, title, encode_chunked)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py” on line 1285 in _send_request
ego. endheaders(body,encode_chunked = encode_chunked)
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/http/client.py” on line 1234 in endheaders
self. _send_output (message_body encode_chunked = encode_chunked)
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/http/client.py” on line 1026 in _send_output
self.send(MSG)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py” on line 964 in send
self.connect ()
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/http/client.py” on line 1400, in connect
server_hostname = server_hostname)
File “/Library/Frameworks/ Versions/3.6/lib/python3.6/ssl.py”, line 407, in wrap_socket
_context = self,_session = session)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py” on line 814 in rest of init__
self.do_handshake ()
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/ssl.py” on line 1068 in do_handshake
self._sslobj.do_handshake ()
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/ssl.py” on line 689 in do_handshake
self._sslobj.do_handshake ()
ssl. certificate validation failure (_ssl.c:833)
python2.7 upgrade to python3 requires ssl checksumming
So you need to introduce the module ssl
Imported ssl
In the urlopen
Context adds ssl._create_unverified_context ()
Just close the ssl check.
url = “https://www.baidu.com” context = ssl._create_unverified_context()get = urllib.request. urlopen(url, context = context).read()
print
However, this approach is not recommended, as it is better not to close the authentication
> from urllib import request
>>> url = 'https://www.baidu.com'
>>> with request.urlopen(url) as f:
... data = f.read()
... print(f.status)
This may not work
Unverify global
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
Then use urllib.urlopen(‘ URL ‘)
How to Fix server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
git config --global http.sslverify false
div>
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
NPM Install errs as follows:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://test.com/scm/saf/test.git
npm ERR!
NPM ERR! fatal: unable to access ‘https://test.com/scm/saf/test.git/’: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
npm ERR!
NPM ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR!/home/test /. NPM/_logs/2020-05-08 T03_03_55_220Z – debug. Log
the reason is that the private certificate is used. After checking the data, the security authentication of the system is shut down.
git config –global http.sslverify “false”
or
export GIT_SSL_NO_VERIFY=1
Reference: https://blog.csdn.net/xunan003/article/details/82190419
How to Fix java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
1. Error as above.
2. Reasons and Solutions:
1) The port number is occupied: kill the process occupying the port number (generally 8080) and release the port; Shut down the Tomcat server completely, or restart the project.
2) Use the following command to check the maximum number of processes allowed on the server: ulimit-u. If this value is set to a lower value, such as 1024, then increase it to 131072 or unrestricted with the following value: ulimit-u 131072 or ulimit-u unrestricted.
3) Client and server, either or both of which are not in the network.
They may not be connected to a LAN or the Internet or any other network, in which case Java will be thrown
The client “java.net.ConnectException:Connection refused” exception.
4) server not running
The server is down but not running. In this case, you will also get java.net.ConnectException: connection refused error. Ping to check if the server is running and listening on the port.
5) server running but not listening port, client trying to connect.
The server is running but listening on a different port. Verify the configuration. If you are working on a large project and have a hierarchical configuration file, it may be the default configuration or some other Settings overwrite your correct Settings.
6) Host port combination is not allowed to use firewall
Almost every corporate network is protected by a firewall. If you are connecting to other corporate networks, such as in any electronic trading system, you need to improve the firewall
Both parties are required to ensure that they allow each other’s IP address and port number. If the firewall is not allowed to connect, will also receive the same java.net.ConnectException:Java connection refused to abnormal in application.
7) Incorrect host port combination.
The host port combination provided is incorrect, or the earlier host port combination on the server side has changed. Check the latest configuration on both the client and server sides.
8) The protocol in the connection string is incorrect
TCP is the basis for many advanced protocols, including HTTP, RMI, and so on. Through the connection string, you need to make sure that you pass the correct protocol that the server expects. For example, if the server is exposed, a service that passes through RMI instead of a connection string should start with RMI: //.
3. My situation:
, my reason is relatively simple, which probably belongs to the 5th, 7th and 8th points above, but the configuration is not correct anyway. I just miswrote the IP address of the server where the database is located.
spring.datasource.url=jdbc:mysql://数据库所在服务器IP:3306/gaei_ms?useUnicode=true&characterEncoding=utf-8&useSSL=false
———————————————————————————————
July 4, 2019:
From the comments:
“The same can happen if all parameters are not added to the comment.”
Join the article, for reference, also very grateful to this friend: ‘Seven.
Reference: https://javarevisited.blogspot.com/2013/02/java-net-ConnectException-Connection-refused.html
ubuntu install mysqlclient error ERROR: Failed building wheel for mysqlclient solution
Under Windows error
This site has been written by many predecessors, go to this site to download the corresponding file installation is good I will not teach fish to swim.
An error under ubuntu
(cai_django) ubuntu@VM-0-2-ubuntu:~$ pip3 install mysqlclient
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting mysqlclient
Downloading http://mirrors.tencentyun.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.ta
|████████████████████████████████| 92kB 711kB/s
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/ubuntu/.virtualenvs/cai_django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jqj_z28, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bd
cwd: /tmp/pip-install-jqj_z28y/mysqlclient/
Complete output (31 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY6m -I/home/ubuntu/.virtualenvs/cai_django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,re-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpyth
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /home/ubuntu/.virtualenvs/cai_django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jqj_zze, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' all-headers /home/ubuntu/.virtualenvs/cai_django/include/site/python3.6/mysqlclient
cwd: /tmp/pip-install-jqj_z28y/mysqlclient/
Complete output (31 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTI3.6m -I/home/ubuntu/.virtualenvs/cai_django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,ux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpy
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/ubuntu/.virtualenvs/cai_django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argvnt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(cternally-managed --compile --install-headers /home/ubuntu/.virtualenvs/cai_django/include/site/python3.6/mysqlclient Check the logs for full com
The key point is ERROR: Failed Building Wheel for MysqlClient
The solution
sudo apt-get install python3 python-dev python3-dev
sudo apt-get install build-essential libssl-dev libffi-dev
sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev
Install it all again
pip3 install mysqlclient
The problem is solved.
Login failed for user ‘IIS APPPOOL\DefaultAppPool’
This problem occurred when I was testing WEBAPP on WIN7.
Application Pool DefaultAppPool Advanced Settings identifies the built-in account LocalSystem
Reproduced in: https://www.cnblogs.com/hubj/archive/2009/11/19/1605997.html
C# SevenZip simple operation
using SevenZip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Test
{
public static class ZipHelper
{
static bool Is64 = (IntPtr.Size == 8);
internal const string Name32 = "7z.dll";
internal const string Name64 = "7z64.dll";
internal const string ZIP_FILE = "index.zip";
static ZipHelper()
{
string name = Is64 ?Name64 : Name32;
SevenZip.SevenZipExtractor.SetLibraryPath(name);
}
public static Stream GetSteamFrom7z(string fileName)
{
var stream = new MemoryStream();
using (var tmp = new SevenZipExtractor(ZIP_FILE))
{
tmp.ExtractFile(fileName, stream);
}
stream.Position = 0;
return stream;
}
}
}
div>
SQL Server SSPI handshake failed Error
Logon Error: 17806, Severity: 20, State: 14.
Logon SSPI handshake with Error code 0x8009030c, State 14 while fading a connection with integrated security; The Connection has been closed. Reason: AcceptSecurityContext failed. The Windows Error code indicates the cause of failure. The logon attempt failed [CLIENT: 192.168.1.3]
Logon Error: 18452, Severity: 14, State: 1.
Logon Login failed. The Login is from an untrusted domain and cannot be used with Windows authentication. [CLIENT: 192.168.1.3]
Second, report the cause of the error
The error message should be related to the domain account. The domain account is not trusted, so Windows authentication cannot be used.
It is commonly seen in 192.168.1.3 that user A was used to connect to the database (the case encountered was the domain account), and then the password of user A was changed, but the old password was still used in 192.168.1.3 to try to connect, resulting in an error in login verification.
In addition, user A’s domain account has been locked, and this error will be reported when logging in.
3. Solutions
Login 192.168.1.3 Server disconnects the previous user A
or
Log in to the database server and kill A user’s connection
reference
http://www.secretgeek.net/boring_sql_one
https://blogs.msdn.microsoft.com/docast/2016/02/11/common-sspi-handshake-failed-errors-and-troubleshooting/