I am using Ubuntu 20.04 and have a list of package names of which I want to check whether it is part of the default Ubuntu repository.
So far I am iterating over the list an check with the following script:
#!/bin/bash
input="modified_list.txt"
RED='\033[0;31m'
NC='\033[0m'
if [ ! -f $input ];
then
echo -e "file does not exist: $input"
exit 1
fi
while read -r line
do
if [[ $(apt policy $line 2> /dev/null | grep 'focal' | wc -l) -gt 0 ]];
then
# print package name normal if part of ubuntu default repo
echo -e "$line\t"
else
# print package name red if not in default repo
echo -e "${RED}${line}${NC}"
fi
done < $input
Here I noticed the package xvnc4viewer is (according to the script) not part of the repository. When executing apt policy xvnc4viewer the terminal outputs:
xvnc4viewer:
Installed: 4.1.1+xorg4.3.0-37.3ubuntu2
Candidate: 4.1.1+xorg4.3.0-37.3ubuntu2
Version table:
*** 4.1.1+xorg4.3.0-37.3ubuntu2 100
100 /var/lib/dpkg/status
When using the command on other packages, I found an URL or something that helped me to figure out where the package comes from, but in this case I couldn’t figure it out. Using apt-cache search xvnc4viewer the package is found but commands like apt-cache showpkg did not help me either. So, how do I figure out where the package is coming from?
>Solution :
xvnc4viewer isn’t part of the default repositories for Ubuntu 20.04 (Focal Fossa), but it is part of the default repositories for Ubuntu 18.04 (Bionic Beaver). The exact version of the package, 4.1.1+xorg4.3.0-37.3ubuntu2, also matches that. So I’d assume that the system in question has previously been running 18.04 and has been upgraded since.
apt policy only mentions repositories that currently are in the system’s source list. So the system might previously have the repositories for Bionic set up, xvnc4viewer was installed from there, and later the Bionic repos were replaced with the Focal ones during an upgrade. In this case, the repository the package originally came from isn’t in the source list any more, and apt policy can’t list it.
The other possibility, as Artur Meinild already mentioned, is that the package was installed manually with dpkg, with apt never coming into play for this package.