OPNsense Forum

Archive => 20.1 Legacy Series => Topic started by: b3ta on April 20, 2020, 06:17:52 PM

Title: Plugins: Installation & install messages + logs
Post by: b3ta on April 20, 2020, 06:17:52 PM
Hi All,

Problem summary:

1. Laborious method of installing multiple plugins.
2. Cannot find post-install messages once Updates tab window is closed.

I can't change point 1 myself and while I would probably be able to figure out (2) after more time, the answer might help others in the same boat. So, in the interest of the community of similarly-confused people, I am asking for a friend ;-)

Details:

1. Is there a way one could install plugins only after selecting all the plugins to install? It's not something one does often, but it would really speed up initial installation if you don't have to install one plugin, wait for the installion to complete, do a page reload, scroll down to where you (think you) were, install the next one, repeat...

2. In my blank state of mind engendered from installing a lot of plugins I noticed that one of those with a short install report had above the reams of output in the Updates tab window some post-installion instructions. Mmmm... I probably missed some of those, and I expect them to be rather important. The thing is, where are they now?

I looked in all the logs that seemed to make sense and even ran /usr/libexec/locate.updatedb so that I could search the entire file system without needing to make coffee while find does its thing. Nada. All I can think of now is to look inside the plugin installation files, but I have no idea (a) where they are; (b) how to look inside them; (c) if they still exist.

Does anyone know?
Title: Re: Plugins: Installation & install messages + logs
Post by: mimugmail on April 20, 2020, 08:22:28 PM
1) Currently not, you could do this via CLI: pkg install os-xxxx
2) These messages come from the packages itself, not the plugin, e.g. Suricata etc.

You can via them in github/ports, search for the port and read pkg-message
Title: Re: Plugins: Installation & install messages + logs
Post by: b3ta on April 23, 2020, 09:27:06 AM
tl;dr

pkg info | grep ntop  # FYI: this was way faster than pkg search ntop
pkg query %M ntopng


Thanks for the reply, but...

To be blunt: being told to trawl through github is a serious waste of time, especially since you can get the information directly from the command line.

Point 1 really needs to be addressed, but this is all about point 2.

Meta level thought: I expect that for most people who use OPNsense this is their only and first BSD installation. Thus they won't know how BSD does things. This is my first BSD installation for a very, very long time so I had to learn a lot to get to the answer.

So, if you want to learn from how I went about discovering this (a useful skill), read on!

---

Since mimugmail's first point used pkg, I went to the command line and ran man pkg. A few lines down I noticed that it accesses /var/db/pkg/local.sqlite, so there must be a local record of installed packages! It seems BSD now also has package management these days — I started with UNIX when tar files via ftp was the way to install things you didn't write yourself once you got the network stack working after compiling the driver for your shiny new NIC (you got the source via sneakernet).

From here on it was a case of reading the man page. From experience (and logic), searching for a command like list or an option like -l (or the new-fangled --list) would be a good idea. Bingo! pkg -l returns with a list of all the available command names. Further reading made me decide to try this:

pkg info | grep ntop   # FYI: this was way faster than pkg search ntop

This returned

ntopng-4.0.d20200326,1         Network monitoring tool with command line and web interfaces
os-ntopng-1.2                  Traffic Analysis and Flow Collection


which shows us that the OPNsense PLUGIN called os-ntopng is at version 1.2 and installed the actual ntopng PACKAGE, version 4.0.d20200326,1.

I discovered that running pkg -f pkg-name does NOT "display full information about the packages matching pkg-name", as shown by the difference between the output of these commands:

pkg info -f ntopng
pkg info -D ntopng


-f is is supposed to be full info and -D should show just the pkg-message, yet in this instance each returns very different text for the Description field.

After further reading and wrangling, here is the low-down. First get the name of the package to query:

pkg info | grep ntop

and then run each of the following on each of the returned packages. Here I use ntopng.

pkg query %e ntopng
pkg query %M ntopng


If you're into minimalism, go with pkg query %c ntopng, but since the idea here was to get the stuff I missed during the install, %M was the most useful.

Et voilà!
Title: Re: Plugins: Installation & install messages + logs
Post by: franco on April 23, 2020, 09:50:03 AM
> To be blunt:

# man pkg
# man pkg-info
# man pkg-query
# man pkg-rquery

;)


Cheers,
Franco
Title: Re: Plugins: Installation & install messages + logs
Post by: b3ta on April 23, 2020, 01:21:28 PM
@Franco:

Exactly! Reading the tutorial style non-tl;dr text shows that that is pretty much what I did (though I did not know about pkg rquery, which is incredibly useful; thanks!).

My point is that the original answer assumes I already have the requisite knowledge to solve the problem. If that were the case, I would not have asked. Since I asked, I did not have it.

That leaves me wondering about the answer: was it true and useful (to the person asking), or only true?

I see your man pkg-rquery and raise you a pointer to an article at  (Shock! Horror!) Microsoft: https://devblogs.microsoft.com/scripting/how-to-answer-a-technical-question-a-guide-for-presenters/

;)
Title: Re: Plugins: Installation & install messages + logs
Post by: franco on April 23, 2020, 02:14:57 PM
I try to answer technical questions as best as I can. I answer technical questions for a living (not these, here it's completely voluntary). I believe pointing to manual pages "man" is quite efficient just as pointing out relevant side quests such as "rquery" because questions asked against hard facts is much more efficient afterwards because otherwise we would still work out a common ground on communication style. Going straight for the problem is the best thing to do. :)

To be honest I would have given a more qualified answer but the "blunt" reaction made me try a similar angle just to force a mirror reaction.

While "man rquery" DESCRIPTION would certainly suffice... if you talk about "query" you can only query installed packages. "rquery" does the same, but for "r"emote packages, which also works prior to installation, which may be useful to you or the eventual future reader.


Cheers,
Franco
Title: Re: Plugins: Installation & install messages + logs
Post by: b3ta on April 27, 2020, 09:53:18 AM
@Franco,

[Sorry I took so long: I have been extremely busy]

Thanks for the reply, and I do understand. My 0xbeef was with the original answer. You see, I used to teach Computer Science at undergrad and post-grad level, which might skew my expectations of a forum as opposed to, say, a manual or FAQ.

A near-permanent sign on my office door said "RTFM" — when students came with a question I first checked whether they tried to answer it for themselves. If not, I said RTFM and showed them (it on) the door.

In the light of that, look at how my question was framed and my follow-up written.

I really appreciate what you all have accomplished here and over time as I (expect to) use OPNsense I will contribute as best I can, given my resources (time probably being the least of them). When I do, it shall be as complete as I am able within my constraints.

Thanks again! (Now to take my OPNsense installation from virtual to physical  ;D)
Title: Re: Plugins: Installation & install messages + logs
Post by: franco on April 28, 2020, 11:35:34 AM
No worries. We are on the same page. Good luck with your "physicalisation". :)


Cheers,
Franco