Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruyi 0.7.0-beta.20240323 版本 riscv64 二进制在 Fedora38 和 oErv 2309 依赖 openssl-devel #103

Closed
weilinfox opened this issue Mar 25, 2024 · 0 comments
Labels
rt env: riscv64 Issue is seen with the riscv64 distribution
Milestone

Comments

@weilinfox
Copy link
Contributor

RUYI 版本

0.7.0-beta.20240323

问题描述

riscv64 二进制在 Fedora38 和 oErv 2309 依赖 openssl-devel。

在未安装 openssl-devel 时,将载入 openssl-libs 包提供的 /usr/lib64/libcrypto.so.3,出现以下错误

# RUYI_DEBUG=x ./ruyi list
debug: [2024-03-25T11:38:09.982178] __file__ =                         log.py:37
                                    /root/.cache/ruyi/progcache/0.7.0-          
                                    beta.20240323/__main__.py,                  
                                    sys.executable =                            
                                    /root/.cache/ruyi/progcache/0.7.0-          
                                    beta.20240323/python3,                      
                                    __compiled__ =                              
                                    __nuitka_version__(major=2,                 
                                    minor=1, micro=3,                           
                                    releaselevel='release',                     
                                    containing_dir='/root',                     
                                    standalone=True, onefile=True,              
                                    macos_bundle_mode=False,                    
                                    no_asserts=False,                           
                                    no_docstrings=False,                        
                                    no_annotations=False,                       
                                    module=False)                               
debug: [2024-03-25T11:38:10.048084] argv[0] = ./ruyi, self_exe =       log.py:37
                                    /root/ruyi                                  
debug: [2024-03-25T11:38:10.972323] soname libcrypto.so not working:   log.py:37
                                    libcrypto.so: cannot open shared            
                                    object file: No such file or                
                                    directory                                   
debug: [2024-03-25T11:38:11.006466] got defaults from system libcrypto log.py:37
                                    libcrypto.so.3                              
debug: [2024-03-25T11:38:11.027159] X509_get_default_cert_file_env() = log.py:37
                                    SSL_CERT_FILE                               
debug: [2024-03-25T11:38:11.043844] X509_get_default_cert_file() =     log.py:37
                                    /usr/lib/ssl/cert.pem                       
debug: [2024-03-25T11:38:11.061634] X509_get_default_cert_dir_env() =  log.py:37
                                    SSL_CERT_DIR                                
debug: [2024-03-25T11:38:11.076874] X509_get_default_cert_dir() =      log.py:37
                                    /usr/lib/ssl/certs                          
Traceback (most recent call last):
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/__main__.py", line 38, in <module>
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/ruyi/cli/__init__.py", line 283, in main
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/ruyi/cli/__init__.py", line 26, in init_argparse
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/ruyi/device/provision_cli.py", line 12, in <module ruyi.device.provision_cli>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/ruyi/ruyipkg/atom.py", line 6, in <module ruyi.ruyipkg.atom>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/ruyi/ruyipkg/repo.py", line 6, in <module ruyi.ruyipkg.repo>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/pygit2/__init__.py", line 217, in <module pygit2>
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/pygit2/settings.py", line 57, in __init__
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/pygit2/settings.py", line 63, in _initialize_tls_certificate_locations
  File "/root/.cache/ruyi/progcache/0.7.0-beta.20240323/pygit2/settings.py", line 192, in set_ssl_cert_locations
_pygit2.GitError: OpenSSL error: failed to load certificates: error:00000000:lib(0)::reason(0)

安装了 openssl-devel 后 ruyi 将载入由该包提供的 /usr/lib64/libcrypto.so,问题消失

# RUYI_DEBUG=x ./ruyi list                                                                   
debug: [2024-03-25T11:33:18.623534] __file__ =                         log.py:37                                                                                                                                                            
                                    /root/.cache/ruyi/progcache/0.7.0-          
                                    beta.20240323/__main__.py,                  
                                    sys.executable =                                                                  
                                    /root/.cache/ruyi/progcache/0.7.0-                                                                                                                                                                      
                                    beta.20240323/python3,                      
                                    __compiled__ =                                                                                                                                                                                          
                                    __nuitka_version__(major=2,                                                       
                                    minor=1, micro=3,                                                                 
                                    releaselevel='release',                                                           
                                    containing_dir='/root',                                                           
                                    standalone=True, onefile=True,              
                                    macos_bundle_mode=False,                    
                                    no_asserts=False,                           
                                    no_docstrings=False,                                                              
                                    no_annotations=False,                                                             
                                    module=False)                                                                     
debug: [2024-03-25T11:33:18.691850] argv[0] = ./ruyi, self_exe =       log.py:37                                      
                                    /root/ruyi                                  
debug: [2024-03-25T11:33:19.719511] got defaults from system libcrypto log.py:37
                                    libcrypto.so                                                                      
debug: [2024-03-25T11:33:19.740085] X509_get_default_cert_file_env() = log.py:37                                      
                                    SSL_CERT_FILE                                                                     
debug: [2024-03-25T11:33:19.761611] X509_get_default_cert_file() =     log.py:37                                      
                                    /etc/pki/tls/cert.pem                       
debug: [2024-03-25T11:33:19.779413] X509_get_default_cert_dir_env() =  log.py:37
                                    SSL_CERT_DIR                                                                      
debug: [2024-03-25T11:33:19.796047] X509_get_default_cert_dir() =      log.py:37                                      
                                    /etc/pki/tls/certs                                                                
debug: [2024-03-25T11:33:19.818915] get_default_verify_paths() values  log.py:37                                      
                                    differ between bundled and system                                                 
                                    libssl                                                                            
