服务器上的 certbot 许久未更新了,就执行了一下更新命令更新一下

# yum update certbot
Resolving Dependencies
--> Running transaction check
---> Package certbot.noarch 0:0.26.1-2.el7 will be updated
---> Package certbot.noarch 0:1.7.0-1.el7 will be an update
--> Processing Dependency: python2-certbot = 1.7.0-1.el7 for package: certbot-1.7.0-1.el7.noarch
--> Running transaction check
---> Package python2-certbot.noarch 0:0.26.1-2.el7 will be updated
---> Package python2-certbot.noarch 0:1.7.0-1.el7 will be an update
--> Processing Dependency: python2-acme >= 1.6.0 for package: python2-certbot-1.7.0-1.el7.noarch
--> Processing Dependency: python2-distro >= 1.0.1 for package: python2-certbot-1.7.0-1.el7.noarch
--> Running transaction check
---> Package python2-acme.noarch 0:0.26.1-1.el7 will be updated
---> Package python2-acme.noarch 0:1.7.0-1.el7 will be an update
---> Package python2-distro.noarch 0:1.2.0-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                                    Arch                              Version                                   Repository                       Size
==============================================================================================================================================================
Updating:
 certbot                                    noarch                            1.7.0-1.el7                               epel                             45 k
Installing for dependencies:
 python2-distro                             noarch                            1.2.0-3.el7                               epel                             29 k
Updating for dependencies:
 python2-acme                               noarch                            1.7.0-1.el7                               epel                             82 k
 python2-certbot                            noarch                            1.7.0-1.el7                               epel                            376 k

Transaction Summary
==============================================================================================================================================================
Install             ( 1 Dependent package)
Upgrade  1 Package  (+2 Dependent packages)

Total download size: 531 k
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/4): certbot-1.7.0-1.el7.noarch.rpm                                                                                                  |  45 kB  00:00:00     
(2/4): python2-acme-1.7.0-1.el7.noarch.rpm                                                                                             |  82 kB  00:00:00     
(3/4): python2-distro-1.2.0-3.el7.noarch.rpm                                                                                           |  29 kB  00:00:00     
(4/4): python2-certbot-1.7.0-1.el7.noarch.rpm                                                                                          | 376 kB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         460 kB/s | 531 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : python2-acme-1.7.0-1.el7.noarch                                                                                                            1/7 
  Installing : python2-distro-1.2.0-3.el7.noarch                                                                                                          2/7 
  Updating   : python2-certbot-1.7.0-1.el7.noarch                                                                                                         3/7 
  Updating   : certbot-1.7.0-1.el7.noarch                                                                                                                 4/7 
  Cleanup    : certbot-0.26.1-2.el7.noarch                                                                                                                5/7 
  Cleanup    : python2-certbot-0.26.1-2.el7.noarch                                                                                                        6/7 
  Cleanup    : python2-acme-0.26.1-1.el7.noarch                                                                                                           7/7 
  Verifying  : certbot-1.7.0-1.el7.noarch                                                                                                                 1/7 
  Verifying  : python2-distro-1.2.0-3.el7.noarch                                                                                                          2/7 
  Verifying  : python2-certbot-1.7.0-1.el7.noarch                                                                                                         3/7 
  Verifying  : python2-acme-1.7.0-1.el7.noarch                                                                                                            4/7 
  Verifying  : python2-acme-0.26.1-1.el7.noarch                                                                                                           5/7 
  Verifying  : certbot-0.26.1-2.el7.noarch                                                                                                                6/7 
  Verifying  : python2-certbot-0.26.1-2.el7.noarch                                                                                                        7/7 

Dependency Installed:
  python2-distro.noarch 0:1.2.0-3.el7                                                                                                                         

Updated:
  certbot.noarch 0:1.7.0-1.el7                                                                                                                                

Dependency Updated:
  python2-acme.noarch 0:1.7.0-1.el7                                            python2-certbot.noarch 0:1.7.0-1.el7                                           

Complete!

检查一下更新后版本,发现运行不了:

# certbot --version
An unexpected error occurred:
ImportError: cannot import name constants
Please see the logfile '/tmp/tmpqWDMiB/log' for more details.

打开 /tmp/tmpqWDMiB/log 看看,发现是 certbot 的 nginx 插件的问题:

2020-09-22 16:32:36,781:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 9, in <module>
    load_entry_point('certbot==1.7.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 15, in main
    return internal_main.main(cli_args)
  File "/usr/lib/python2.7/site-packages/certbot/_internal/main.py", line 1323, in main
    plugins = plugins_disco.PluginsRegistry.find_all()
  File "/usr/lib/python2.7/site-packages/certbot/_internal/plugins/disco.py", line 236, in find_all
    plugin_ep = cls._load_entry_point(entry_point, plugins, with_prefix=False)
  File "/usr/lib/python2.7/site-packages/certbot/_internal/plugins/disco.py", line 251, in _load_entry_point
    plugin_ep = PluginEntryPoint(entry_point, with_prefix)
  File "/usr/lib/python2.7/site-packages/certbot/_internal/plugins/disco.py", line 56, in __init__
    self.plugin_cls = entry_point.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/certbot_nginx/configurator.py", line 17, in <module>
    from certbot import constants as core_constants
ImportError: cannot import name constants
2020-09-22 16:32:36,781:ERROR:certbot._internal.log:An unexpected error occurred:
2020-09-22 16:32:36,781:ERROR:certbot._internal.log:ImportError: cannot import name constants

看看 nginx 插件版本:

# rpm -qa|grep certbot
python2-certbot-nginx-0.26.1-1.el7.noarch
certbot-1.7.0-1.el7.noarch
python2-certbot-1.7.0-1.el7.noarch

原来是 nginx 插件没更新到对应的版本,更新一下:

# yum update python2-certbot-nginx
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel-official: mirrors.tuna.tsinghua.edu.cn
 * ius: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package python2-certbot-nginx.noarch 0:0.26.1-1.el7 will be updated
---> Package python2-certbot-nginx.noarch 0:1.7.0-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                                         Arch                             Version                                Repository                      Size
==============================================================================================================================================================
Updating:
 python2-certbot-nginx                           noarch                           1.7.0-1.el7                            epel                            77 k

Transaction Summary
==============================================================================================================================================================
Upgrade  1 Package

Total download size: 77 k
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
python2-certbot-nginx-1.7.0-1.el7.noarch.rpm                                                                                           |  77 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : python2-certbot-nginx-1.7.0-1.el7.noarch                                                                                                   1/2 
  Cleanup    : python2-certbot-nginx-0.26.1-1.el7.noarch                                                                                                  2/2 
  Verifying  : python2-certbot-nginx-1.7.0-1.el7.noarch                                                                                                   1/2 
  Verifying  : python2-certbot-nginx-0.26.1-1.el7.noarch                                                                                                  2/2 

Updated:
  python2-certbot-nginx.noarch 0:1.7.0-1.el7                                                                                                                  

Complete!

大功告成:

# certbot --version
certbot 1.7.0

标签: none

添加新评论