Agent will not uninstall Linux due to service not running
The Automox agent is installed but the service is unable to start. Subsequently, the uninstall of the agent is failing due to not having the agent currently running.
Symptoms
Error: Failed to stop amagent.service: Unit amagent.service not loaded.
Example
sudo apt-get remove -f amagent
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
amagent
0 upgraded, 0 newly installed, 1 to remove and 9 not upgraded.
After this operation, 8,380 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 148564 files and directories currently installed.)
Removing amagent (1.0-40) ...
Failed to stop amagent.service: Unit amagent.service not loaded.
dpkg: error processing package amagent (--remove):
installed amagent package pre-removal script subprocess returned error exit status 5
Errors were encountered while processing:
amagent
Steps to resolution
Edit/var/lib/dpkg/info/amagent.prerm
and comment out where we are trying to stop the service. That should allow the dpkg to complete the rest of the uninstall.
sudo gedit /var/lib/dpkg/info/amagent.prerm
- Then comment out line 5:
sudo gedit /var/lib/dpkg/info/amagent.prerm