chroot中的Pip SSLError malloc失败

问题描述 投票:0回答:1

我安装了一个基于debian(linaro)的rootfs.img.raw,它是基于稀疏映像(带有simg2img)创建的,并运行chroot:

$ sudo chroot /mnt/intrinsycimg qemu-aarch64-static /bin/bash

使用qemu模拟ARM64。

在python(3.7.3版)上使用pip(18.1版),我尝试使用它安装随机软件包,但出现以下错误:

root@user:/home/linaro# pip3 install --user progress
qemu: Unsupported syscall: 278
Collecting progress
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Could not find a version that satisfies the requirement progress (from versions: )
No matching distribution found for progress

我尝试根据此--trusted-host添加github issue answer标志,但发生了malloc失败:

root@user:/home/linaro# pip3 install progress --trusted-host pypi.org --trusted-host files.pythonhosted.org
qemu: Unsupported syscall: 278
Collecting progress
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))': /simple/progress/
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
  Could not fetch URL https://pypi.org/simple/progress/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/progress/ (Caused by SSLError(SSLError(336236609, '[SSL] malloc failure (_ssl.c:2994)'))) - skipping
  Could not find a version that satisfies the requirement progress (from versions: )
No matching distribution found for progress

我还尝试将/run/dev/sys/proc(例如sudo mount --rbind /run/ /mnt/linaroimg/run/)挂载为this user suggested,但得到的结果相同。

我的openssl版本是OpenSSL 1.1.1d,但发现有关malloc failure for 1.1.1d的问题,因此,如果我运行相同的命令,则会出现相同的错误:

root@user:/home/linaro# python3 -c 'import urllib.request; urllib.request.urlopen("https://pypi.org")'
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
qemu: Unsupported syscall: 278
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.7/urllib/request.py", line 1285, in do_open
    h = http_class(host, timeout=req.timeout, **http_conn_args)
  File "/usr/lib/python3.7/http/client.py", line 1383, in __init__
    context = ssl._create_default_https_context()
  File "/usr/lib/python3.7/ssl.py", line 565, in create_default_context
    context = SSLContext(PROTOCOL_TLS)
  File "/usr/lib/python3.7/ssl.py", line 388, in __new__
    self = _SSLContext.__new__(cls, protocol)
ssl.SSLError: [SSL] malloc failure (_ssl.c:2994)

我尝试手动编译OpenSSL_1_1_1g版本:

root@user:/home/linaro# openssl version
OpenSSL 1.1.1g  21 Apr 2020 (Library: OpenSSL 1.1.1d  10 Sep 2019)

但最终结果相同。我对Library: OpenSSL 1.1.1d表示怀疑,但是我git克隆了openssl存储库并签出了OpenSSL_1.1.1g标签。我也想避免自己编译openssl,因为我以后更喜欢通过apt更新它。

关于如何解决此问题的任何想法?

pip openssl qemu arm64 chroot
1个回答
0
投票

这里的问题是您使用的是旧版本的QEMU,它在linux用户模式支持中存在已知的错误(特别是多线程来宾程序存在问题)。尝试使用较新的版本(例如QEMU 5.0)应该会使错误消失。

© www.soinside.com 2019 - 2024. All rights reserved.