0

I would like to remove emacs25 entirely from my system and keep emacs26. Unfortunately, I am stuck in a fix-broken state

Here is the output...

Try to remove 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).

ok so let's try and fix the broken install...

> $ 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)

How about trying to force it? Same result.

> $ 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)

ok, let's purge!

> $ 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
    Read your output carefully: Two packages are trying to provide the same file - look for the word overwrite. That's a no-no. Those packages conflict, and are likely from different sources. Choose one source, and remove all the packages from the other source. Alternately, read man dpkg about how to --force the install...which may have other consequences. Either way, take good notes in case you need to undo or redo your actions. – user535733 Jul 02 '19 at 03:04
  • Hi, thanks for you quick reply. I appreciate you taking the time to help. Would you mind elaborating on what you mean exactly by "Choose one source, and remove all the packages from the other source"? Are you suggesting I do this with apt or just by manually removing things? – Scott Speidel Jul 02 '19 at 03:26
  • I fixed the issue. – Scott Speidel Jul 02 '19 at 04:10

1 Answers1

0

I solved this by removing all of the packages that depend on emacs using dpkg -r.

> $ 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

So, uninstall 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) ...