我尝试安装 vagrant,但由于 libarchive13 的依赖问题而失败

我尝试安装 vagrant,但由于 libarchive13 的依赖问题而失败
choz@Choz-Liu:~$ sudo apt-get -f install vagrant
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:
vagrant : Depends: bsdtar but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

choz@Choz-Liu:~$ sudo apt-get install bsdtar
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:
bsdtar : Depends: libarchive13 (= 3.1.2-11build1) but     3.1.2-11ubuntu0.16.04.2 is to be installed
E: Unable to correct problems, you have held broken packages.

答案1

似乎有一个未解决的错误:https://bugs.launchpad.net/ubuntu/+source/vagrant/+bug/1503565

该页面的用户 Matthew Giassa (mgiassa) 有一个潜在的解决方法:

Matthew Giassa (mgiassa) 于 2016-10-07 写道:

最近在 4.4.0-38-generic #57-Ubuntu SMP 上的 Ubuntu 16.04.1 上遇到了这个问题。

似乎构建标签libarchive13不正确,或者 bsdtar期望的版本错误。

我可以通过以下方式修复此问题:

  • apt-get 下载 bsdtar mkdir temp_out dpkg-deb -R

  • bsdtar_3.1.2-11build1_amd64.deb temp_out

  • # 修改temp_out/DEBIAN中的“控制文件”,将版本从“3.1.2-11build1”改为“3.2.1-2~ubuntu16.04.1”。保存,关闭。

  • dpkg-deb -b temp_out FIXED_bsdtar.deb

  • sudo dpkg -i ./FIXED_bsdtar.deb

之后,我能够通过“sudo apt-get install vagrant”成功安装并使用 vagrant。这种方法的唯一缺点是,当 bsdtar 包真正修复后,我最终必须手动解决这个问题。

这可能不是一个好的长期解决方案,所以你可能想要下载 vagrant暂时,直到错误被修补。

答案2

  1. 下载适合Debian 16.04的bsdtar(主要针对U16.04中的libarchive13):https://packages.ubuntu.com/xenial/amd64/bsdtar/download

    wget -P /tmp http://security.ubuntu.com/ubuntu/pool/universe/liba/libarchive/bsdtar_3.1.2-11ubuntu0.16.04.3_amd64.deb
    
  2. 本地安装:

    apt install /tmp/bsdtar_3.1.2-11ubuntu0.16.04.3_amd64.deb
    
  3. 然后就可以安装 vagrant 了:

    apt install vagrant
    

相关内容