Python-samba 导致 apt-get 调用失败

Python-samba 导致 apt-get 调用失败

最近重新启动了我的文件服务器,发现它无法启动。我目前处于3.13.0-62-generic14.04 上以前的内核的恢复模式。

当我运行sudo dpkg --configure -asudo apt-get upgrade或 时sudo apt-get install -f,出现以下错误:

austin@FSERV:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python-samba (2:4.1.6+dfsg-1ubuntu2.14.04.9) ...
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 563, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 545, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 272, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 247, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 237, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 578, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 524, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 408, in _init_posix
    from _sysconfigdata import build_time_vars
  File "/usr/lib/python2.7/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_nd import *
ImportError: No module named _sysconfigdata_nd
dpkg: error processing package python-samba (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of samba-common-bin:
 samba-common-bin depends on python-samba; however:
  Package python-samba is not configured yet.

dpkg: error processing package samba-common-bin (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of samba:
 samba depends on python-samba; however:
  Package python-samba is not configured yet.
 samba depends on samba-common-bin (= 2:4.1.6+dfsg-1ubuntu2.14.04.9); however:
  Package samba-common-bin is not configured yet.

dpkg: error processing package samba (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of winbind:
 winbind depends on samba (= 2:4.1.6+dfsg-1ubuntu2.14.04.9); however:
  Package samba is not configured yet.

dpkg: error processing package winbind (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libnss-winbind:amd64:
 libnss-winbind:amd64 depends on winbind (= 2:4.1.6+dfsg-1ubuntu2.14.04.9); however:
  Package winbind is not configured yet.

dpkg: error processing package libnss-winbind:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libpam-winbind:amd64:
 libpam-winbind:amd64 depends on winbind (= 2:4.1.6+dfsg-1ubuntu2.14.04.9); however:
  Package winbind is not configured yet.

dpkg: error processing package libpam-winbind:amd64 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python-samba
 samba-common-bin
 samba
 winbind
 libnss-winbind:amd64
 libpam-winbind:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
austin@FSERV:~$

我打算重新安装导致启动失败的内核,但由于这个 Python 错误而无法执行。有人可以提供任何见解吗?

答案1

这里的问题是python-samba配置脚本(最终)尝试导入_sysconfigdata_nd模块,但找不到它。

有一个Ubuntu 软件包错误正是这个原因造成的。但那是在 2013 年初,而且您报告说您使用的是 14.04,所以您的软件包应该不会受到影响。

首先运行dpkg -S _sysconfigdata_nd.py以验证此文件是否确实已安装。如果没有,那么您可以尝试重新安装libpython2.7-minimal软件包。如果已安装,请运行python并键入import sys; print sys.path以获取 python 将在其中查找模块的目录列表。我猜那个目录不在_sysconfigdata_nd.py该列表中。

如果不是,您可以尝试提到的错误报告中发布的解决方法之一:sudo ln -s /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py /usr/lib/python2.7/sudo pip install --upgrade virtualenv

您的多架构配置也可能已损坏,但这种情况仅当您在过去某个时候对其进行了修改时才会发生。

相关内容