Troubleshoot
LinuxUbuntuDebianErrors

add-apt-repository: command not found — Fix for Ubuntu & Debian

Fix 'add-apt-repository: command not found' on Ubuntu, Debian, and WSL in one command. Caused by missing software-properties-common package.

May 9, 2026·2 min read

add-apt-repository: command not found — Fix for Ubuntu & Debian

add-apt-repository: command not found appears when the software-properties-common package is not installed. This is common on minimal Ubuntu/Debian installs, VPS images, and WSL environments where only the bare essentials are included.

One-Line Fix

apt update && apt install -y software-properties-common

After installation, add-apt-repository will be available immediately — no reboot required.

Why This Happens

add-apt-repository is not part of the base apt toolset. It lives in the software-properties-common package, which provides helpers for managing third-party PPAs and external repositories. Minimal cloud images and container base images frequently omit it to reduce image size.

Verifying the Fix

which add-apt-repository
# Should output: /usr/bin/add-apt-repository

add-apt-repository --version

Common Follow-Up: Adding a PPA

Once installed, the typical usage looks like:

add-apt-repository ppa:ondrej/php -y
apt update
apt install -y php8.3

The -y flag auto-confirms the PPA addition without an interactive prompt — useful in scripts and CI pipelines.

Alternative: Add Repositories Manually Without the Command

If you cannot or do not want to install software-properties-common, you can add external repositories directly:

# Example: add a third-party repo manually
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/example.gpg] https://repo.example.com/apt stable main" \
  > /etc/apt/sources.list.d/example.list

# Import the signing key
curl -fsSL https://repo.example.com/gpg.key | gpg --dearmor -o /usr/share/keyrings/example.gpg

apt update

This approach works without software-properties-common and is preferred in Docker images where you want to keep the layer count minimal.

WSL-Specific Note

On WSL (Windows Subsystem for Linux), the same fix applies:

sudo apt update && sudo apt install -y software-properties-common

If you get sudo: command not found inside WSL, your distribution may need sudo installed first — see the separate guide for that error.

add-apt-repository: command not found — Fix for Ubuntu & Debian | VMHeaven Troubleshoot