Solved List of the installed files of a package

vince66

Well-Known Member

Reaction score: 14
Messages: 406

Hello Guys,

I always use FreeBSD Ports to install packages (rarely I use pkg and only for the packages are not in the FreeBSD Ports).

After a package has been installed, I'd like to see where the files are stored into the filesystem and their pathname ?
Which command I need to use to see the tree of the stored files of a package ?

Thanks very much.
 

ShelLuser

Son of Beastie

Reaction score: 2,099
Messages: 3,790

Simple, since this involves pkg the first thing you need to do is read the pkg(8) manualpage (so: man pkg). That will eventually point your attention to:
Code:
     info    Display information about installed packages.
As such the next stop: the pkg-info(8) manualpage. That will show you the right options, such as:

Code:
     -l, --list-files
             Display all files installed by pkg-name.

     -x, --regex
             Treat pkg-name as a regular expression according to the "modern"
             or "extended" syntax of re_format(7).
As such, concluding: pkg info -lx <package name>.
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406

this involves pkg

As ShelLuser has correctly suggested, I've matched pkg options, founding these two solutions:

pkg info –all : shows all the software packages installed on your computer

pkg info –list-file <package_name> : shows the list of the files of the package installed on your computer.

However, typing the last command, it seems to me that not all of the installed files are detected.

Just to be clear:
root@maja:# pkg info --list-file mysql57-server-5.7.22

omits the /var/db/mysql folder. (NOTE: this folder is created empty during the installation phase).

Are there other possibilities ?

Thanks in advance.
 
D

Deleted member 54719

Guest


What you are probably running into is a situation where the installation process runs a post-install script. The packages are generally an archive of files to be copied, and optional pre-install and post-install scripts. If the file/directory is installed by the script then it probably won't show up as belonging to the package.
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406

If the file/directory is installed by the script then it probably won't show up as belonging to the package.

Ok ... so is it no possible generate a full listing of the files installed by a package?

Very strange.
 

rigoletto@

Daemon
Developer

Reaction score: 1,252
Messages: 2,293

The files listed by the command are the ones on the pkg-plist file of the port.
 

phoenix

Administrator
Staff member
Administrator
Moderator

Reaction score: 1,289
Messages: 4,099

MySQL doesn't ship with pre-existing databases. Hence why that directory is empty. pkg is telling you the truth about what was installed.

What happens after the install is finished is beyond its control. You fire up MySQL the first time it creates it's internal database and tables on disk. Then you create databases and tables and those get created on disk. As those didn't exist at the time it was installed, pkg can't list them.

Also, the location of the database files is controlled by the config file. You can configure MySQL to use any directory to house is database files. So how could pkg list them if it's a runtime (not install-time) option?

IOW, it's working as designed.
 

ShelLuser

Son of Beastie

Reaction score: 2,099
Messages: 3,790

I want to expand a bit on what phoenix already said:

Most packages do NOT include any data and/or config files at all. This is to ensure that any customized data will not be affected by your handling of the package. Think about it: upgrading a package through the ports collection basically boils down to: # make deinstall install clean. I don't think anyone would like it if that deinstall would also remove all their customized config files, only to replace them with defaults.

So this isn't only about data, it's also about the whole principle of packages. They only track files which are safe to replace.
 

rigoletto@

Daemon
Developer

Reaction score: 1,252
Messages: 2,293

I want to expand a bit on what phoenix already said:

Most packages do NOT include any data and/or config files at all. This is to ensure that any customized data will not be affected by your handling of the package. Think about it: upgrading a package through the ports collection basically boils down to: # make deinstall install clean. I don't think anyone would like it if that deinstall would also remove all their customized config files, only to replace them with defaults.

So this isn't only about data, it's also about the whole principle of packages. They only track files which are safe to replace.

This is easily solved using @sample on the config files on pkg-plist. The point is if upstream include configuration files or not...
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406

how could pkg list them if it's a runtime (not install-time) option?
only track files which are safe to replace.


If it was that easy, I would not have asked the question.
And in fact I wrote :

After a package has been installed, I'd like to see where the files are stored into the filesystem and their pathname ?

That is: after the installation ........ where the files are stored in the filesystem ?

"after the installation" means: once the installation is finished
and
"to store in the filesystem" is not equal "to install on the disk".

Answering to ShelLuser I've only translated into "instructions" what he said.

Surely pkg works "at package level" and it lists the files installed on the disk.
But "at user level" is a way to see where the files are stored into the filesystem after a package has been installed ?

Thanks very much for your replies.

Bye bye !!!
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,587

But "at user level" is a way to see where the files are stored into the filesystem after a package has been installed ?
find / -type f -newerct '1hour ago'
or
find / -type f -newerBt '5 min ago'
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406


Hello Phishfry !!

How are you ? I hope fine !

Thanks for your reply, but I don't think that [URL='https://www.freebsd.org/cgi/man.cgi?query=pkg-info&sektion=8&manpath=freebsd-release-ports']find(1)[/URL] works properly in this context, because the options are time-dependent.

I try to be more clear.

Finished the installation process of a package and before to run it for the first time, i'd like to take a picture (a full listing) of the files stored in the filesystem, both those installed both those simply stored there by default design by the package.

This indipendently by the fact that, successively, using the software installed, I can create other files for local settings needs, for example, or to achieve better performance or for maintenance operations, etc ... .

Bye !!!
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,587

You need to read the manpage on find.
What my find query does is looks for all files created prior to running the command.