debug: [2024-03-25T11:33:19.839792] bundled:                           log.py:37                                      
                                    DefaultVerifyPaths(cafile=None,                                                   
                                    capath=None,                                                                      
                                    openssl_cafile_env='SSL_CERT_FILE'                                                
                                    ,                                                                                 
                                    openssl_cafile='/usr/lib/ssl/cert.                                                
                                    pem',                                                                             
                                    openssl_capath_env='SSL_CERT_DIR',                                                
                                    openssl_capath='/usr/lib/ssl/certs          
                                    ')                                                                                
debug: [2024-03-25T11:33:19.875354]  system:                           log.py:37                                      
                                    DefaultVerifyPaths(cafile='/etc/pk                                                
                                    i/tls/cert.pem',                                                                                                                                                                                        
                                    capath='/etc/pki/tls/certs',                                                      
Compressing objects: 100% (270/270), done.                                                                            
Total 651 (delta 293), reused 617 (delta 259), pack-reused 0                                                                                                                                                                                
transferring objects ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% 0:00:00                                            
processing deltas    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

而 amd64 架构二进制则不依赖 openssl-devel,可以正常载入 /usr/lib64/libcrypto.so.3

# RUYI_DEBUG=x ./ruyi version
debug: [2024-03-25T03:57:00.072016] __file__ =                         log.py:37
                                    /root/.cache/ruyi/progcache/0.7.0-          
                                    beta.20240323/__main__.py,                  
                                    sys.executable =                            
                                    /root/.cache/ruyi/progcache/0.7.0-          
                                    beta.20240323/python3,                      
                                    __compiled__ =                              
                                    __nuitka_version__(major=2,                 
                                    minor=1, micro=3,                           
                                    releaselevel='release',                     
                                    containing_dir='/root',                     
                                    standalone=True, onefile=True,              
                                    macos_bundle_mode=False,                    
                                    no_asserts=False,                           
                                    no_docstrings=False,                        
                                    no_annotations=False,                       
                                    module=False)                               
debug: [2024-03-25T03:57:00.129102] argv[0] = ./ruyi, self_exe =       log.py:37
                                    /root/ruyi                                  
debug: [2024-03-25T03:57:00.221433] soname libcrypto.so not working:   log.py:37
                                    libcrypto.so: cannot open shared            
                                    object file: No such file or                
                                    directory                                   
debug: [2024-03-25T03:57:00.225723] got defaults from system libcrypto log.py:37
                                    libcrypto.so.3                              
debug: [2024-03-25T03:57:00.227195] X509_get_default_cert_file_env() = log.py:37
                                    SSL_CERT_FILE                               
debug: [2024-03-25T03:57:00.228653] X509_get_default_cert_file() =     log.py:37
                                    /etc/pki/tls/cert.pem                       
debug: [2024-03-25T03:57:00.230192] X509_get_default_cert_dir_env() =  log.py:37
                                    SSL_CERT_DIR                                
debug: [2024-03-25T03:57:00.231624] X509_get_default_cert_dir() =      log.py:37
                                    /etc/pki/tls/certs                          
debug: [2024-03-25T03:57:00.233128] get_default_verify_paths() values  log.py:37
                                    differ between bundled and system           
                                    libssl                                      
debug: [2024-03-25T03:57:00.234958] bundled:                           log.py:37
                                    DefaultVerifyPaths(cafile=None,             
                                    capath=None,                                
                                    openssl_cafile_env='SSL_CERT_FILE'          
                                    ,                                           
                                    openssl_cafile='/usr/lib/ssl/cert.          
                                    pem',                                       
                                    openssl_capath_env='SSL_CERT_DIR',          
                                    openssl_capath='/usr/lib/ssl/certs          
                                    ')                                          
debug: [2024-03-25T03:57:00.237615]  system:                           log.py:37
                                    DefaultVerifyPaths(cafile='/etc/pk          
                                    i/tls/cert.pem',                            
                                    capath='/etc/pki/tls/certs',                
                                    openssl_cafile_env='SSL_CERT_FILE'          
                                    ,                                           
                                    openssl_cafile='/etc/pki/tls/cert.          
                                    pem',                                       
                                    openssl_capath_env='SSL_CERT_DIR',          
                                    openssl_capath='/etc/pki/tls/certs          
                                    ')                                          
debug: [2024-03-25T03:57:00.431820] PyPI-style version of ruyi:        log.py:37
                                    0.7.0b20240323                              
debug: [2024-03-25T03:57:00.433955] epoch 0 pre ('b', 20240323) post   log.py:37
                                    None                                        
debug: [2024-03-25T03:57:00.446496] args=Namespace(func=<compiled_func log.py:37
                                    tion cli_version at                         
                                    0x7f0b1f248d40>)                            
Ruyi 0.7.0-beta.20240323
Copyright (C) 2023 Institute of Software, Chinese Academy of Sciences (ISCAS).
All rights reserved.
License: Apache-2.0 <https://www.apache.org/licenses/LICENSE-2.0>
xen0n added a commit to xen0n/ruyi that referenced this issue Mar 25, 2024
…d paths are not usable

In some cases we apparently dlopen the bundled libcrypto.so.3 (because
the system is not having a libcrypto.so installed), so the paths could
be unreliable and absent on the running system even if they're probed.

Fall back to a list of well-known paths in this case.

Fixes: ruyisdk#103
(cherry picked from commit d697058)
@xen0n xen0n closed this as completed in d697058 Mar 25, 2024
@xen0n xen0n added the rt env: riscv64 Issue is seen with the riscv64 distribution label Mar 25, 2024
@xen0n xen0n added this to the 0.7 milestone Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rt env: riscv64 Issue is seen with the riscv64 distribution
Projects
None yet
Development

No branches or pull requests

2 participants