My emacs is broken and I cannot repair it. I want to reinstall emacs 26.3 from the official linux mint repositories -- not snap or other 3rd party repo, as those are spawning even more errors/warnings. I am on linux mint 20.3. First, I have tried to remove emacs completely. I've done so using
sudo apt-get remove emacs-bin-common emacs-common emacs-el emacs-gtk
Afterwards, and as described here, I have run this command
sudo apt-get install --reinstall dictionaries-common libotf0 libm17n-0
The problem starts afterwards, as running sudo apt-get install emacs
is unsuccessful. Similar errors show up if I try emacs-lucid or emacs-nox.
Reading package lists... Done
Building dependency tree
Reading state information... 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:
emacs-bin-common emacs-common emacs-el emacs-gtk
Suggested packages:
mailutils emacs-common-non-dfsg
The following NEW packages will be installed
emacs emacs-bin-common emacs-common emacs-el emacs-gtk
0 to upgrade, 5 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/32.9 MB of archives.
After this operation, 128 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Selecting previously unselected package emacs-common.
(Reading database ... 421093 files and directories currently installed.)
Preparing to unpack .../emacs-common_1%3a26.3+1-1ubuntu2_all.deb ...
Unpacking emacs-common (1:26.3+1-1ubuntu2) ...
Selecting previously unselected package emacs-bin-common.
Preparing to unpack .../emacs-bin-common_1%3a26.3+1-1ubuntu2_amd64.deb ...
Unpacking emacs-bin-common (1:26.3+1-1ubuntu2) ...
Selecting previously unselected package emacs-gtk.
Preparing to unpack .../emacs-gtk_1%3a26.3+1-1ubuntu2_amd64.deb ...
Unpacking emacs-gtk (1:26.3+1-1ubuntu2) ...
Selecting previously unselected package emacs.
Preparing to unpack .../emacs_1%3a26.3+1-1ubuntu2_all.deb ...
Unpacking emacs (1:26.3+1-1ubuntu2) ...
Selecting previously unselected package emacs-el.
Preparing to unpack .../emacs-el_1%3a26.3+1-1ubuntu2_all.deb ...
Unpacking emacs-el (1:26.3+1-1ubuntu2) ...
Setting up emacs-common (1:26.3+1-1ubuntu2) ...
Setting up emacs-el (1:26.3+1-1ubuntu2) ...
Setting up emacs-bin-common (1:26.3+1-1ubuntu2) ...
update-alternatives: using /usr/bin/ctags.emacs to provide /usr/bin/ctags (ctags) in auto mode
update-alternatives: using /usr/bin/ebrowse.emacs to provide /usr/bin/ebrowse (ebrowse) in auto mode
update-alternatives: using /usr/bin/emacsclient.emacs to provide /usr/bin/emacsclient (emacsclient) in auto mode
update-alternatives: using /usr/bin/etags.emacs to provide /usr/bin/etags (etags) in auto mode
Setting up emacs-gtk (1:26.3+1-1ubuntu2) ...
update-alternatives: using /usr/bin/emacs-gtk to provide /usr/bin/emacs (emacs) in auto mode
tsort: -: input contains a loop:
tsort: elpa-ivy
tsort: emacsen-common
Install elpa-ivy for emacs
install/ivy-0.12.0: Handling install of emacsen flavor emacs
install/ivy-0.12.0: byte-compiling for emacs
>>Error occurred processing *.el: File is missing (("Opening input file" "No such file or directory" "/usr/share/emacs/site-lisp/elpa/ivy-0.12.0/*.el"))
ERROR: install script from elpa-ivy package failed
dpkg: error processing package emacs-gtk (--configure):
installed emacs-gtk package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of emacs:
emacs depends on emacs-gtk (>= 1:26.3) | emacs-lucid (>= 1:26.3) | emacs-nox (>= 1:26.3); however:
Package emacs-gtk is not configured yet.
Package emacs-lucid is not installed.
Package emacs-nox is not installed.
dpkg: error processing package emacs (--configure):
dependency problems - leaving unconfigured
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for install-info (6.7.0.dfsg.2-5) ...
Processing triggers for desktop-file-utils (0.24+linuxmint1) ...
Errors were encountered while processing:
emacs-gtk
emacs
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have been running this errand for almost a full day and have tried lots of other things (apt-get updates, purge vs remove, etc.) trying to solve the missing ivy .el files
and dependencies but without any luck. Thank you in advance for any help.