我正在尝试在 Ubuntu 16.04 上安装 Emacs25 软件包以及 Emacs 24 和 Emacs-snapshot (当前为 Emacs 27.0.50)。
我运行了以下命令
sudo add-apt-repository ppa:kelleyk/emacs
sudo apt-get update
之后我跑了
sudo apt install emacs25
在此期间我得到了这个
user@user-desktop:$ sudo apt install emacs25
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
emacs25-common
The following NEW packages will be installed:
emacs25 emacs25-common
0 upgraded, 2 newly installed, 0 to remove and 132 not upgraded.
Need to get 0 B/21.0 MB of archives.
After this operation, 90.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 298195 files and directories currently installed.)
Preparing to unpack .../emacs25-common_92792-c3ff671-emacs-25.2~ubuntu16.04.1_all.deb ...
Unpacking emacs25-common (92792-c3ff671-emacs-25.2~ubuntu16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/emacs25-common_92792-c3ff671-emacs-25.2~ubuntu16.04.1_all.deb (--unpack):
trying to overwrite '/usr/share/emacs/site-lisp/subdirs.el', which is also in package emacs-snapshot-common 20190326:96618-9a6cba2~ubuntu16.04.1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package emacs25.
Preparing to unpack .../emacs25_92792-c3ff671-emacs-25.2~ubuntu16.04.1_amd64.deb ...
Unpacking emacs25 (92792-c3ff671-emacs-25.2~ubuntu16.04.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Errors were encountered while processing:
/var/cache/apt/archives/emacs25-common_92792-c3ff671-emacs-25.2~ubuntu16.04.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我该如何解决这个问题?
答案1
您可以使用引用的输出中的以下错误消息来解决此问题:
Unpacking emacs25-common (92792-c3ff671-emacs-25.2~ubuntu16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/emacs25-common_92792-c3ff671-emacs-25.2~ubuntu16.04.1_all.deb (--unpack):
trying to overwrite '/usr/share/emacs/site-lisp/subdirs.el', which is also in package emacs-snapshot-common 20190326:96618-9a6cba2~ubuntu16.04.1
安装失败,因为 和emacs-snapshot-common
都emacs25-common
包含/usr/share/emacs/site-lisp/subdirs.el
.
有很多方法可以解决这个问题,但值得考虑的是,尽管 Emacs 软件包的名称中包含版本号,但它们并不是设计为可共同安装的。 (事实上,从 Debian 10 和 Ubuntu 18.10 开始,软件包名称中不再包含版本号。)
解决这个问题的最干净的方法是转移该文件的包副本之一;例如,要保留emacs25
的副本:
sudo dpkg-divert --package emacs25 --divert /usr/share/emacs/site-lisp/subdirs.el.moved --rename /usr/share/emacs/site-lisp/subdirs.el
(语法相当违反直觉;参见联机dpkg-divert
帮助页了解详情)。这会将subdirs.el
另一个包提供的任何版本重命名emacs25
为subdirs.el.moved
.