1

I've installed emacs28 from snapshot (emacs-snapshot-common) without realizing it's the latest bleeding edge and not the latests stable version.

I tried installing 26.3 from Kevin Kelly's repo, as described here, but got an error:

Unpacking emacs26-common (26.3~1.git96dd019-kk1+18.04) ...

dpkg: error processing archive /var/cache/apt/archives/emacs26-common_26.3~1.git96dd019-kk1+18.04_all.deb (--unpack):

trying to overwrite '/usr/include/emacs-module.h', which is also in package emacs-snapshot-common 20200427:100116-e49d3a4~ubuntu18.04.1

I then tried to uninstall both of them but I get:

jonathan@DESKTOP-2VSOFC3:~$ sudo apt-get remove emacs-snapshot-common

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-snapshot : Depends: emacs-snapshot-common (= 20200427:100116-e49d3a4~ubuntu18.04.1) but it is not going to be

installed

emacs26 : Depends: emacs26-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 also tried:

sudo dpkg-divert --package emacs26 --divert /usr/include//emacs-module.h.moved --rename /usr/include/emacs-module.h

but that didn't help either...

Eventually, somehow, running remove again for both versions worked, but I still get the same error trying to install emacs-26...

jonathan@DESKTOP-2VSOFC3:~$ sudo apt install emacs26

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

emacs-snapshot-common libjansson4 liblockfile-bin liblockfile1

Use 'sudo apt autoremove' to remove them.

The following additional packages will be installed:

emacs26-common

The following NEW packages will be installed:

emacs26 emacs26-common

0 upgraded, 2 newly installed, 0 to remove and 18 not upgraded.

Need to get 0 B/21.8 MB of archives.

After this operation, 117 MB of additional disk space will be used.

Do you want to continue? [Y/n] y

(Reading database ... 57830 files and directories currently installed.)

Preparing to unpack .../emacs26-common_26.3~1.git96dd019-kk1+18.04_all.deb ...

Unpacking emacs26-common (26.3~1.git96dd019-kk1+18.04) ...

dpkg: error processing archive /var/cache/apt/archives/emacs26-common_26.3~1.git96dd019-kk1+18.04_all.deb (--unpack):

trying to overwrite '/usr/include/emacs-module.h', which is also in package emacs-snapshot-common 20200427:100116-e49d3a4~ubuntu18.04.1

dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

Selecting previously unselected package emacs26.

Preparing to unpack .../emacs26_26.3~1.git96dd019-kk1+18.04_amd64.deb ...

Unpacking emacs26 (26.3~1.git96dd019-kk1+18.04) ...

Errors were encountered while processing:

/var/cache/apt/archives/emacs26-common_26.3~1.git96dd019-kk1+18.04_all.deb

E: Sub-process /usr/bin/dpkg returned an error code (1)

while running "emacs&" returns:

emacs-28.0.50: command not found

and running the suggested --fix-broken install returns the familiar:

jonathan@DESKTOP-2VSOFC3:~$ sudo apt --fix-broken install

Reading package lists... Done

Building dependency tree

Reading state information... Done

Correcting dependencies... Done

The following packages were automatically installed and are no longer required:

emacs-snapshot-common libjansson4 liblockfile-bin liblockfile1

Use 'sudo apt autoremove' to remove them.

The following additional packages will be installed:

emacs26-common

The following NEW packages will be installed:

emacs26-common

0 upgraded, 1 newly installed, 0 to remove and 18 not upgraded.

1 not fully installed or removed.

Need to get 0 B/17.9 MB of archives.

After this operation, 72.0 MB of additional disk space will be used.

Do you want to continue? [Y/n] y

(Reading database ... 58480 files and directories currently installed.)

Preparing to unpack .../emacs26-common_26.3~1.git96dd019-kk1+18.04_all.deb ...

Unpacking emacs26-common (26.3~1.git96dd019-kk1+18.04) ...

dpkg: error processing archive /var/cache/apt/archives/emacs26-common_26.3~1.git96dd019-kk1+18.04_all.deb (--unpack):

trying to overwrite '/usr/include/emacs-module.h', which is also in package emacs-snapshot-common 20200427:100116-e49d3a4~ubuntu18.04.1

dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

Errors were encountered while processing:

/var/cache/apt/archives/emacs26-common_26.3~1.git96dd019-kk1+18.04_all.deb

E: Sub-process /usr/bin/dpkg returned an error code (1)

So now I'm completely without a working version of emacs :'(

I'd really appreciate any help you could give,

Thanks!

2
  • try sudo apt autoremove or just remove that emacs-snapshot-common package, then reinstall
    – Muihlinn
    May 9, 2020 at 15:42
  • 3
    This is a question about the way Emacs packages are made and interact on your distribution, so it's got more to do with your distribution and its package-management tools than with Emacs. I recommend you try asking that question elsewhere.
    – Stefan
    May 9, 2020 at 16:28

1 Answer 1

1

This problem is rare when using the standard supported repositories, but all too common when using 3rd party PPAs.

You want to assure that you get rid of the configuration and intermediate files that a package installation creates, not only the binaries. So you should use apt purge on everything installed by that emacs28 package.

Something like the following should clear things up:

sudo apt purge `dpkg --get-selections | grep emacs | cut -f1`

Carefully review what will be removed - it will probably be a combination of emacs26 and emacs28 packages. Once you have purged all those, once more run

sudo apt -f install
sudo apt autoremove

To be extra cautious, I would also make sure to remove the path that your previous steps complained about

sudo rm -iv /usr/include/emacs-module.h

2
  • Thanks! I ended up reinstalling the WSL I was working on, but it's good to know... May 10, 2020 at 16:10
  • Thanks for accepting this - since you're going cutting edge, you might want to compile your own from source - it's not too difficult, lets you control exactly what features you want to include, and avoids package manager conflicts. It's also very simple that way to have multiple versions of Emacs on different paths.
    – gregoryg
    May 11, 2020 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.