在全新安装的 13.10 Server 上运行 wicd-curses 时出错

在全新安装的 13.10 Server 上运行 wicd-curses 时出错

在重新安装 13.10 Server 并重建计算机后,尝试运行时出现以下错误wicd-curses

$ wicd-curses 
Can't connect to the daemon, trying to start it automatically...
Traceback (most recent call last):
  File "/usr/share/wicd/curses/wicd-curses.py", line 1043, in <module>
    setup_dbus()
  File "/usr/share/wicd/curses/wicd-curses.py", line 1031, in setup_dbus
    dbus_ifaces = dbusmanager.get_dbus_ifaces()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 36, in get_dbus_ifaces
    return DBUS_MANAGER.get_dbus_ifaces()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 62, in get_dbus_ifaces
    if not self._dbus_ifaces: connect_to_dbus()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 48, in connect_to_dbus
    return DBUS_MANAGER.connect_to_dbus()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 79, in connect_to_dbus
    proxy_obj = self._bus.get_object("org.wicd.daemon", '/org/wicd/daemon')
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.wicd.daemon was not provided by any .service files
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 96, in apport_excepthook
    dbus_service_unknown_analysis(exc_obj, pr)
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 172, in dbus_service_unknown_analysis
    cp = ConfigParser(interpolation=None)
TypeError: __init__() got an unexpected keyword argument 'interpolation'

Original exception was:
Traceback (most recent call last):
  File "/usr/share/wicd/curses/wicd-curses.py", line 1043, in <module>
    setup_dbus()
  File "/usr/share/wicd/curses/wicd-curses.py", line 1031, in setup_dbus
    dbus_ifaces = dbusmanager.get_dbus_ifaces()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 36, in get_dbus_ifaces
    return DBUS_MANAGER.get_dbus_ifaces()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 62, in get_dbus_ifaces
    if not self._dbus_ifaces: connect_to_dbus()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 48, in connect_to_dbus
    return DBUS_MANAGER.connect_to_dbus()
  File "/usr/lib/python2.7/dist-packages/wicd/dbusmanager.py", line 79, in connect_to_dbus
    proxy_obj = self._bus.get_object("org.wicd.daemon", '/org/wicd/daemon')
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.wicd.daemon was not provided by any .service files

看来wicd没有运行。pgrep wicd没有返回结果。

尝试启动失败:

$ sudo /etc/init.d/wicd start
 * Starting Network connection manager wicd          [fail]

如果我尝试直接运行wicd,我会看到:

$ sudo wicd
Traceback (most recent call last):
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 1859, in <module>
    main(sys.argv)
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 1708, in main
    os.symlink(dest, backup_location)
OSError: [Errno 17] File exists

运行wicd -foe会产生相同的输出。

确切的软件包版本是:

python-wicd 1.7.2.4-4.1
wicd-curses 1.7.2.4-4.1
wicd-daemon 1.7.2.4-4.1

/var/log/wicd/目录是空的。


我尝试重新安装:

sudo apt-get remove wicd-curses
sudo apt-get autoremove
sudo rm -rf /etc/wicd
sudo rm -rf /var/log/wicd
sudo reboot now
sudo apt-get install wicd-curses

但这并没有帮助。在安装过程中:

