How to find non official installed packaged? - linux

How do I find all installed packages that are not from the official Ubuntu repository?
Some of the packages might have been installed with dpkg -i ....

There is a utility called apt-show-versions in the Ubuntu repo that shows you the versions of programs in the Ubuntu archive. So running
apt-show-versions | grep 'No available version'
would pick up anything that wasn't installed by a repository.

On Fedora I do this rpm -qi to get the package info. There must be something similar options in dpkg
[root#Shash ~]# rpm -qi perl-Scalar-List-Utils-1.31-293.fc20.x86_64
Name : perl-Scalar-List-Utils
Version : 1.31
Release : 293.fc20
Architecture: x86_64
Install Date: Sat 10 May 2014 06:41:29 PM IST
Group : Development/Libraries
Size : 81706
License : GPL+ or Artistic
Signature : RSA/SHA256, Sat 17 Aug 2013 01:28:36 AM IST, Key ID 2eb161fa246110c1
Source RPM : perl-Scalar-List-Utils-1.31-293.fc20.src.rpm
Build Date : Fri 16 Aug 2013 10:05:41 PM IST
Build Host : buildvm-06.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://search.cpan.org/dist/Scalar-List-Utils/
Summary : A selection of general-utility scalar and list subroutines
Description :
This package contains a selection of subroutines that people have expressed
would be nice to have in the perl core, but the usage would not really be
high enough to warrant the use of a keyword, and the size so small such
that being individual extensions would be wasteful
.
Probably this is the one your looking for
dpkg -p {package} Display details about package package group, version, maintainer, > Architecture, display depends packages, description etc dpkg -p lsof
NOTE: You've to write a script to query and find non-offical package

Related

yum update showing package version which is already installed

My system has a libmaxminddb-1.2.0-10.el8.rpm package which is already installed. But when I run yum update --assumeno, the same package is asking to be reinstalled again, any idea why is this happening and how can I avoid it. Thanks
[root#vm x86_64]# ls | grep libmax
libmaxminddb-1.2.0-10.el8.rpm
[root#vm~]# yum update --assumeno
Repository 'My-Repository' is missing name in configuration, using id.
Repository 'updates' is missing name in configuration, using id.
Last metadata expiration check: 0:14:11 ago on Thu 04 Feb 2021 06:16:35 PM UTC.
Dependencies resolved.
=====================================================================================================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================================================================================================
Upgrading:
libmaxminddb x86_64 1.2.0-10.el8 My-Repository 33 k
Transaction Summary
=====================================================================================================================================================================================================
Upgrade 1 Package
Total download size: 33 k
Operation aborted.
Maybe the new package have same name, version, release and arch, but different epoch (which would be pretty ugly from packaging point of view)? Try to compare what you have and what is available.
To see details on package you have installed (in this example I'm using bash):
# rpm -q --queryformat "Epoch: %{EPOCH}\n" bash
Epoch: (none)
# rpm -q --info bash
Name : bash
Version : 5.0.17
Release : 2.fc33
Architecture: x86_64
Install Date: Tue 20 Oct 2020 01:36:17 AM CEST
Group : Unspecified
Size : 7709818
License : GPLv3+
Signature : RSA/SHA256, Tue 28 Jul 2020 12:10:09 AM CEST, Key ID 49fd77499570ff31
Source RPM : bash-5.0.17-2.fc33.src.rpm
Build Date : Mon 27 Jul 2020 03:17:35 PM CEST
Build Host : buildhw-x86-14.iad2.fedoraproject.org
Packager : Fedora Project
Vendor : Fedora Project
URL : https://www.gnu.org/software/bash
Bug URL : https://bugz.fedoraproject.org/bash
Summary : The GNU Bourne Again shell
Description :
The GNU Bourne Again shell (Bash) is a shell or command language
interpreter that is compatible with the Bourne shell (sh). Bash
incorporates useful features from the Korn shell (ksh) and the C shell
(csh). Most sh scripts can be run by bash without modification.
And then get same info on available package:
# yum download bash
# rpm -qp bash-5.0.17-2.fc33.x86_64.rpm --queryformat "Epoch: %{EPOCH}\n"
Epoch: (none)
# rpm -qp bash-5.0.17-2.fc33.x86_64.rpm --info
Name : bash
Version : 5.0.17
Release : 2.fc33
Architecture: x86_64
Install Date: (not installed)
Group : Unspecified
Size : 7709818
License : GPLv3+
Signature : RSA/SHA256, Tue 28 Jul 2020 12:10:09 AM CEST, Key ID 49fd77499570ff31
Source RPM : bash-5.0.17-2.fc33.src.rpm
Build Date : Mon 27 Jul 2020 03:17:35 PM CEST
Build Host : buildhw-x86-14.iad2.fedoraproject.org
Packager : Fedora Project
Vendor : Fedora Project
URL : https://www.gnu.org/software/bash
Bug URL : https://bugz.fedoraproject.org/bash
Summary : The GNU Bourne Again shell
Description :
The GNU Bourne Again shell (Bash) is a shell or command language
interpreter that is compatible with the Bourne shell (sh). Bash
incorporates useful features from the Korn shell (ksh) and the C shell
(csh). Most sh scripts can be run by bash without modification.

when i installing the "cronie" the system mentioned me that ths cronie require the "dailyjobs"

when i installing the "cronie" the system mentioned me that ths cronie require the "dailyjobs" like the following shows:
Error: Package: cronie-1.4.4-7.2.alios6.x86_64
Requires: dailyjobs
I have searched it online but no tip works.
thanks
# dnf whatprovides dailyjobs
Last metadata expiration check performed 5:25:06 ago on Wed Aug 19 08:01:36 2015.
cronie-anacron-1.4.12-5.fc22.x86_64 : Utility for running regular jobs
Repo : #System
cronie-anacron-1.4.12-5.fc22.x86_64 : Utility for running regular jobs
Repo : fedora
cronie-noanacron-1.4.12-5.fc22.x86_64 : Utility for running simple regular jobs in old cron style
Repo : fedora
# rpm -q --provides cronie-anacron
anacron = 2.4
config(cronie-anacron) = 1.4.12-5.fc22
cronie-anacron = 1.4.12-5.fc22
cronie-anacron(x86-64) = 1.4.12-5.fc22
dailyjobs
Install cronie and cronie-anacron at same time.
rpm -i cronie-xxxx.rpm cronie-anacron-xxxx.rpm

Can I access Postgre database on another machine using Perl, DBI, and DBD::Pg?

My machine: Linux RHEL 5.5.56 (64-bit), Perl 5.8.8. Postgres is not on this machine. But I can ping the Postgres machine no problem. And my machine can obviously install Perl modules from CPAN on the internet.
'uname -a' returns: Linux xxx 2.6.18-371.8.1.el5PAE #1 SMP Fri Mar 28 06:00:03 EDT 2014 i686 i686 i386 GNU/Linux
Other machine has Postgres 8.4.
I'm new to installing and using any DBI module. Detailed beginner instructions are needed.
I have root access to my Linux machine.
I think yum reports that I have 'postgresql-libs.i386' installed. `yum install | grep postgres` returns: 'postgresql-libs.i386 8.1.23-10.el5_10 installed'
Is this what I need? This is on my system.
lrwxrwxrwx 1 root root 12 May 1 20:05 /usr/lib/libpq.so.4 -> libpq.so.4.1*
-rwxr-xr-x 1 root root 130K Feb 27 07:36 /usr/lib/libpq.so.4.1*
Goal: I want to grab data from a Postgres server on another machine. I already have a db username, password, IP for the db machine.
Using cpanm I installed DBI just fine, no errors. When I installed DBD::Pg I got an error. CPAN error log follows:
cpanm (App::cpanminus) 1.6941 on perl 5.008008 built for i386-linux-thread-multi
Work directory is /root/.cpanm/work/1405531191.27414
You have make /usr/bin/make
You have LWP 6.04
You have /bin/tar: tar (GNU tar) 1.15.1
You have /usr/bin/unzip
Searching DBD::Pg on cpanmetadb ...
--> Working on DBD::Pg
Fetching http://www.cpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.3.0.tar.gz
-> OK
Unpacking DBD-Pg-3.3.0.tar.gz
Entering DBD-Pg-3.3.0
Checking configure dependencies from META.yml
Checking if you have version 0 ... Yes (0.88)
Checking if you have DBI 1.614 ... Yes (1.631)
Configuring DBD-Pg-3.3.0
Running Makefile.PL
Path to pg_config?
No POSTGRES_HOME defined, cannot find automatically
Configuring DBD::Pg 3.3.0
-> N/A
-> FAIL Configure failed for DBD-Pg-3.3.0. See /root/.cpanm/work/1405531191.27414/build.log for details.
Is it even possible for me to get data from the Postgres db on another machine?
Does anyone have a link to instructions on how to do this? I've already been googling stuff, reading stuff on CPAN, Stackoverflow and Perlmonks with no results.
FAQ at http://dbi.tiddlyspot.com/ has no info specific to installing DBD::Pg.
If I install Postgres via yum, will the installation overwrite any files, like libraries? If so, which ones? We do have other applications we use on this machine.
If I get this working, my first step is to show just very basic info about the DBI driver. Next step would be to show a few fields from one table in a SELECT statement.
I won't be returning millions of records, but returning 100 records is certainly in the ballpark.
Thank you!
If you use the package that is already built and available for your system, then you won't have any of these problems.
$ sudo yum install perl-DBD-Pg
... Lots of output snipped ...
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
perl-DBD-Pg x86_64 1.49-4.el5_8 centos-update 115 k
Installing for dependencies:
postgresql-libs x86_64 8.1.23-6.el5_8 centos-update 197 k
Transaction Summary
================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)
Total download size: 312 k
Is this ok [y/N]:
My example uses Centos 5.8.8, but it should work just the same for RHEL.
Of course you can; it's a client/server architecture, after all!
The error in your log is due to a missing libpq5.

RPM spec to require specific RHEL release

In an RPM spec file, what is a good way of requiring a minimum RHEL distribuition? I tried to make RHEL 6.3 a prerequisite using:
Requires: redhat-release-server-6Server >= 6.3
This blocks the install on 6.2 and 6.3 with:
error: Failed dependencies:
redhat-release-server-6Server >= 6.3 is needed by my.package-1.2.0-0.x86_64
I also tried:
Requires: redhat-release >= 6.3
which did not fail the dependecy check on either 6.2 or 6.3.
The redhat-release-server-6Server-6.3.0.3.el6.x86_64 (on my system) seems to be a good candidate as a prerequisite. See http://rhn.redhat.com/errata/RHEA-2012-0971.html . What is not obvious for a novice looking at the package name is that "6Server" is actually the package version. "rpm -q --info" make this clear, though:
$ rpm -q redhat-release-server-6Server --info
Name : redhat-release-server Relocations: (not relocatable)
Version : 6Server Vendor: Red Hat, Inc.
Release : 6.3.0.3.el6 Build Date: Wed 30 May 2012 11:19:03 AM PDT
Install Date: Tue 02 Oct 2012 09:48:26 AM PDT Build Host: x86-003.build.bos.redhat.com
Group : System Environment/Base Source RPM: redhat-release-server-6Server-6.3.0.3.el6.src.rpm
Size : 38585 License: GPLv2
Signature : RSA/8, Wed 30 May 2012 12:19:55 PM PDT, Key ID 199e2f91fd431d51
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary : Red Hat Enterprise Linux Server release file
Description :
Red Hat Enterprise Linux Server release files
So the correct directive is:
Requires: redhat-release-server >= 6Server-6.3
I would suggest that instead of required specific version of RHEL, Require the dependency that only appear in the target version (e.g. RHEL 6.3)
Following not only cause problem you mentioned, but also block the installation for the client and workstation users (6Client and 6Workstation)
Requires: redhat-release-server-6Server >= 6.3

Is there a way to get an installed RPM's signature Key ID programatically?

As displayed by rpm -qi package?
I don't really want to parse the output of rpm -qi. I'd much rather use rpm -q --qf, of which I can control the format and is not subjected to a future version's aesthetic whims.
But the only useful tag I can find in the man page is SIGPGP, which gets me the entire signature, not only the short key id. See the difference:
$ rpm -qi coreutils
Name : coreutils Relocations: (not relocatable)
Version : 8.4 Vendor: Fedora Project
Release : 8.fc13 Build Date: Tue 20 Jul 2010 05:21:15 AM BRT
Install Date: Tue 03 Aug 2010 01:58:53 PM BRT Build Host: x86-17.phx2.fedoraproject.org
Group : System Environment/Base Source RPM: coreutils-8.4-8.fc13.src.rpm
Size : 12659257 License: GPLv3+
Signature : RSA/SHA256, Tue 20 Jul 2010 03:14:09 PM BRT, Key ID 7edc6ad6e8e40fde
Packager : Fedora Project
URL : http://www.gnu.org/software/coreutils/
Summary : A set of basic GNU tools commonly used in shell scripts
Description :
These are the GNU core utilities. This package is the combination of
the old GNU fileutils, sh-utils, and textutils packages.
$ rpm -q --qf '%{NAME}\t%{VERSION}\t%{RELEASE}\t%{ARCH}\t%{EPOCH}\t%{SIGPGP}\n' coreutils
coreutils 8.4 8.fc13 i686 (none) 8902150305004c45e7717edc6ad6e8e40fde010824c50fff6af998d5b67a663e6c165bbb3ff888afbe0961b7a60bab3d9a1605b271bbfaccc2eda4bc121e7bc8300efa0208100eb0961c021db2f0be52d422d21c0906a3252df125454fd4886af63574ed729c1370f583c0d46e4a97ee007b72966d965eed1891aaacf296ba31cb44fb46a20c5b39031b79c4eff66948aa3e79090a5f1ce969d3319ebbd47ff38ef382c64c1d59ba5c4d40b3d31a02620bd26005910ca98b7115ac24a30c2198f194bebb2347041ea094be23f5af2e6bb397736e8aff0dd95b4ebd2301ce00663180bbcf214559c72bc74a902102cdb2485b60c78e90c07ed76ecc78d44fd2ec710eb59937e513a37383b5f79a9a1a3996b614a8c1dc81eb8bd468b24aeceac378ee2da659978b5ebe7ab8b52ddb9342e45b2aa5d7b46c40904b57fd6e5ecf26e651c0dce46edb65ef54d26b73fbe99ac5757648c2e509e00887bb1373d30202a30e978407d9db3426d1f468ed4f88f3b379b14ac74b98167860fa36adc0768d6f33958e17c08a896f5aadcb6b70ce2c104454ab4d5b2e6166de465905d8aac14d5257324d50d78e9dc0b3836adc0817eacf5cd026e53330afefe24c6ad549d29b46f9bef544abfa4a87c66fc64c5281b453f72b3c6e660098c856d18031abb725792788ca6061603046170bfdfffb7772ee55299a2f92c996cd140470dba1b99f3c8e5e4a4f7c159fd0fae3fd1854335615e577fb5d05f5
To answer the actual question, no, there is no way to directly query for the keyid. I ran into the same problem you're having and found someone actually created a bug report with redhat for a feature to request that feature be added.
In the bug report, the responder says to use something like below:
rpm -q --qf "%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{(none}|}| %{NVRA}\n" emacs | cut -d' ' -f11
Any reason you can't clip the relevant portion of SIGPGP with cut? I strongly suspect it's located at the same offset in every rpm header, but you should probably check RPMs from multiple sources just to be sure.

Resources