[关闭]
@lniwn 2017-07-04T10:37:49.000000Z 字数 3967 阅读 685

DigitalOcean更新Letsencrypt出错internal compiler error: Killed (program cc1)

博客


手动更新方案

对于一些小型VPS,内存小于512M的,运行letsencrypt-auto -renew命令会报错,如下

  1. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]:
  2. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
  3. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: reading manifest template 'MANIFEST.in'
  4. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: no previously-included directories found matching 'docs/_build'
  5. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: warning: no previously-included files matching '*' found under directory 'vectors'
  6. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
  7. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: running build_ext
  8. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: generating cffi module 'build/temp.linux-x86_64-2.7/_padding.c'
  9. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: creating build/temp.linux-x86_64-2.7
  10. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c'
  11. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'
  12. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: building '_openssl' extension
  13. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: creating build/temp.linux-x86_64-2.7/build
  14. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
  15. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-lMBuS3/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -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
  16. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
  17. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: Please submit a full bug report,
  18. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: with preprocessed source if appropriate.
  19. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
  20. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
  21. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]:
  22. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: ----------------------------------------
  23. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: Command "/root/.local/share/letsencrypt/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-BIXRnF/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
  24. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: ', '
  25. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: '), __file__, 'exec'))" install --record /tmp/pip-5L88MD-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-BIXRnF/cryptography
  26. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: You are using pip version 8.0.3, however version 9.0.1 is available.
  27. Jul 03 17:01:49 oaoa-sgp1 letsencrypt-auto[5462]: You should consider upgrading via the 'pip install --upgrade pip' command.

找了很久,终于在官网找到解决方案:
1.先申请虚拟内存

  1. user@webserver:~$ sudo fallocate -l 1G /tmp/swapfile
  2. user@webserver:~$ sudo chmod 600 /tmp/swapfile
  3. user@webserver:~$ sudo mkswap /tmp/swapfile
  4. user@webserver:~$ sudo swapon /tmp/swapfile

2.更新证书
3.销毁虚拟内存

  1. user@webserver:~$ sudo swapoff /tmp/swapfile
  2. user@webserver:~$ sudo rm /tmp/swapfile

参考页面


自动更新方案

1.安装python-certbot-nginx

  1. $ sudo apt-get update
  2. $ sudo apt-get install software-properties-common
  3. $ sudo add-apt-repository ppa:certbot/certbot
  4. $ sudo apt-get update
  5. $ sudo apt-get install python-certbot-nginx

2.根据提示修改配置文件/etc/letsencrypt/renewal/.conf

  1. post_hook = /bin/run-parts /etc/letsencrypt/post-hook.d/
  2. renew_hook = /bin/run-parts /etc/letsencrypt/renew-hook.d/
  3. pre_hook = /bin/run-parts /etc/letsencrypt/pre-hook.d/

3.测试自动更新是否正常
sudo certbot renew --dry-run

参考页面

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注