Ubuntu

libzstd 已刪除,現在 dpkg 或 apt 不再工作

  • January 22, 2021

我無法使用aptdpkg不再執行任何東西。例如,

$ sudo apt install sl
apt: error while loading shared libraries: libzstd.so.1: cannot open shared object file: No such file or directory

我嘗試libzstd通過以下方式手動安裝:

$ wget http://ftp.us.debian.org/debian/pool/main/libz/libzstd/libzstd1_1.4.8+dfsg-1_amd64.deb
$ sudo dpkg -i libzstd1_1.4.8+dfsg-1_amd64.deb
dpkg-deb: error while loading shared libraries: libzstd.so.1: cannot open shared object file: No such file or directory
dpkg: error processing archive libzstd1_1.4.8+dfsg-1_amd64.deb (--install):
dpkg-deb --control subprocess returned error exit status 127
Errors were encountered while processing:
libzstd1_1.4.8+dfsg-1_amd64.deb

這發生在我從私有儲存庫 ( quicksilver-rocksdb) 中解除安裝了一個與libzstd. 我按照/var/log/apt/term.log這裡的建議附上了我這裡的相關部分:https ://bugs.launchpad.net/ubuntu/+source/apt/+bug/1764858 that occurred on running sudo apt remove quicksilver-rocksdb

