You are not logged in.

#1 2015-11-05 03:56:21

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Finding out what calls config files?

Hey everyone, I'm wracking my brain, but is there any command that exists that can find out what process makes use of certain config files? For example, is there something I run or query that points to the volti daemon if I run it against .config/volti/config?
I mean some are obvious like that but I'd love to plunge into the deeper levels of the filesystem and see some non obvious files and what makes use of them.

I know dpkg has a dependencies check, but it's not really the same thing, as that is more about full packages, not individual files.

Could a script like this be written if it doesn't already exist? Maybe something to check to see what process last opened the file?


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#2 2015-11-05 05:22:10

nod-a1
Member
From: Gothenburg
Registered: 2015-10-01
Posts: 31
Website

Re: Finding out what calls config files?

You are starting your journey into the void of Linux.

What you are looking for is understanding how the Kernel works and its Monolithic Fashion of Operation. All software is depended on the Kernel, so you would like to start there and build your explorer program from root directory. The people that came before you have left their legacy behind for you to discover and use, be careful tho because what you are looking for are the deamon programs running and logging in the background.

Start at /var/log to see what the deamons are writing. It is all manual operation from this point, I suggest you put some color on the terminal first

PS1='\[\e[0;32m\][\u@\h\w]\€\[\e[0;34m\] '

Happy mining


sharp, clarity, focus, control

Offline

#3 2015-11-05 06:58:03

ohnonot
...again
Registered: 2015-09-29
Posts: 5,554

Re: Finding out what calls config files?

^ wot? ach, nevermind.

Horizon_Brave wrote:

is there any command that exists that can find out what process makes use of certain config files? For example, is there something I run or query that points to the volti daemon if I run it against .config/volti/config?

if the process is using the config file atm, yes, with "lsof" (but i don't know exactly how).
if not, no. not directly.
i think it's possible to install a daemon that monitors which processes access which files, but i think you'll agree that the project is getting quickly out of hand.
thankfully, most devs make sure that their files are clearly recognizable, usually by directory (e.g. ~/.config/thunar, or /etc/systemd/).
some are less obvious, like e.g. ~/.config/Trolltech.conf (i just love that file name. norse mythology. it's qt's equivalent of ~/.gtkrc-2.0).
are there any files in particular that you're interested in?


Give to COVAX! Here or here. (explanation)

Offline

#4 2015-11-05 07:32:51

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Finding out what calls config files?

The name is usually the give away smile

If you find any you can't figure out, try using:

apropos <name of file>

To search the man page database for matches.

While you're at it, have a read of:

man man
info info
man hier
man bootup

etc...

/Moved to Basic Help & Support


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#5 2015-11-05 08:22:28

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,375
Website

Re: Finding out what calls config files?

In some cases

ps ax | grep app

does the trick.

Offline

#6 2015-11-05 08:26:48

gako
Member
Registered: 2015-10-02
Posts: 241

Re: Finding out what calls config files?

Also useful

dpkg -L <package-name>

Will show you all installed files from given package.
This will include README paths (sometimes useful hmm) as well.

htop is pretty awesome for viewing process info too
shortcut keys (case sensitive):
"t" - process tree view
"H" - show all user threads 
"K" -  show kernel threads

Offline

#7 2015-11-05 12:33:54

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,283
Website

Re: Finding out what calls config files?

Another tool for tracking down what files a program is accessing is strace.
See this tutorial: http://shallowsky.com/blog/linux/cmdline/strace.html

Last edited by johnraff (2015-11-05 12:34:43)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#8 2015-11-05 18:38:26

ohnonot
...again
Registered: 2015-09-29
Posts: 5,554

Re: Finding out what calls config files?

Head_on_a_Stick wrote:

If you find any you can't figure out, try using:

apropos <name of file>

i think this only works if that file has its own man page?
but then, many have.

While you're at it, have a read of:

man hier

wow, the forefathers really knew how to save on keystrokes smile


Give to COVAX! Here or here. (explanation)

Offline

#9 2015-11-05 21:15:28

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Finding out what calls config files?

johnraff wrote:

Another tool for tracking down what files a program is accessing is strace.
See this tutorial: http://shallowsky.com/blog/linux/cmdline/strace.html

This works, but I'd have to know what program i'm looking for before hand. I was thinking of doing it in reverse. I see a random conf file or something, can 'back track' to see what was it that accessed it last

ohnonot wrote:

are there any files in particular that you're interested in?

No, not especially, just some of the .config/* files, the systemd startup services, the login scripts.etc.. more so out of curiosity to see which daemons talk to which configs, especially at bootup.


gako wrote:

Also useful

htop is pretty awesome for viewing process info too
shortcut keys (case sensitive):
"t" - process tree view
"H" - show all user threads 
"K" -  show kernel threads

True, I actually installed htop the other day, the process tree feature may be useful I'll check it out!


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#10 2015-11-05 21:19:13

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Finding out what calls config files?

Horizon_Brave wrote:

see which daemons talk to which configs, especially at bootup.

Read systemd(1)

Recursively.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#11 2015-11-06 01:03:39

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,283
Website

Re: Finding out what calls config files?

Horizon_Brave wrote:

I see a random conf file or something, can 'back track' to see what was it that accessed it last

That sounds quite difficult, but I think you can identify processes that are currently accessing a certain file, device or directory. ohnonot has already mentioned lsof and another one is fuser. I haven't used either of them extensively, but I have a couple of notes stored away from some blog or forum, different context but just pasting in here as-is in case it's any help:

You are probably all too familiar with the situation - you are trying to unmount a drive,
but keep getting told by your system that it's busy.
But what application is tying it up? A quick one-liner will tell you:

lsof +D /mnt/windows

This will return the command and process ID of any tasks currently accessing the /mnt/windows directory.
You can then locate them, or use the kill command to finish them off.
-----------------------------------------------------------------
umount: /media/disk: device is busy

First thing you’ll do will probably be to close down all your terminals and xterms but here’s a better way.
You can use the fuser command to find out which process was keeping the device busy:

    # fuser -m /dev/sdc1
    /dev/sdc1: 538
    # ps auxw|grep 538
    donncha 538 0.4 2.7 219212 56792 ? SLl Feb11 11:25 rhythmbox

Rhythmbox is the culprit! Close that down and umount the drive. Problem solved!


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#12 2015-11-06 06:35:26

ohnonot
...again
Registered: 2015-09-29
Posts: 5,554

Re: Finding out what calls config files?

Horizon_Brave wrote:

I see a random conf file or something, can 'back track' to see what was it that accessed it last

i'm pretty sure there's tools for that.
they are usually designed with server administration in mind.
it will require to have them constantly running in the background. i don't know how extensively they log - usually the stress is on network activity - but i guess they could be configured to provide you with some answers.


Give to COVAX! Here or here. (explanation)

Offline

Board footer

Powered by FluxBB