Letsencrypt Certbot error [closed]

2019-09-14 19:58发布

问题:

I'm trying to generate a certificate on a Digital Ocean droplet running Ubuntu 12.04 following this guide: https://certbot.eff.org/#ubuntuother-other

I see the following error:

./certbot-auto certonly

...

Creating virtual environment... 
Installing Python packages...

...

copying src/cryptography/hazmat/backends/commoncrypto/hmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
copying src/cryptography/hazmat/backends/commoncrypto/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
copying src/cryptography/hazmat/backends/commoncrypto/ciphers.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
running egg_info
writing requirements to src/cryptography.egg-info/requires.txt
writing src/cryptography.egg-info/PKG-INFO
writing top-level names to src/cryptography.egg-info/top_level.txt
writing dependency_links to src/cryptography.egg-info/dependency_links.txt
writing entry points to src/cryptography.egg-info/entry_points.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*' found under directory 'vectors'
writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
running build_ext
generating cffi module 'build/temp.linux-x86_64-2.7/_padding.c'
creating build/temp.linux-x86_64-2.7
generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c'
generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'
building '_openssl' extension
creating build/temp.linux-x86_64-2.7/build
creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o
build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
error: command 'gcc' failed with exit status 4

---------------------------------------- 
Command "/root/.local/share/letsencrypt/bin/python2.7 -u -c "import
setuptools,
tokenize;__file__='/tmp/pip-build-7RK5lP/cryptography/setup.py';exec(compile(getattr(tokenize,
'open', open)(__file__).read().replace(' ', ' '), __file__, 'exec'))"
install --record /tmp/pip-sdFAkd-record/install-record.txt
--single-version-externally-managed --compile --install-headers /root/.local/share/letsencrypt/include/site/python2.7/cryptography"
failed with error code 1 in /tmp/pip-build-7RK5lP/cryptography 
You are using pip version 8.0.3, however version 8.1.2 is available. 
You should consider upgrading via the 'pip install --upgrade pip' command.

I have successfully run this on 2 other similar servers with no issues. Any ideas?

Edit

Found related Github issue: https://github.com/certbot/certbot/issues/1081

Appears to be memory related rather than Python. Attempted to stop apache service to free up memory but seeing same error.

回答1:

The servers that I had successfully run certbot on had 2 GB memory, this one only has 512 MB, which seems to be the issue. Added a swap file and certbot runs successfully.

--

Certbot related issue: https://github.com/certbot/certbot/issues/1081

python-cryptography apparently tries to compile a pretty big C binding, and gcc crashes due to lack of free memory.

Used this guide to create swap space: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04