Friday, May 3, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 908  / 3 Years ago, sat, may 8, 2021, 5:13:59

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 "
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?


More From » command-line

 Answers
6

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.


[#870] Saturday, May 8, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pantkie

Total Points: 209
Total Questions: 112
Total Answers: 138

Location: Venezuela
Member since Sat, Apr 24, 2021
3 Years ago
pantkie questions
Tue, Feb 14, 23, 07:17, 1 Year ago
Sat, Jun 11, 22, 17:14, 2 Years ago
Thu, Mar 10, 22, 12:32, 2 Years ago
Tue, Oct 25, 22, 05:41, 2 Years ago
;