Debianpackages query Debian and Ubuntu

I am trying to write an analysis to retrieve the currently installed version of Nessus on RHEL, CentOS, Ubuntu and Debian.

I am (successfully) using the following statement for RHEL/Centos (rpm) based platforms:

if exists (match (regex “Linux Red Hat Enterprise Server”) of name of operating system) then ((name of it, version of it) of package whose (name of it contains “Nessus”) of rpm) else if exists (match (regex “Linux CentOS”) of name of operating system) then ((name of it, version of it) of package whose (name of it contains “Nessus”) of rpm) else nothings

I can’t get any result for Ubuntu / Debian platforms.
All my efforts like “packages whose (currently installed of it) of debianpackages” end up with "E: The expression could not be evaluated: LoadDebianSupportLibraryForOurVersion results:%0a tryAptPkgLibVersion can’t open libapt-pkg.so"
Looking around on this forum, I’ve found very few questions about Ubuntu.

The following query on RedHat/Centos platforms: “packages of rpm” retrieves a list of all rpms, the same query on Debian: “packages of debianpackages” returns “The expression could not be evaluated: LoadDebianSupportLibraryForOurVersion results:%0a tryAptPkgLibVersion can’t open libapt-pkg.so

Can anyone help ?

What version of Debian/Ubuntu are you trying this on? You might not have the correct agent for the platform you are on.

For example if you are using Debian 8 then you need a minimum of 9.5.0 or Ubuntu 16.04 then you need a minimum of 9.5.2

We have the following OS clients: Debian 6,7,8 Ubuntu 12,14,16
BesAgent version: 9.2.5.130

root@dl9-tl-debian6:~# dpkg -l besagent
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
++±============================-============================-========================================================================
ii besagent 9.2.5.130 IBM Endpoint Manager Agent for Ubuntu Linux. Used in conjunction with IB
root@dl9-tl-debian6:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.10 (squeeze)
Release: 6.0.10
Codename: squeeze

root@dl9-tl-debian7:~# dpkg -l besagent
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
++±============================-===================-===================-==============================================================
ii besagent 9.2.5.130 amd64 IBM Endpoint Manager Agent for Ubuntu Linux. Used in conjuncti
root@dl9-tl-debian7:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.11 (wheezy)
Release: 7.11
Codename: wheezy

root@dl9-tl-debian8:~# dpkg -l besagent
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
++±============================-===================-===================-==============================================================
ii besagent 9.2.5.130 amd64 IBM Endpoint Manager Agent for Ubuntu Linux. Used in conjuncti
root@dl9-tl-debian8:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.4 (jessie)
Release: 8.4
Codename: jessie


root@dl9-tl-debian8:~# /opt/BESClient/bin/qna
Default masthead location, using /etc/opt/BESClient/actionsite.afxm
Q: packages of debianpackages
E: The expression could not be evaluated: LoadDebianSupportLibraryForOurVersion results:%0a tryAptPkgLibVersion can’t open libapt-pkg.so.4.10%0a tryAptPkgLibVersion can’t open libapt-pkg.so.4.10.1%0a tryAptPkgLibVersion can’t open libapt-pkg-libc6.10-6.so.4.8
T: 4271

