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!