Log started: 2021-01-21  15:18:07
Selecting previously unselected package libllvm11:amd64.^M
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 274377 files and directories currently installed.)^M
Preparing to unpack .../0-libllvm11_1%3a11.0.0-2~ubuntu20.04.1_amd64.deb ...^M
Unpacking libllvm11:amd64 (1:11.0.0-2~ubuntu20.04.1) ...^M
Preparing to unpack .../1-mesa-vulkan-drivers_20.2.6-0ubuntu0.20.04.1_amd64.deb ...^M
Unpacking mesa-vulkan-drivers:amd64 (20.2.6-0ubuntu0.20.04.1) over (20.0.8-0ubuntu1~20.04.1) ...^M
Preparing to unpack .../2-libxatracker2_20.2.6-0ubuntu0.20.04.1_amd64.deb ...^M
Unpacking libxatracker2:amd64 (20.2.6-0ubuntu0.20.04.1) over (20.0.8-0ubuntu1~20.04.1) ...^M
Preparing to unpack .../3-libgbm1_20.2.6-0ubuntu0.20.04.1_amd64.deb ...^M
Unpacking libgbm1:amd64 (20.2.6-0ubuntu0.20.04.1) over (20.0.8-0ubuntu1~20.04.1) ...^M
Preparing to unpack .../4-libegl-mesa0_20.2.6-0ubuntu0.20.04.1_amd64.deb ...^M
Unpacking libegl-mesa0:amd64 (20.2.6-0ubuntu0.20.04.1) over (20.0.8-0ubuntu1~20.04.1) ...^M
Preparing to unpack .../5-libglx-mesa0_20.2.6-0ubuntu0.20.04.1_amd64.deb ...^M
Unpacking libglx-mesa0:amd64 (20.2.6-0ubuntu0.20.04.1) over (20.0.8-0ubuntu1~20.04.1) ...^M
Preparing to unpack .../6-libglapi-mesa_20.2.6-0ubuntu0.20.04.1_amd64.deb ...^M
Unpacking libglapi-mesa:amd64 (20.2.6-0ubuntu0.20.04.1) over (20.0.8-0ubuntu1~20.04.1) ...^M
Preparing to unpack .../7-libgl1-mesa-dri_20.2.6-0ubuntu0.20.04.1_amd64.deb ...^M
Unpacking libgl1-mesa-dri:amd64 (20.2.6-0ubuntu0.20.04.1) over (20.0.8-0ubuntu1~20.04.1) ...^M
Preparing to unpack .../8-libapt-pkg6.0_2.0.4_amd64.deb ...^M
Unpacking libapt-pkg6.0:amd64 (2.0.4) over (2.0.2ubuntu0.2) ...^M
Setting up libapt-pkg6.0:amd64 (2.0.4) ...^M
^[[1mdpkg:^[[0m quicksilver-rocksdb: dependency problems, but removing anyway as you requested:^M
squashfs-tools depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
mesa-vulkan-drivers:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libxatracker2:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libwireshark13:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libtiff5:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libsereal-encoder-perl depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libsereal-decoder-perl depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libgl1-mesa-dri:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libboost-iostreams1.71.0:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libarchive13:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
libapt-pkg6.0:amd64 depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
dpkg depends on libzstd1 (>= 1.3.2); however:^M
 Package libzstd1 is not installed.^M
 Package quicksilver-rocksdb which provides libzstd1 is to be removed.^M
^M
^M
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 274386 files and directories currently installed.)^M
Removing quicksilver-rocksdb (6.6.4-cloudflare.3-1) ...^M
^[[1mdpkg:^[[0m ^[[1;33mwarning:^[[0m while removing quicksilver-rocksdb, directory '/usr/local/share/man/man1' not empty so not removed^M
^[[1mdpkg:^[[0m ^[[1;33mwarning:^[[0m while removing quicksilver-rocksdb, directory '/usr/local/lib' not empty so not removed^M
dpkg-deb: error while loading shared libraries: libzstd.so.1: cannot open shared object file: No such file or directory^M
^[[1mdpkg:^[[0m error processing archive /var/cache/apt/archives/libzstd1_1.4.4+dfsg-3_amd64.deb (--unpack):^M
dpkg-deb --control subprocess returned error exit status 127^M
Errors were encountered while processing:^M
/var/cache/apt/archives/libzstd1_1.4.4+dfsg-3_amd64.deb^M
Log ended: 2021-01-21  15:18:11

此外,我從中刪除libzstd1_1.4.4+dfsg-3_amd64.deb/var/cache/apt/archives/此處提到error processing archive /var/cache/apt/archives/libzstd1_1.4.4+dfsg-3_amd64.deb (--unpack):的內容,以便能夠重新安裝libzstd1usingdpkg -i但我仍然沒有成功這樣做,並出現與開頭提到的相同的錯誤,即:

$ sudo dpkg -i libzstd1_1.4.8+dfsg-1_amd64.deb
dpkg-deb: error while loading shared libraries: libzstd.so.1: cannot open shared object file: No such file or directory
dpkg: error processing archive libzstd1_1.4.8+dfsg-1_amd64.deb (--install):
dpkg-deb --control subprocess returned error exit status 127
Errors were encountered while processing:
libzstd1_1.4.8+dfsg-1_amd64.deb

類似問題的一個答案是執行以下命令:

$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of mesa-vulkan-drivers:amd64:
mesa-vulkan-drivers:amd64 depends on libzstd1 (>= 1.3.2); however:
 Package libzstd1 is not installed.

dpkg: error processing package mesa-vulkan-drivers:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgl1-mesa-dri:amd64:
libgl1-mesa-dri:amd64 depends on libzstd1 (>= 1.3.2); however:
 Package libzstd1 is not installed.

dpkg: error processing package libgl1-mesa-dri:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libxatracker2:amd64:
libxatracker2:amd64 depends on libzstd1 (>= 1.3.2); however:
 Package libzstd1 is not installed.

dpkg: error processing package libxatracker2:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libglx-mesa0:amd64:
libglx-mesa0:amd64 depends on libgl1-mesa-dri; however:
 Package libgl1-mesa-dri:amd64 is not configured yet.

dpkg: error processing package libglx-mesa0:amd64 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mesa-vulkan-drivers:amd64
libgl1-mesa-dri:amd64
libxatracker2:amd64
libglx-mesa0:amd64

其次是

$ sudo apt --fix-broken install
apt: error while loading shared libraries: libzstd.so.1: cannot open shared object file: No such file or directory

但這顯然也不起作用。

我通過/usr/lib/x86_64-linux-gnu/libzstd.so.1.4.4在執行我的 Ubuntu 版本的另一台機器上複製安裝並在同一目錄中創建一個符號連結文件libzstd.so.1來解決它。libzstd.so.1.4.4``/usr/lib/x86_64-linux-gnu/

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