当 apt 处于“--fix-broken”状态时,如何删除 emacs 25 并保留 26?

当 apt 处于“--fix-broken”状态时,如何删除 emacs 25 并保留 26?

我想从我的系统中彻底删除 emacs25 并保留 emacs26。不幸的是,我陷入了修复失败的状态

这是输出...

尝试删除 emacs25

> $ sudo apt remove emacs25                                                                                                                                                            [±530-skurnik-depletions ✓]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 emacs : Depends: emacs25 or
                  emacs25-lucid but it is not going to be installed or
                  emacs25-nox but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

好的,让我们尝试修复损坏的安装...

> $ sudo apt --fix-broken install                                                                                                                                                      [±530-skurnik-depletions ✓]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  xaw3dg
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  emacs25-common
The following NEW packages will be installed:
  emacs25-common
0 upgraded, 1 newly installed, 0 to remove and 239 not upgraded.
13 not fully installed or removed.
Need to get 0 B/17.5 MB of archives.
After this operation, 70.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 261624 files and directories currently installed.)
Preparing to unpack .../emacs25-common_25.3~1.gite0284ab-kk1+18.04_all.deb ...
Unpacking emacs25-common (25.3~1.gite0284ab-kk1+18.04) ...
dpkg: error processing archive /var/cache/apt/archives/emacs25-common_25.3~1.gite0284ab-kk1+18.04_all.deb (--unpack):
 trying to overwrite '/usr/share/emacs/site-lisp/subdirs.el', which is also in package emacs26-common 26.1~1.git07f8f9b-kk1+18.04
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/emacs25-common_25.3~1.gite0284ab-kk1+18.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

尝试强制执行怎么样?结果相同。

> $ sudo apt-get -f install                                                                                                                                                            [±530-skurnik-depletions ✓]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  xaw3dg
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  emacs25-common
The following NEW packages will be installed:
  emacs25-common
0 upgraded, 1 newly installed, 0 to remove and 239 not upgraded.
13 not fully installed or removed.
Need to get 0 B/17.5 MB of archives.
After this operation, 70.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 261624 files and directories currently installed.)
Preparing to unpack .../emacs25-common_25.3~1.gite0284ab-kk1+18.04_all.deb ...
Unpacking emacs25-common (25.3~1.gite0284ab-kk1+18.04) ...
dpkg: error processing archive /var/cache/apt/archives/emacs25-common_25.3~1.gite0284ab-kk1+18.04_all.deb (--unpack):
 trying to overwrite '/usr/share/emacs/site-lisp/subdirs.el', which is also in package emacs26-common 26.1~1.git07f8f9b-kk1+18.04
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/emacs25-common_25.3~1.gite0284ab-kk1+18.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

好的,让我们清除它!

> $ sudo apt-get purge emacs25                                                                                                                                                         [±530-skurnik-depletions ✓]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 emacs : Depends: emacs25 or
                  emacs25-lucid but it is not going to be installed or
                  emacs25-nox but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答案1

我通过使用 dpkg -r 删除所有依赖于 emacs 的软件包来解决这个问题。

> $ sudo dpkg -r emacs                                                                                                                                                                 
dpkg: dependency problems prevent removal of emacs:
 elpa-flx depends on emacs.
 elpa-flx-ido depends on emacs; however:
  Package emacs is to be removed.
 elpa-epl depends on emacs.

dpkg: error processing package emacs (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 emacs

因此,卸载 elpa-flx...

> $ sudo dpkg -r elpa-flx                                                                                                                                                              
dpkg: dependency problems prevent removal of elpa-flx:
 elpa-flx-ido depends on elpa-flx (= 0.6.1-1).

dpkg: error processing package elpa-flx (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 elpa-flx

> $ sudo dpkg -r elpa-flx-ido                                                                                                                                                          
(Reading database ... 261601 files and directories currently installed.)
Removing elpa-flx-ido (0.6.1-1) ...

> $ sudo dpkg -r elpa-flx                                                                                                                                                              
(Reading database ... 261593 files and directories currently installed.)
Removing elpa-flx (0.6.1-1) ...

> $ sudo dpkg -r emacs                                                                                                                                                                 
dpkg: dependency problems prevent removal of emacs:
 elpa-epl depends on emacs.

dpkg: error processing package emacs (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 emacs

> $ sudo dpkg -r elpa-epl                                                                                                                                                              
(Reading database ... 261582 files and directories currently installed.)
Removing elpa-epl (0.9-1) ...

> $ sudo dpkg -r emacs                                                                                                                                                                 
(Reading database ... 261571 files and directories currently installed.)
Removing emacs (47.0) ...

相关内容