I am stuck between old package and script files which I can't seem to get rid of so new ones can stop and start services in the new way.
The package in question is called speakup and is the screen reader for debian among other Linuxen. I need to blow away the old package and install an upgraded version of the same program but this is what happens: root@wb5agz:~# apt-get install speakup The following packages were automatically installed and are no longer required: espeak espeak-data espeak-ng-data libespeak-ng1 libespeak1 libpcaudio0 libsonic0 Use 'apt autoremove' to remove them. The following packages will be REMOVED: espeakup* 0 upgraded, 0 newly installed, 1 to remove and 25 not upgraded. 12 not fully installed or removed. After this operation, 79.9 kB disk space will be freed. Do you want to continue? [Y/n] y dpkg: error processing package espeakup (--remove): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: espeakup E: Sub-process /usr/bin/dpkg returned an error code (1) Oh. It gets better. root@wb5agz:~# apt-get autoremove Reading package lists... 0% Reading package lists... 100% Reading package lists... Done Building dependency tree... 0% Building dependency tree... 0% Building dependency tree... 50% Building dependency tree... 50% Building dependency tree... 60% Building dependency tree... 75% Building dependency tree... 91% Building dependency tree Reading state information... 0% Reading state information... 0% Reading state information... Done The following additional packages will be installed: espeakup The following packages will be upgraded: espeakup 1 upgraded, 0 newly installed, 0 to remove and 25 not upgraded. 12 not fully installed or removed. Need to get 0 B/37.2 kB of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y Reading changelogs... 100% Reading changelogs... Done (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 42616 files and directories currently installed.) Preparing to unpack .../espeakup_1%3a0.80-5+deb9u3_i386.deb ... Failed to stop espeakup.service: Unit espeakup.service not loaded. invoke-rc.d: initscript espeakup, action "stop" failed. dpkg: warning: subprocess old pre-removal script returned error exit status 5 dpkg: trying script from the new package instead ... Failed to stop espeakup.service: Unit espeakup.service not loaded. invoke-rc.d: initscript espeakup, action "stop" failed. It wasn't running anyway. dpkg: error processing archive /var/cache/apt/archives/espeakup_1%3a0.80-5+deb9u3_i386.deb (--unpack): subprocess new pre-removal script returned error exit status 5 update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults Failed to start espeakup.service: Unit espeakup.service is not loaded properly: Invalid argument. See system logs and 'systemctl status espeakup.service' for details. invoke-rc.d: initscript espeakup, action "start" failed. ● espeakup.service - Software speech output for Speakup Loaded: error[0m (Reason: Invalid argument) Active: inactive (dead) Docs: man:espeakup(8) Mar 28 10:12:29 wb5agz systemd[1]: [0;1;31m[/lib/systemd/system/espeakup.service:12…CE}'[0m Mar 28 10:12:29 wb5agz systemd[1]: [0;1;31mespeakup.service: Service lacks both Exe…ing.[0m Mar 28 10:46:36 wb5agz systemd[1]: [0;1;31m[/lib/systemd/system/espeakup.service:12…CE}'[0m Mar 28 10:46:36 wb5agz systemd[1]: [0;1;31mespeakup.service: Service lacks both Exe…ing.[0m Mar 28 10:46:38 wb5agz systemd[1]: [0;1;31m[/lib/systemd/system/espeakup.service:12…CE}'[0m Mar 28 10:46:38 wb5agz systemd[1]: [0;1;31mespeakup.service: Service lacks both Exe…ing.[0m Mar 28 10:46:44 wb5agz systemd[1]: [0;1;31m[/lib/systemd/system/espeakup.service:12…CE}'[0m Mar 28 10:46:44 wb5agz systemd[1]: [0;1;31mespeakup.service: Service lacks both Exe…ing.[0m Mar 28 10:46:45 wb5agz systemd[1]: [0;1;31m[/lib/systemd/system/espeakup.service:12…CE}'[0m Mar 28 10:46:45 wb5agz systemd[1]: [0;1;31mespeakup.service: Service lacks both Exe…ing.[0m Hint: Some lines were ellipsized, use -l to show in full. dpkg: error while cleaning up: subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: /var/cache/apt/archives/espeakup_1%3a0.80-5+deb9u3_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1) Basically, I am hosed getting rid of the old scripts and hosed installing and starting new scripts because the old scripts are being handled in the old way. I need to get rid of the old, completely and want to do it as safely as possible. The system is running as systemd so what is the safest way to break the impasse. Every sort of purge command I have tried basically ends the way you see here. The old scripts squawk and die. The new scripts squawk and die. Game over. I am not sure how much of the diagnostic messages will come across because the scripts apparently send curses codes. There are actually two debian systems here with exactly the same issue so whatever fixes one will most likely fix the other. Both systems appear to be otherwise okay. I appreciate any constructive suggestions for breaking the deadlock.