最近使用Debian搭建CS服務器,安裝各種命令包遇見一些問題,一般是依賴錯誤、安裝目錄已存在其他文件(可能是同類的命令包存放相同位置導致的)
我的環境:Debian9
我遇到的問題是為python3環境安裝pip3產生的報錯,當時我想了一個暴力的解決方法,直接下載pip安裝包本地解壓安裝,當時解決了這個問題 ,但是我再裝別的命令包就會有以下報錯:
The following packages have unmet dependencies:
bsdmainutils : Depends: bsdextrautils (>= 2.35.2-7) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
dpkg: error processing archive /var/cache/apt/archives/bsdextrautils_2.36-3+b1_amd64.deb (--unpack): trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4.3
結合這篇文章大體明白了自己的問題可能就是之前裝bsdmainutils命令包沒裝完,存在目錄上的一些問題:然后使用文章中的方法步驟,找到出錯的命令包位置,使用以下指令:
root@fish2:~# dpkg -i --force-overwrite /var/cache/apt/archives/bsdextrautils_2.36-3+b1_amd64.deb
(Reading database ... 117779 files and directories currently installed.)
Preparing to unpack .../bsdextrautils_2.36-3+b1_amd64.deb ...
Unpacking bsdextrautils (2.36-3+b1) ...
dpkg: warning: overriding problem because --force enabled: //警告無報錯
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4.3
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/look', which is also in package bash-completion 1:2.1-4.3
Setting up bsdextrautils (2.36-3+b1) ...
update-alternatives: warning: alternative /usr/bin/bsd-write (part of link group write) doesn't exist; removing from list of alternatives
update-alternatives: warning: /etc/alternatives/write is dangling; it will be updated with best choice
update-alternatives: using /usr/bin/write.ul to provide /usr/bin/write (write) in auto mode
接着這樣:
root@fish2:~# apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libisl22 libllvm3.9 libpciaccess0 libruby2.3
libtxc-dxtn-s2tc libzstd1 ruby-did-you-mean ruby2.3
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 588 not upgraded.
8 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "zh_CN.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Processing triggers for cracklib-runtime (2.9.2-5) ...
Setting up libmpfr6:amd64 (4.1.0-3) ...
Setting up libzstd1:amd64 (1.4.5+dfsg-4) ...
Setting up ncal (12.1.7) ...
Setting up libbsd0:amd64 (0.10.0-1) ...
Setting up calendar (12.1.7) ...
Processing triggers for libc-bin (2.31-3) ...
Setting up libmpc3:amd64 (1.2.0-1) ...
Setting up libisl22:amd64 (0.22.1-1) ...
Setting up bsdmainutils (12.1.7) ...
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for libc-bin (2.31-3) ...
然后再用apt-get install python-pip 命令包 就可以了