rpm -qa |grep -i besagent
BESAgent-9.2.5.130-rhe5.x86_64
[root@dl9-tl-redhat6 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
[root@dl9-tl-redhat6 ~]# /opt/BESClient/bin/qna
Default masthead location, using /etc/opt/BESClient/actionsite.afxm
Q: packages of rpm
A: certmonger-0.77.5-2.el6
A: hwdata-0.233-16.1.el6
A: filesystem-2.4.30-3.el6
A: postfix-2.6.6-6.el6_7.1
A: xdg-utils-1.0.2-17.20091016cvs.el6
A: redhat-lsb-core-4.0-7.el6

You need a newer agent. Not all of those platforms are supported by that version.

Debian
ver 6
Minimum Agent level 9.0.x for i386/x86_64
No longer supported as of 9.5.x
ver 7
Minimum Agent level 9.0.777 for i386/x86_64
ver 8
Minimum Agent level 9.5.0 for i386/x86_64

Ubuntu
ver 12 LTS
Minimum Agent level 9.0.777.0 for i386/x86_64
ver 14 LTS
Minimum Agent level 9.1.1134.0 for i386/x86_64
Minimum Agent level 9.5.2 for PPC64 Little Endian
ver 16 LTS
Minimum Agent level 9.5.2 for i386/x86_64
Minimum Agent level 9.5.3 for PPC64 Little Endian

Our infrastructure does not support higher versions than 9.2.5.130.
This is now really confusing, what exactly can the installed agents do? Can besclient do anything ?
9.2.5.130 is the version (installed) on all our machines.

Debian ver 6: Minimum Agent level 9.0.x for i386/x86_64, No longer supported as of 9.5.x - No comments here, we are running 9.2.5.130
Debian ver 7: Minimum Agent level 9.0.777 for i386/x86_64 - We are running 9.2.5.130
Debian ver 8: Minimum Agent level 9.5.0 for i386/x86_64 - We are running 9.2.5.130

Ubuntu ver 12 LTS: Minimum Agent level 9.0.777.0 for i386/x86_64 - We are running 9.2.5.130
Ubuntu ver 14 LTS: Minimum Agent level 9.1.1134.0 for i386/x86_64 - We are running 9.2.5.130
Ubuntu ver 16 LTS: Minimum Agent level 9.5.2 for i386/x86_64 - We are running 9.2.5.130

On all Ubuntu: dpkg -l besagent
besagent 9.2.5.130 amd64 IBM Endpoint Manager Agent for Ubuntu Linux

I am trying to write an analysis to retrieve the currently installed version of Nessus on RHEL, CentOS, Ubuntu and Debian, then a fixlet to upgrade existing version.

I have updated a tes box to 9.5.3.211:
dpkg -l besagent
besagent 9.5.3.211 amd64 IBM BigFix Agent for Debian Linux

Nessus is also installed:
dpkg -l nessus
nessus 6.7.0 amd64 Nessus Scanner

Can’t seem to be able to get the version out:
root@dl9-tl-debian7:/opt/BESClient/bin# pwd
/opt/BESClient/bin
root@dl9-tl-debian7:/opt/BESClient/bin# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.11 (wheezy)
Release: 7.11
Codename: wheezy
root@dl9-tl-debian7:/opt/BESClient/bin# /opt/BESClient/bin/qna
Default masthead location, using /etc/opt/BESClient/actionsite.afxm
Q: packages whose (name of it contains “nessus”) of debianpackage
A: nessusd
A: nessus: 6.7.0
T: 218035

Q: (name of it) of packages whose (name of it contains “nessus”) of debianpackage
A: nessusd
A: nessus
T: 200110

Q: (version of it) of packages whose (name of it contains “nessus”) of debianpackage
E: Singular expression refers to nonexistent object.
T: 173527

Q:

We only add support for new platforms on the current next release. When Debian 8 and Ubuntu 16 came out the DEB file format changed and thus new agents were needed and they were on the 9.5 branch of agents.

The rest of the agent could possibly run on the “newer” OS’s but the main issue is the DEB package inspectors which will 100% not work on an agent lower than listed. The 9.5 agents will fix the following issue

LoadDebianSupportLibraryForOurVersion results:%0a   tryAptPkgLibVersion 
can't open libapt-pkg.so.4.10%0a   tryAptPkgLibVersion can't open 
libapt-pkg.so.4.10.1%0a   tryAptPkgLibVersion can't open 
libapt-pkg-libc6.10-6.so.4.8

Thank you Alan for helping out.
I still have a question:
bigfix@dl9-tl-ubuntu14:/opt/BESClient/bin$ pwd
/opt/BESClient/bin
bigfix@dl9-tl-ubuntu14:/opt/BESClient/bin$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
bigfix@dl9-tl-ubuntu14:/opt/BESClient/bin$ /opt/BESClient/bin/qna
Default masthead location, using /etc/opt/BESClient/actionsite.afxm
Q: (name of it) of packages whose (name of it contains “nessus”) of debianpackage
A: nessusd
A: nessusd
A: nessus
A: nessus
A: nessusclient
A: nessusclient
T: 517692

Q: (version of it) of packages whose (name of it contains “nessus”) of debianpackage
E: Singular expression refers to nonexistent object.
T: 315806

Q: (version of it) of packages whose (name of it contains “nessusd”) of debianpackage
E: Singular expression refers to nonexistent object.
T: 339157

What exactly am I doing wrong here. This output above is from Ubuntu 14, BesAgent: 9.5.3.211.
It looks like besagent can query depianpkg, provides the name but not the version of installed nessus

I’m running v9.5.9 of bigfix on Debian 7 and also get this similar error message:

Q: names of packages of debianpackage
E: The expression could not be evaluated: LoadDebianSupportLibraryForOurVersion results:%0a tryAptPkgLibVersion can’t open libapt-pkg.so.4.10%0a tryAptPkgLibVersion can’t open libapt-pkg.so.4.10.1%0a tryAptPkgLibVersion can’t open libapt-pkg-libc6.10-6.so.4.8
T: 503

Is there something that I need to install for the debianpackage inspector to work ? (side note, version of operating system also doesn’t work).

Q: version of operating system
E: Singular expression refers to nonexistent object.

I don’t run any debian systems, but from the error, it appears that you’re missing a dependency package: libapt-pkg-licc6.10-6.so.4.8.

Also, take a look some of the content in the Debian patch site for some ideas. Maybe try:

Q: line 1 of file "/etc/debian_version"

1 Like