0

When trying to sudo apt upgrade I get this:

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:
 emacs25 : Depends: emacs25-common but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I try sudo apt --fix-broken install I get this:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
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 0 not upgraded.
3 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] y
(Reading database ... 226124 files and directories currently installed.)
Preparing to unpack .../emacs25-common_25.3~2.gitc09215a-kk1+18.04_all.deb ...
Unpacking emacs25-common (25.3~2.gitc09215a-kk1+18.04) ...
dpkg: error processing archive /var/cache/apt/archives/emacs25-common_25.3~2.gitc09215a-kk1+18.04_all.deb (--unpack):
 trying to overwrite '/usr/share/emacs/site-lisp/subdirs.el', which is also in package emacs26-common 26.3~1.git96dd019-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~2.gitc09215a-kk1+18.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is how I installed emacs26:

## Install emacs 26
From <http://ubuntuhandbook.org/index.php/2019/02/install-gnu-emacs-26-1-ubuntu-18-04-16-04-18-10/>:
1. `sudo add-apt-repository ppa:kelleyk/emacs`
1. `sudo apt update && sudo apt install emacs26`

But this is what I get when I try to sudo apt remove emacs26:

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:
 emacs25 : Depends: emacs25-common but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I found this (Package system is broken. How to fix it?) askubuntu thread with some suggested solutions:

  • sudo apt-get -f install result:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Correcting dependencies... Done
    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 0 not upgraded.
    3 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] y
    (Reading database ... 226124 files and directories currently installed.)
    Preparing to unpack .../emacs25-common_25.3~2.gitc09215a-kk1+18.04_all.deb ...
    Unpacking emacs25-common (25.3~2.gitc09215a-kk1+18.04) ...
    dpkg: error processing archive /var/cache/apt/archives/emacs25-common_25.3~2.gitc09215a-kk1+18.04_all.deb (--unpack):
    trying to overwrite '/usr/share/emacs/site-lisp/subdirs.el', which is also in package emacs26-common 26.3~1.git96dd019-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~2.gitc09215a-kk1+18.04_all.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
  • sudo dpkg --configure -a result:

    dpkg: dependency problems prevent configuration of emacs25:
     emacs25 depends on emacs25-common; however:
      Package emacs25-common is not installed.
    
    dpkg: error processing package emacs25 (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of emacs:
     emacs depends on emacs25 | emacs25-lucid | emacs25-nox; however:
      Package emacs25 is not configured yet.
      Package emacs25-lucid is not installed.
      Package emacs25-nox is not installed.
    
    dpkg: error processing package emacs (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of elpa-async:
     elpa-async depends on emacs; however:
      Package emacs is not configured yet.
    
    dpkg: error processing package elpa-async (--configure):
     dependency problems - leaving unconfigured
    Errors were encountered while processing:
     emacs25
     emacs
     elpa-async
    
  • Trying to remove either of those (emacs25, emacs, elpa-async) results in the same:

    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:
     emacs25 : Depends: emacs25-common 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-get clean works without errors but has no effect on any of the above commands.

  • Another solution suggested in that thread was to install Synaptic, but sudo apt install synaptic fails like all other apt installs.

Any tips on how I can get out of this weird state? I think that I got into it by cancelling an installation of emacs25 while it was running. I cancelled it because apt was trying to install it as a dependency of something else (elpa-async).

L42
  • 335
  • 3
    Try sudo dpkg -i --force-overwrite /var/cache/apt/archives/emacs25-common_25.3~2.gitc09215a-kk1+18.04_all.deb && sudo apt-get -f install – Liso Mar 28 '20 at 09:39
  • Thanks. But is there a way I can avoid installing emacs25? I just want to keep emacs26, which works. – L42 Mar 28 '20 at 15:20
  • @Liso I did what you suggested, and then removed emacs25 with sudo apt remove emacs25, and my emacs26 installation still works as I expect. Thank you! – L42 Mar 29 '20 at 09:43
  • Np, glad it works now. – Liso Mar 30 '20 at 05:39

0 Answers0