Get:1 http://gb.archive.ubuntu.com/ubuntu/ saucy/main python-gobject all 3.10.0-1ubuntu1 [2,476 B]
Get:2 http://gb.archive.ubuntu.com/ubuntu/ saucy/universe python-wicd all 1.7.2.4-4.1 [39.3 kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu/ saucy/universe wicd-daemon all 1.7.2.4-4.1 [217 kB]
Get:4 http://gb.archive.ubuntu.com/ubuntu/ saucy/universe python-urwid i386 1.1.1-1 [662 kB]
Get:5 http://gb.archive.ubuntu.com/ubuntu/ saucy/main rfkill i386 0.4-2ubuntu1 [9,160 B]
Get:6 http://gb.archive.ubuntu.com/ubuntu/ saucy/universe wicd-curses all 1.7.2.4-4.1 [35.0 kB]
Fetched 964 kB in 0s (1,234 kB/s)      
Preconfiguring packages ...
Selecting previously unselected package python-gobject.
(Reading database ... 60265 files and directories currently installed.)
Unpacking python-gobject (from .../python-gobject_3.10.0-1ubuntu1_all.deb) ...
Selecting previously unselected package python-wicd.
Unpacking python-wicd (from .../python-wicd_1.7.2.4-4.1_all.deb) ...
Selecting previously unselected package wicd-daemon.
Unpacking wicd-daemon (from .../wicd-daemon_1.7.2.4-4.1_all.deb) ...
Selecting previously unselected package python-urwid.
Unpacking python-urwid (from .../python-urwid_1.1.1-1_i386.deb) ...
Selecting previously unselected package rfkill.
Unpacking rfkill (from .../rfkill_0.4-2ubuntu1_i386.deb) ...
Selecting previously unselected package wicd-curses.
Unpacking wicd-curses (from .../wicd-curses_1.7.2.4-4.1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up python-gobject (3.10.0-1ubuntu1) ...
Setting up python-wicd (1.7.2.4-4.1) ...
Setting up wicd-daemon (1.7.2.4-4.1) ...
 * Restarting Network connection manager wicd              [fail] 
Setting up python-urwid (1.1.1-1) ...
Setting up rfkill (0.4-2ubuntu1) ...
Setting up wicd-curses (1.7.2.4-4.1) ...

此后,失败的行为与上面显示的相同。


深入研究 Python 代码可以发现问题出在哪里。从第 1708 行开始/usr/share/wicd/daemon/wicd-daemon.py

# back up resolv.conf before we do anything else
try:
    backup_location = wpath.varlib + 'resolv.conf.orig'
    # don't back up if .orig exists, probably there cause
    # wicd exploded
    if not os.path.exists(backup_location):
        if os.path.islink('/etc/resolv.conf'):
            dest = os.readlink('/etc/resolv.conf')
            os.symlink(dest, backup_location)                  <--- LINE 1708
        else:
            shutil.copy2('/etc/resolv.conf', backup_location)
        os.chmod(backup_location, 0644)
except IOError:
    print 'error backing up resolv.conf'

调试此代码显示

dest            = ../run/resolvconf/resolv.conf
backup_location = /var/lib/wicd/resolv.conf.orig

我尝试更改except块以捕获OSErrorIOError。我现在看到错误消息error backing up resolv.conf,但守护进程似乎无法正常启动。

$ sudo wicd
error backing up resolv.conf
$ echo $?
0
$ ps -ef | grep "wi[c]d"

看起来.pid文件已创建但未被删除。尝试wicd再次运行会出现以下情况:

$ sudo wicd
error backing up resolv.conf
It seems like the daemon is already running.
If it is not, please remove /var/run/wicd/wicd.pid and try again.

它没有运行。ps显示并wicd-curses给出与上述相同的错误。

答案1

最后让它工作了。

似乎有一个已知问题wicd最近的 Ubuntu 版本相关的符号链接到相对路径。

检查链接的状态:

ll /var/lib/wicd/resolv.conf.orig

如果显示无效,请将其删除:

sudo rm /var/lib/wicd/resolv.conf.orig

然后:

sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf

然后我删除了该pid文件:

rm /var/run/wicd/wicd.pid

在我胡乱操作的过程中我丢失了该/etc/wicd/dhclient.conf.template.default文件,因此我将其从另一台计算机复制了过来。

我也更改了/etc/wicd/manager-settings.conf文件,更改debug_mode = Falsedebug_mode = 0因为我在某处读到过这是必需的。

尝试以 root 身份再次启动它:

sudo -i
wicd

最后我终于可以追赶wicd-curses它了。

相关内容