您的位置:首页 > 运维架构 > Linux

【工具使用】Linux日常使用之软件安装失败的处理方式

2018-02-02 09:44 706 查看
从古董系统Ubuntu12.04一路升级到较新的16.04,发现有些软件,如samba,不能用了。用一般的处理方式如
apt -f install
也没办法处理。一直放着,今天还是觉得samba有一些方便,便花了一点时间去看这个问题。

错误详情

➜  ~ sudo apt install samba


Reading package lists… Done

Building dependency tree

Reading state information… Done

Some packages could not be installed. This may mean that you have

requested an impossible situation or if you are using the unstable

distribution that some required packages have not yet been created

or been moved out of Incoming.

The following information may help to resolve the situation:

The following packages have unmet dependencies:

samba : Depends: python-samba but it is not going to be installed

Depends: samba-common (= 2:4.3.8+dfsg-0ubuntu1) but 2:4.3.11+dfsg-0ubuntu0.14.04.11 is to be installed

Depends: samba-common-bin (= 2:4.3.8+dfsg-0ubuntu1) but it is not going to be installed

Depends: libwbclient0 (= 2:4.3.8+dfsg-0ubuntu1) but 2:4.3.11+dfsg-0ubuntu0.14.04.11 is to be installed

Depends: samba-libs (= 2:4.3.8+dfsg-0ubuntu1) but it is not going to be installed

Recommends: attr

Recommends: samba-dsdb-modules but it is not going to be installed

Recommends: samba-vfs-modules but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

原因

我觉得大致如下:

提示是
packages have unmet dependencies
,再仔细看一下下面的描述,这种问题其实就是软件所依赖的包的版本不对,基本一可以通过
sudo apt -f install
解决,但是该包被以为是最新的,无法被替换掉。

解决办法

先把这些依赖包全部卸载掉,然后再安装回来。

过程如下:

➜  ~ sudo apt install python-samba


Reading package lists… Done

Building dependency tree

Reading state information… Done

Some packages could not be installed. This may mean that you have

requested an impossible situation or if you are using the unstable

distribution that some required packages have not yet been created

or been moved out of Incoming.

The following information may help to resolve the situation:

The following packages have unmet dependencies:

python-samba : Depends: samba-libs (= 2:4.3.8+dfsg-0ubuntu1) but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

➜  ~ sudo apt install samba-libs


Reading package lists… Done

Building dependency tree

Reading state information… Done

Some packages could not be installed. This may mean that you have

requested an impossible situation or if you are using the unstable

distribution that some required packages have not yet been created

or been moved out of Incoming.

The following information may help to resolve the situation:

The following packages have unmet dependencies:

samba-libs : Depends: libwbclient0 (= 2:4.3.8+dfsg-0ubuntu1) but 2:4.3.11+dfsg-0ubuntu0.14.04.11 is to be installed

E: Unable to correct problems, you have held broken packages.

➜  ~ sudo apt install libwbclient0


Reading package lists… Done

Building dependency tree

Reading state information… Done

libwbclient0 is already the newest version (2:4.3.11+dfsg-0ubuntu0.14.04.11).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

➜  ~ sudo apt remove libwbclient0:amd64


Reading package lists… Done

Building dependency tree

Reading state information… Done

The following packages will be REMOVED:

libwbclient0

0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.

After this operation, 209 kB disk space will be freed.

Do you want to continue? [Y/n]

(Reading database … 318410 files and directories currently installed.)

Removing libwbclient0:amd64 (2:4.3.11+dfsg-0ubuntu0.14.04.11) …

Processing triggers for libc-bin (2.23-0ubuntu3) …

➜  ~ sudo apt install libwbclient0


Reading package lists… Done

Building dependency tree

Reading state information… Done

The following NEW packages will be installed:

libwbclient0

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 30.4 kB of archives.

After this operation, 186 kB of additional disk space will be used.

Get:1 http://mirrors.aliyun.com/ubuntu xenial/main amd64 libwbclient0 amd64 2:4.3.8+dfsg-0ubuntu1 [30.4 kB]

Fetched 30.4 kB in 0s (146 kB/s)

Selecting previously unselected package libwbclient0:amd64.

(Reading database … 318404 files and directories currently installed.)

Preparing to unpack …/libwbclient0_2%3a4.3.8+dfsg-0ubuntu1_amd64.deb …

Unpacking libwbclient0:amd64 (2:4.3.8+dfsg-0ubuntu1) …

Processing triggers for libc-bin (2.23-0ubuntu3) …

Setting up libwbclient0:amd64 (2:4.3.8+dfsg-0ubuntu1) …

Processing triggers for libc-bin (2.23-0ubuntu3) …

➜  ~ sudo apt install libwbclient0


Reading package lists… Done

Building dependency tree

Reading state information… Done

libwbclient0 is already the newest version (2:4.3.8+dfsg-0ubuntu1).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

其它的依赖包按照此方法去一一操作,操作完成了之后便可以安装好之前想安装的软件了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux