我正在尝试安装该包蝙蝠在 Kubuntu 上。这是我当前的系统:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
当我尝试安装“bat”时,收到以下消息:
$ sudo apt install -y bat
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gir1.2-appindicator3-0.1 gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-keybinder-3.0 gir1.2-wnck-3.0 gnome-session-canberra libappindicator3-1
libcanberra-gtk3-0 libcanberra-gtk3-module libkeybinder-3.0-0 libwnck-3-0 libwnck-3-common libxres1 python3-gi-cairo
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
bat
0 upgraded, 1 newly installed, 0 to remove and 21 not upgraded.
Need to get 0 B/1.585 kB of archives.
After this operation, 4.325 kB of additional disk space will be used.
(Reading database ... 278687 files and directories currently installed.)
Preparing to unpack .../bat_0.12.1-1build1_amd64.deb ...
Unpacking bat (0.12.1-1build1) ...
dpkg: error processing archive /var/cache/apt/archives/bat_0.12.1-1build1_amd64.deb (--unpack):
trying to overwrite '/usr/.crates2.json', which is also in package ripgrep 11.0.2-1build1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/bat_0.12.1-1build1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我该如何修复我的系统以正确安装蝙蝠?
答案1
显然,这是 Rust 构建工具的一个问题。该问题已得到修复,软件包可以在 Ubuntu 20.10 上正常安装,但修复程序尚未到达 Ubuntu 20.04。
问题针对bat
:
https://github.com/sharkdp/bat/issues/938
Ubuntu 的问题: https://bugs.launchpad.net/ubuntu/+source/rust-bat/+bug/1868517
根据 Ubuntu 问题,/usr/.crates2.json
这是一个“杂散”文件,并不重要。简单地删除它是不够的,因为包管理仍然知道它应该到達。
作为一种解决方法,您可以忽略该问题并使用以下命令覆盖该文件(该命令来自上述bat
问题中的评论):
sudo apt install -o Dpkg::Options::="--force-overwrite" bat ripgrep
答案2
我先安装 bat,然后安装 ripgrep 失败。
解决了:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/ripgrep_11.0.2-1build1_amd64.deb
这可能会有所不同:/var/cache/apt/archives/ripgrep_11.0.2-1build1_amd64.deb