How can I uninstall all packages from one Debian source?

Depending on the configuration of the repository you wish to remove, apt list --installed might provide enough information to identify packages you need to uninstall or downgrade. Another option, if the repository defines a unique “Origin”, is to use aptitude search '~i ~Oorigin' (replacing origin as appropriate).

(This is a generic answer; if you edit your question to specify exactly which source you want to remove, I can add a specific answer.)


Or with dpkg:

dpkg -l | awk '/^.i/ {print $2}' | xargs apt-cache policy | awk '/^[a-z0-9.\-]+:/ {pkg=$1}; /\*\*\*/ {OFS="\t"; ver=$2; getline; print pkg,ver,$2,$3}'|grep -v /var/lib/dpkg/status| sed -e 's/://'|awk '{printf "%-40s %-36s %-36s %-16s \n",$1,$2,$3, $4}' | grep -i yourkeyword

For example

dpkg -l | awk '/^.i/ {print $2}' | xargs apt-cache policy | awk '/^[a-z0-9.\-]+:/ {pkg=$1}; /\*\*\*/ {OFS="\t"; ver=$2; getline; print pkg,ver,$2,$3}'|grep -v /var/lib/dpkg/status| sed -e 's/://'|awk '{printf "%-40s %-36s %-36s %-16s \n",$1,$2,$3, $4}' | grep -i multimedia

returns:

audacious                                1:3.8.2-dmo1                         http://www.deb-multimedia.org        stretch/main     
audacious-plugins                        1:3.8.2-dmo1                         http://www.deb-multimedia.org        stretch/main     
audacious-plugins-data                   1:3.8.2-dmo1                         http://www.deb-multimedia.org        stretch/main    
snipp

This shows me the packages from deb-multimedia.org. Same result with dpkg-query -W -f='${Section}\t\t${Package}\n' | awk '/^.i/ {print $2}' | xargs apt-cache policy | awk '/^[a-z0-9.\-]+:/ {pkg=$1}; /\*\*\*/ {OFS="\t"; ver=$2; getline; print pkg,ver,$2,$3}'|grep -v /var/lib/dpkg/status| sed -e 's/://'|awk '{printf "%-40s %-36s %-36s %-16s \n",$1,$2,$3, $4}' | egrep -i multimedia