Skip to main content

Linux Agent | Complete Removal & Cleanup Guide

Updated over 2 weeks ago

Overview ๐Ÿ’ฅ

In some scenarios, partners may need to fully remove the Liongard Agent from a Linux systemโ€”for example, when migrating servers, performing a clean reinstallation, or troubleshooting agent behavior.

While a simple uninstall removes the primary binary and service, residual files such as systemd timers, cached installers, or leftover directories may still remain on the system. This article provides a step-by-step, verified method to completely remove the Liongard Agent and its components, ensuring your environment is clean and ready for reinstallation if needed.


Why Perform a Full Cleanup? ๐Ÿค”

A complete cleanup is recommended when:

  • The agent fails to check in or becomes stuck in an incorrect state.

  • You need to reinstall the agent for a different environment or tenant.

  • Old service entries or cached installers interfere with upgrades.

  • You want to ensure no residual processes or security risks remain.

Performing a thorough removal ensures there are no orphaned systemd services, no background update timers, and no mismatched agent metadata left behind.


Step-by-Step Uninstallation ๐Ÿง‘โ€๐Ÿซ

Step

Command

Description

Expected Outcome

1

sudo systemctl stop liongard-agent

Stops the running Liongard Agent service before removal.

Service transitions to inactive (dead).

2

sudo systemctl disable liongard-agent

Disables auto-start of the agent on boot.

Unit file link removed from multi-user.target.wants.

3

sudo systemctl stop liongard-agent-updater

Stops the updater service to prevent background triggers.

Updater process stopped.

4

sudo systemctl disable liongard-agent-updater.timer

Disables the updater timer.

Timer disabled from scheduled runs.

5

sudo rm /etc/systemd/system/liongard-agent* -f

Removes systemd service and timer definitions.

Removes service and timer unit files.

6

sudo rm -rf /opt/liongard

Deletes the agent installation directory.

Folder /opt/liongard removed completely.

7

sudo rm -rf /var/lib/liongard

Removes Liongard data or state files.

Cleans up stored metadata or logs.

8

sudo rm -f /usr/lib/systemd/system/liongard-agent*

Removes remaining system-wide service files.

System-level definitions removed.

9

sudo systemctl daemon-reload

Reloads systemd to remove stale unit entries.

Systemd daemon refreshed.


Verify Complete Removal ๐Ÿ™Œ

After cleanup, confirm no Liongard components remain:

sudo find / -iname "*liongard*" 2>/dev/null

โœ… Expected Output:

No paths returned (indicating all files and services are removed).

If you still see files like:

/usr/lib/systemd/system/liongard-agent-updater.service  
/run/systemd/propagate/liongard-agent.service
/LiongardAgent-lts-x64.xz.run

โ€” remove them manually using sudo rm -f <path>.

โœ… Delete the agent from the Liongard portal:

  • Login to Liongard โ†’ Admin โ†’ Agents

  • Locate the agent in question

  • You can remove it using either of the following methods:

    1. Click on the three dots (โ‹ฎ) next to the agent and select Delete Agent, or

    2. Select the agent โ†’ Click on the Action tab โ†’ Choose Delete Agent(s)

โœ… Optional: Clean System Journal Entries

To clear out residual logs related to Liongard:

sudo journalctl -u liongard-agent.service --rotate --vacuum-time=1d
sudo journalctl -u liongard-agent-updater.service --rotate --vacuum-time=1d

(This keeps only the last day of logs and helps declutter your journal.)


Security Considerations ๐Ÿ™Œ

Area

Risk

Why Cleanup Matters

Best Practice

Residual Services

Orphaned services could attempt network calls.

Prevents unauthorized traffic or stale agent heartbeats.

Always disable and remove systemd entries.

Stale Credentials

Cached keys or secrets may remain in /opt/liongard.

Could pose data exposure risk in shared environments.

Securely wipe /opt/liongard and /var/lib/liongard.

Agent Collision

Reinstalling without cleanup can reuse stale identity.

May overwrite previous agent in Liongard dashboard.

Clean before reinstall to ensure unique agent ID.

System Integrity

Incomplete uninstall can affect package updates.

Maintains clean dependency graph for Linux package manager.

Verify via `systemctl list-units


Reinstalling After Cleanup ๐Ÿ‘จโ€๐Ÿ’ป

If you plan to reinstall:

  1. Reboot the system (optional).

  2. Download the latest Linux installer from your Liongard instance.

  3. Run the install command with proper LIONGARDURL, ACCESSKEY, and ACCESSSECRET.

  4. Confirm the agent registers as a new device in the portal.

For detailed installation steps, see:
๐Ÿ”— Deploying Liongard Agent on Linux


Need Assistance? ๐Ÿฆ

Our Support team is happy to help with agent cleanup or verification.
๐Ÿ’ฌ Start a chat with Leo (AI Assistant) or connect with a live support engineer.
๐Ÿ“ง Email: support@liongard.com


Additional Resources ๐Ÿคฉ

Did this answer your question?