Skip to main content

Uninstall Linux Packages Action

Remove one or more packages from Linux devices through an automation using Apt, Yum, Pacman, Snap, or Flatpak. Dependency cleanup depends on the manager.

Introduction

Remove one or more packages from a Linux device as part of an automation. Use this action to pull unwanted software off your inventory, clean up after a migration, or enforce a software baseline on a schedule.

The action supports five package managers: Apt, Yum, Pacman, Snap, and Flatpak. You pick the manager per step, so one automation can target a mixed-distro environment by branching on conditions.

What gets removed alongside the package depends heavily on which manager you choose. That's the part most worth reading below.


⚙️ PREREQUISITES:

  • A Linux device under management.

  • The package manager you select must be present on the device. Selecting Apt on an Arch box, for example, fails the step.


Supported Package Managers

You choose the manager explicitly from the Package manager dropdown. The value you pick is the one Level runs.

Manager

Typical distributions

Package name format

Apt

Debian, Ubuntu, Linux Mint, Raspberry Pi OS

Debian package name (dpkg -l)

Yum

RHEL, CentOS, Rocky, AlmaLinux, Fedora, Photon OS

RPM name

Pacman

Arch Linux

Package name (pacman -Q)

Snap

Any distro with snapd

Snap name

Flatpak

Any distro with Flatpak

Flathub application ID (e.g. org.gnome.Calculator)

ℹ️ NOTE: The Yum option covers yum, dnf, and tdnf. The agent detects which binary the device uses and runs the right one.


Add the Uninstall Linux Package Action

  1. Open the automation in edit mode and click + Add action.

  2. Under App management, select Uninstall Linux package. The panel opens with Action type (pre-set to Uninstall Linux package) and Step configuration.

  3. Choose a Package manager.

  4. Enter one or more names in Package(s). Press Tab or add a comma after each name to add the next one.

  5. Click Save.

Uninstall Linux Package Action

Package Manager

Required. Sets which tool runs on the device and which name format the Package(s) field expects. See the table above.


Package(s)

Required. The package names to remove, in the format the selected manager uses. You can't save the step without at least one name.

💡 TIP: For Apt, Yum, and Pacman, a name that isn't installed is reported as "not found, skipping" and the action continues. snap remove exits cleanly even when the snap isn't present, so the step won't fail on an already-removed package either.


Dependency Cleanup Differs by Manager

This is the gotcha. Removing a package doesn't mean the same thing on every distro, and the difference will trip up anyone carrying a mental model over from another package manager.

Manager

Uninstall command

What it removes

Apt

apt-get -yq remove <pkg> then apt-get -yq autoremove --purge

The package plus orphaned dependencies, purged. Apt cleans up aggressively.

Yum

yum remove -y --noautoremove <pkg>

The package only. --noautoremove leaves dependencies in place. This is the opposite of Apt.

Pacman

pacman -R --noconfirm <pkg>

The package only. -R does not cascade to dependencies.

Snap

snap remove <pkg>

The snap. One package at a time, 10-minute per-package timeout.

Flatpak

flatpak uninstall -y --noninteractive <pkg>

The Flatpak, system-wide. 10-minute per-package timeout.

⚠️ WARNING: Apt purges configuration files and removes orphaned dependencies on every uninstall. Yum and Pacman leave dependencies behind. If you're standardizing removal behavior across a mixed inventory, don't assume "uninstall" cleans up the same way everywhere.


How the Action Runs

A few behaviors apply to every uninstall, regardless of manager:

  • Linux only. Run against a Windows or macOS device and the step returns "unsupported action." The run continues.

  • The selected manager must be present. If the binary isn't installed, the step fails with "Unsupported package manager."

  • 3-hour timeout on the whole action.

  • Live output streams line by line into the run log.

For Apt, Yum, and Pacman, Level waits on the package-manager lock if another process holds it, backing off from 1 second up to 30 seconds between checks for up to 1 hour, then giving up with "Another package manager process is running." Snap and Flatpak don't wait on a lock.

ℹ️ NOTE: Pacman's -R removes only the named package. If you've removed something that other packages depend on, Pacman will refuse rather than break the dependency graph. Check the run log if a Pacman uninstall reports a failure.


Conditions

The Conditions section restricts when this action runs based on device attributes or the outcome of a previous action. Expand it to add conditions.

See Action Conditions for the full reference.


Additional Options

Expand Additional options for execution settings including action name, failure behavior, output variables, and retries.

See Actions Overview for the full reference.


FAQ

  • Does uninstalling remove dependencies too? Depends on the manager. Apt removes orphaned dependencies and purges config. Yum and Pacman remove only the named package and leave dependencies in place. See Dependency Cleanup Differs by Manager above.

  • What if the package isn't installed? For Apt, Yum, and Pacman it's reported as "not found, skipping" and the action continues. snap remove exits cleanly on a missing snap, so the step doesn't fail there either.

  • My Pacman uninstall failed. Why? Likely because another installed package depends on the one you tried to remove. Pacman's -R won't break the dependency graph. Check the run log for the conflicting package.

  • Can one action uninstall across different distros? No, one step runs one manager. For a mixed inventory, add a step per manager and gate each on a condition so only matching devices run it.

  • Will this remove a package a user installed manually? Yes, if it's tracked by the selected manager. A package installed by a different manager (a Snap on a device where you ran Apt, for example) won't be touched.

  • Does the device need to be online? Yes, to run. If it's offline when the automation fires, the step queues and resumes once the device reconnects.

  • Who can add or edit this action? Technicians with permission to edit automations in the relevant group. See Workspace → Permissions.

Did this answer your question?