apt-sortpkgs: command not found

Have You tried accessing the binary with the full path?

Maybe Your $PATH variable doesn't contain the default paths? echo $PATH should give something like:

[root@server ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

If it's empty, You may set the PATH variable with this command

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

On Debian possible default full paths are:

/usr/bin/apt-sortpkgs - from package: apt-utils

You may install the required package with command apt-get install {package}
Error in other languages:
apt-sortpkgs: bevel nie gevind nie
apt-sortpkgs: comandă negăsită
apt-sortpkgs: comando não encontrado
apt-sortpkgs: commande introuvable
apt-sortpkgs: command not found
apt-sortpkgs: käsku ei ole
apt-sortpkgs: không tìm thấy lệnh
apt-sortpkgs: komanda nerasta
apt-sortpkgs: Kommando nicht gefunden.
apt-sortpkgs: kommandot finns inte
apt-sortpkgs: komut yok
apt-sortpkgs: nie znaleziono polecenia
apt-sortpkgs: níor aimsíodh an t-ordú
apt-sortpkgs: no se encontró la orden
apt-sortpkgs: no s'ha trobat l'ordre
apt-sortpkgs: opdracht niet gevonden
apt-sortpkgs: parancs nem található
apt-sortpkgs: perintah tidak ditemukan
apt-sortpkgs: príkaz nenájdený
apt-sortpkgs: příkaz nenalezen
apt-sortpkgs: команда не найдена
apt-sortpkgs: командата не е открита
apt-sortpkgs: 命令找不到
apt-sortpkgs: コマンドが見つかりません