For instance: you run pkg install mysql56-server and then after it is done and you are returned to the command prompt,
then run the find command. Using a 2 min reference of how long ago the files were created.
For instance: find / -type f -newerct '2 min ago'
Would find any file that was changed in the previous 2 minutes. That would cover all files installed by pkg.
Now you might see a few temporary files in there, but overall it will show every file changed or created in the previous 2 minutes.
You might also see where it changes the pkg database in /var/cache
I don't see how that does not fit the bill for your question.
Ideally you would run this from the command prompt with no other processes running.
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,587

So lets take this a step further and say you want to observe the secrets database with the passwords.

I use mysql and after pkg install mysql56-server the next step is to set it up. My crib notes look like this:
pkg install mysql56-server
service mysql-server start
[execute]: mysql_secure_installation
set new password
rest of fields [hit enter key]
service mysql-server restart

So for finding the secrets file I would run my find command after the official setup command:
mysql_secure_installation
That should show you the secrets database file.

The best guides for mysql setup are usually found with a FEMP tutorial:
https://www.digitalocean.com/commun...ginx-mysql-and-php-femp-stack-on-freebsd-10-1
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,587

I am just showing the basic find which prints to screen. You could also redirect or append to a file for further study.
find / -type f -newerct '2 min ago' -print >> /mysql-install-step1.txt
Single stepping through the install capturing file locations each time:
find / -type f -newerct '2 min ago' -print > /mysql-install-step2.txt
Notice the use of the redirect sign. One way writes new file wiping out old one(>) one appends(>>)
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406

How come I feel like we are doing your homework for you.....

I'm sorry.
You are not doing homework for me.

I've only reported as an example the installation of the MySQL package.

But my question is general, for any package, no exclusively for MySQL.

I've already inform you:
If it was that easy, I would not have asked the question.

Now, a member asking a question in the forums hopes that someone has been in the same situation and knows the answer.

I can also accept that someone replies with a question to better understand the meaning.

Without any arrogance, I can tell you that it takes twenty years of experience to answer my questions, because they are not basic questions.
I only try to simplify them as much as possible.

But it seems that it takes twenty years to understand them. :):):);)

Thanks for your time.

Bye bye !!
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406

The best guides for mysql

Thanks very much Phishfry.

You are a kindly person.

Are 20 years that I work with MySQL in Windows and Chorus Environments.

However, I'll take in great consideration the article you linked me (about MySQL for FreeBSD).

Thanks very much.
See you.
Bye bye !
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406

I am just showing the basic find which prints to screen. You could also redirect or append to a file for further study.
find / -type f -newerct '2 min ago' -print >> /mysql-install-step1.txt
Single stepping through the install capturing file locations each time:
find / -type f -newerct '2 min ago' -print > /mysql-install-step2.txt
Notice the use of the redirect sign. One way writes new file wiping out old one(>) one appends(>>)


Ok.
I much appreciate your efforts.

However .... tell me now, please ... before I sturt up my FreeBSD workstation.
I need to understand before ...
Are the instructions you wrote valid for any package ?
In which a way the find(1) command understands that it must scroll through the tree of the files related to the installed program ?
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,587

Are the instructions you wrote valid for any package ?
Yes they are very general. It will find all recent files. Not just 'pkg install' related.
So for best results No Xorg, No cron running. You will see some /tmp files in use possibly.
These should not be hard to spot.
Think of it as a file timestamp checker. It looks at timestamps on all files and shows the newest.
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,587

find / -type f -newerct '2 min ago' -print > /mysql-install-step2.txt
Do you understand what the file redirect does?
> /mysql-install-step2.txt
The > is the file redirect symbol. this makes a new file with the command output sent to a file.
You could almost think of it as a file pipe. It pipes command line output to a file.

As I noted earlier it also blindly writes this file without warning that it is overwriting any existing file with the same name.

To instead add to a file, you use append. So substitute >> for >.
So append places any new output to the bottom of the file existing file. If the file does not exist it will create it.
Append used this way creates sort of a 'log' file with oldest at top and newest at bottom.

The file name I used is purely made up. Something simple so you can easily recognize it.

If you reuse this format just rename the file to whatever you are watching or name it whatever you want.
 
OP
vince66

vince66

Well-Known Member

Reaction score: 14
Messages: 406

pkg info -lx <package name>

If you enjoy !

This is the best answer.

make install, by default, uses DESTDIR/PREFIX = /usr/local to install packages (10.4. PREFIX and DESTDIR).
It is possible that other folders can be created, depending by configuration scripts, but indipendently by the installation process. For these ones the manual of the software can help.

Thanks very much ShelLuser.
 

bugzeo

Member

Reaction score: 18
Messages: 95

As ShelLuser has correctly suggested, I've matched pkg options, founding these two solutions:

pkg info –all : shows all the software packages installed on your computer

pkg info –list-file <package_name> : shows the list of the files of the package installed on your computer.

However, typing the last command, it seems to me that not all of the installed files are detected.

Just to be clear:
root@maja:# pkg info --list-file mysql57-server-5.7.22

omits the /var/db/mysql folder. (NOTE: this folder is created empty during the installation phase).

Are there other possibilities ?

Thanks in advance.
"pkg info" lists all installed packages with its version, it's what most people look for. However "pkg info -all" also details for each package, the files provided by it at install time (not the files generated afterwards). For example if you install "vim" it will not include all files created with vim, or if you install "firefox", it will not include all files once you have a profile with history, passwords, and so on.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,347
Messages: 38,863

Poster hasn't been seen since 2019. Please look at the dates before responding.
 
Top