Skip to main content

Our client attempted to uninstall the Automox agent from a Linux machine but encountered multiple issues.

Details of Actions Taken:

  1. Stopping the Agent Service:

    ~$ sudo service amagent stop

  2. Deregistering the Agent:

    ~$ sudo /opt/amagent/amagent --deregister
    Output: no certificate to deregister

  3. Attempting to Purge the Agent Package:

    ~$ sudo apt-get purge amagent

    Output: Reading package lists... Done Building dependency tree Reading state information... Done E: The package amagent needs to be reinstalled, but I can't find an archive for it.

  4. Reinstallation Attempt:
    The client tried reinstalling the agent using the following command:

    curl -sS "https://console.automox.com/downloadInstaller?accesskey=ORGANIZATION-KEY" | sudo bash

    However, the result indicated that the agent was already installed:

    Output: /opt/amagent/amagent already installed

  5. Dashboard Attempt:
    The client also attempted to delete the agent directly via the Automox dashboard. Unfortunately, this action failed, as the dashboard indicated that the agent had not been connected for over 10 days.

    Could you please assist with this issue and recommend the best way to remove the agent from Debian-based Linux operating systems.

Looking inside `install_agent.sh` (which I got from  going to https://console.automox.com/downloadInstaller?accesskey=ORGANIZATION-KEY in my browser) I can see on line 249, the script is checking if the file `/opt/amagent/amagent` is present, and if it does the script fails with "${AGENT} already installed" (${AGENT{ is set to `/opt/amagent/amagent` in line 4).

 

If I were a bettering man, I think removing `/opt/amagent/amagent` would allow the installation script to continue.

I’d suggest moving `/opt/amagent/amagent` to `/opt/amagent/amagent.orig` (or elsewhere) and then retry the installation process.

 

As an aside, it maybe useful for you to know you can download the Debian package from Automox by going to https://console.automox.com/installer?os=Linux&osname=Debian&osver=12&arch=x86_64&has_systemd=1. It’ll download as `installer`.. you’ll want to rename is something along the lines of `automox-debian12_x86_64.deb` or similar. You may then be able to do a `dpkg -i automox-debian12_x86_64.deb`

 

If you install it manually like this you’ll need to follow up with the following command

/opt/amagent/amagent --setkey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Where xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is your Automox key.

You can also set the group using 

/opt/amagent/amagent --setgrp XXXX

Where XXXX is your group. Note, you have to prefix it with Default Group/XXXX.. I don’t know why.

I don’t know why companies insist on providing only installation scripts and not links to packages… it makes implementing automatic installation using provisioning tools such as Salt more difficult than it needs to be. That's know I gained the knowledge provided about.

Good luck! Let us know how you get on.


@sscotter

When running the command to deregister the agent(sudo /opt/amagent/amagent --deregister), the following error is displayed:

"no certificate to deregister"

When attempting to purge the agent package(sudo apt-get purge amagent), the error is:

"The package 'amagent' needs to be reinstalled"

Could you please explain the reason for these errors?

What is the recommended method for removing the agent on Debian-based Linux operating systems?

 


I don’t know why you’re receiving those messages, but unless it’s a issue across multiple machines I wouldn’t put a lot of time into troubleshooting it, I’d just resolved the problem by renaming `/opt/amagent/amagent` to `/opt/amagent/amagent.orig` and reinstalling.

Note, I’m not a Automox employee, just Automox user of three years.


Reply