Shared-Library

dbus-uuidgen 返回 /usr/local/lib/libdbus-1.so.3 not found

  • May 18, 2017

在我的 Ubuntu 16.04.2 LTS 上,當我執行 dbus-uuidgen 它返回:

dbus-uuidgen:/usr/local/lib/libdbus-1.so.3:找不到版本“LIBDBUS_PRIVATE_1.10.8”(dbus-uuidgen 需要)

文件說它應該:

列印一個憑空捏造的新 uuid。

但我有一個 /usr/local/lib/libdbus-1.so.3 作為到 /usr/local/lib/libdbus-1.so.3.16.4 的連結

這個問題發生在我從源安裝 dbus 和 bluez 並重新啟動系統後,因此某些服務(如登錄服務)無法在啟動時載入,所以我不得不從恢復模式中刪除 dbus 和 bluez 以及某些依賴項(以及 ubuntu-desktop),讓登錄服務啟動並以普通使用者身份登錄,然後重新安裝 dbus。但是現在每當我嘗試使用 apt-get 安裝任何東西時,dbus-uuid 錯誤都會導致安裝停止。我覺得奇怪的是 /var/lib/dbus/machine-id 和 /etc/machine-id 文件在重新啟動時包含一個 ID。我相信這證明 dbus-uuidgen 可以在啟動時工作。

輸出樣本:

$sudo apt-get install bluez
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
 dbus
Suggested packages:
 dbus-user-session | dbus-x11
The following NEW packages will be installed:
 bluez dbus
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,041 kB of archives.
After this operation, 4,767 kB of additional disk space will be used.
Do you want to continue? [Y/n] Get:1 http://ma.archive.ubuntu.com/ubuntu xenial-updates/main amd64 dbus amd64 1.10.6-1ubuntu3.3 [142 kB]
Get:2 http://ma.archive.ubuntu.com/ubuntu xenial/main amd64 bluez amd64 5.37-0ubuntu5 [899 kB]
Fetched 1,041 kB in 2s (383 kB/s)
Selecting previously unselected package dbus.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 270712 files and directories currently installed.)
Preparing to unpack .../dbus_1.10.6-1ubuntu3.3_amd64.deb ...
Unpacking dbus (1.10.6-1ubuntu3.3) ...
Selecting previously unselected package bluez.
Preparing to unpack .../bluez_5.37-0ubuntu5_amd64.deb ...
Unpacking bluez (5.37-0ubuntu5) ...
Processing triggers for systemd (229-4ubuntu17) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for man-db (2.7.5-1) ...
Setting up dbus (1.10.6-1ubuntu3.3) ...
dbus-uuidgen: /usr/local/lib/libdbus-1.so.3: version LIBDBUS_PRIVATE_1.10.18' not found (required by dbus-uuidgen)
dpkg: error processing package dbus (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of bluez:
bluez depends on dbus; however:
 Package dbus is not configured yet.

dpkg: error processing package bluez (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
dbus
bluez

我設法通過以下方式解決了這個問題:

  • 執行dpkg --remove --force-depends libdbus-1-3。刪除 libdbus-1-3 而不刪除其依賴項。
  • 執行make clean以刪除我在嘗試解決問題時安裝的每個 dbus 版本的剩餘部分。
  • 評論我在/etc/apt/sources.list文件中的 deb-src 條目。
  • apt-get clean使用和清理本地儲存庫apt-get autoclean。- 執行apt-get install -f以嘗試修復損壞的依賴項。
  • 並且由於dbus-uuidgen錯誤,使用安裝 dbusapt-get install dbus失敗,我曾經獲取源包,然後手動安裝它,安裝它沒有任何錯誤。現在工作了,並列印了一個字元串。apt-get source``dbus-uuidgen

我不確定是什麼解決了這個問題,但我認為我使用 libdbus-1-3 庫安裝了不同版本的 dbus,該庫僅適用於 dbus 版本 1.10.6-ubun amd64(適用於 ubuntu),看起來就我而言,只有這個版本適用於我的發行版。我相信@Gilles 的解釋更準確。

引用自:https://unix.stackexchange.com/questions/364975