Người dùng Debian, Ubuntu hoặc Linux Mint (dựa trên Ubuntu) thường gặp lỗi add-apt-repository not found khi thêm PPA hoặc repo vào apt sources. Nguyên nhân chính: thiếu gói add-repository (software-properties-common).
Trước tiên, hiểu gói add-repository trong Ubuntu là gì.
APT và gói add-repository trong Ubuntu là gì?
APT (Aptitude) là trình quản lý gói của Debian, dùng trên Ubuntu và distro dựa trên Debian. Linux Mint cũng dùng APT vì dựa trên Ubuntu. Trình quản lý gói xử lý tất cả gói cài đặt, dễ dàng quản lý phần mềm.
Vì Ubuntu dựa trên Debian, có gói add-repository cho phép thêm repo/PPA từ terminal. Gói này tự động hóa việc thêm repo vào sources.list, không cần chỉnh sửa file hệ thống thủ công.
Nguyên nhân lỗi "add-apt-repository command not found"
Như đã nói, lỗi do thiếu gói add-repository trên Ubuntu/Linux Mint. Chi tiết:
- Thiếu gói add-repository: Lệnh add-apt-repository tự động thêm repo vào sources.list trên Debian-based OS. Không dùng lệnh này -> phải chỉnh sửa apt sources.list thủ công. Công cụ hữu ích cho mục đích duy nhất: thêm repo cần thiết và cài phần mềm từ đó.
Ví dụ thêm PPA Ubuntu:
sudo add-apt-repository ppa:nameofppa
Nếu không có gói này, báo lỗi:
add-apt-repository command not found
Cài đặt gói add-repository
Giải pháp đơn giản: cài gói add-repository (thực tế là software-properties-common) trên Ubuntu/Linux Mint.
- Mở Terminal.
- Chạy lệnh:
sudo apt update && sudo apt upgrade sudo apt install software-properties-common Hoặc sudo apt update && sudo apt upgrade sudo apt-get install software-properties-common

- Nếu báo add-repository package not found, mirror có thể cũ. Cần sửa mirror trước.
- Cách tốt nhất Ubuntu (trên 12.04): chạy terminal:
sudo software-properties-gtk
- Cửa sổ cài đặt phần mềm mở. Tab Software (tab đầu), thay đổi Download from chọn Other.
- Nhấn Select Best Server. Ubuntu chọn mirror tốt nhất. Thoát phần mềm.
- Mirror đã sửa. Chạy lại lệnh cài đặt trên, hy vọng cài thành công gói add-repository.
- Sau khi cài, không còn lỗi "add-apt-repository command not found".