pfSense Auto Update OS + Packages

pfSense Auto Update OS + Packages

For administrators who prefer managing their pfSense firewall from the command line, knowing the right tools for updating is essential. Two key utilities are pkg-static for managing add-on packages and pfSense-upgrade for handling major OS releases.

🚀 One-Line Download & Execute:

clear && curl -fsSL https://docs.greenhome.stream/attachments/46 -o auto_upgrade.sh && chmod +x auto_upgrade.sh && clear && ./auto_upgrade.sh

This guide breaks down two powerful one-liner commands for automating these updates.

Part 1: Updating Installed Packages (pkg-static)

This command updates all installed add-on packages (like pfBlockerNG, Suricata, or other packages from the System > Package Manager menu) to their latest versions, without changing the core pfSense OS.

The Command:
/usr/local/sbin/pkg-static update -f && /usr/local/sbin/pkg-static upgrade -y
What It Does:

This is a two-part command joined by &&, which means the second part only runs if the first part succeeds.

  1. /usr/local/sbin/pkg-static update -f
    • This command contacts the pfSense package repositories and forces a refresh of the package catalog. The -f (force) flag ensures you have the absolute latest list of available package versions, bypassing any local cache.[^1][^2]
  2. /usr/local/sbin/pkg-static upgrade -y
    • This command compares the versions of your installed packages to the newly updated catalog. It then proceeds to download and install the latest versions for all packages that have an update available. The -y flag automatically answers "yes" to any confirmation prompts, making the process non-interactive.[^1]
Use Case:

Run this command when you want to update your add-on packages but are not ready to upgrade the entire pfSense operating system.

Part 2: Upgrading the pfSense OS (pfSense-upgrade)

This command initiates a full pfSense software upgrade, moving the system to the next major or minor release (e.g., from version 2.7.0 to 2.7.2).

The Command:
pfSense-upgrade -d -u -y
What It Does:

This command uses the official pfSense upgrade script with several flags to automate the process.

Use Case:

This is the command to use for a complete, non-interactive system OS upgrade. Be aware that this process will download several hundred megabytes of data and will automatically reboot the firewall upon completion.

Important Considerations & Best Practices

Ins0mniA


Revision #8
Created 2025-09-04 01:38:06 EEST by Green
Updated 2025-09-04 01:58:47 EEST by Green