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. Pick one per step, or choose Native/default to let Level detect the right manager on each device at runtime, so a single step can cover a mixed-distro inventory.

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. Native/default detects an installed manager instead, sidestepping this.


Supported Package Managers

Choose the manager from the Package manager dropdown. Pick Native/default to let the agent detect the manager installed on each device at runtime, or name one explicitly.

ℹ️ NOTE: Native/default detects the manager on the device, checking in this order: apt, yum, pacman, snap, flatpak. It picks the first one present.

Manager

Typical distributions

Package name format

Native/default

Any supported Linux distro

Detected at runtime (see note)

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. The dropdown lists Native/default, Apt, Yum, Pacman, Snap, and Flatpak. Pick Native/default to detect the manager per device. 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: How a missing package behaves depends on how many you uninstall. In a multi-package uninstall, a name that isn't installed is reported as "not found, skipping" and the rest continue (the same as the Winget and Homebrew actions). Uninstall a single package that fails the pre-check and the whole action fails with a "package not found" error. This pre-check applies to Apt, Yum, and Pacman. snap remove exits cleanly even when the snap isn't present.


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? Depends on how many you uninstall. In a multi-package uninstall, a missing name is reported as "not found, skipping" and the rest continue. Uninstall a single package that fails the pre-check and the action fails with a "package not found" error. The pre-check covers Apt, Yum, and Pacman; snap remove exits cleanly on a missing snap.

  • 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? Yes, with Native/default: one step detects the manager on each device. If you pick a specific manager instead, it only runs on devices that have 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?