LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Current64: Where does the /.cache file come from? (https://www.linuxquestions.org/questions/slackware-14/current64-where-does-the-cache-file-come-from-4175605075/)

gmgf 05-03-2017 02:51 PM

Quote:

Originally Posted by Darth Vader (Post 5705791)
That nasty folder on / appeared after the latest font adventures...

No i have this since longtime.

Darth Vader 05-03-2017 06:01 PM

In my case, this stray /.cache folder appeared after the last updates in slackware-current.

rkelsen 05-04-2017 04:20 AM

I don't have this problem.

What are you running on boot?

gmgf 05-04-2017 09:48 AM

Robby, it's due to rc.networkmanager, when is inactived the .config isn't created at boot ;)

I think it starts too early in the init, because when you start it under x, there is no problem

burdi01 05-04-2017 10:51 AM

By placing "echo -n "XXX: " ; ls -a /" statements in /etc/rc.{S,M} and drilling down I found that the /.cache file is created by the /usr/sbin/NetworkManager invocation done in /etc/rc.d/rc.networkmanager:
Code:

nm_start()
{
  .....
echo -n "M2cC: " ; ls -a /
  echo "Starting NetworkManager daemon:  $NETWORKMANAGER_BIN"
  $NETWORKMANAGER_BIN
echo -n "M2cD: " ; ls -a /
}

As /usr/sbin/NetworkManager is an "ELF 64-bit executable" my journey ends there.
:D

allend 05-04-2017 10:51 AM

Nice catch!
On my desktop, where I do not use NetworkManager, I do not see a /.cache directory. On my laptop, where I do use NetworkManager, I do see a /.cache directory.

burdi01 05-04-2017 10:57 AM

Yes, after installing wicd the /.cache directory is no longer created.
:D

rworkman 05-04-2017 01:28 PM

Quote:

Originally Posted by gmgf (Post 5706138)
Robby, it's due to rc.networkmanager, when is inactived the .config isn't created at boot ;)

I think it starts too early in the init, because when you start it under x, there is no problem

That is interesting, but it doesn't happen here...
I also don't see anywhere in NM source that uses any .cache directory :/

rworkman 05-04-2017 01:46 PM

Humor me on this. Before the NM invocation stanza, add a "sleep 2" and then your echo/ls line and see what happens. I think it might be bluez doing it but it just takes a bit of time and NM gets started before that cache dir is created...

allend 05-05-2017 03:23 AM

I think bluez is a false trail. The laptop where I observe the problem does not have /etc/rc.d/rc.bluetooth executable.
I added a call in /etc/rc.d/rc.S just before the stanza to configure ISA Plug and Play devices to a script to watch for the creation of a directory in /
Code:

#!/bin/sh

while inotifywait -e create / ; do
  ps axww >> /tmp/clog.txt
done &

The resulting output seems to confirm NetworkManager as the culprit.
Code:

  756 ?        Ss    0:00 /sbin/mount.ntfs /dev/sda2 /xp-c -v -o ro,noexec,nosuid,nodev,umask=022,users
  759 ?        Ss    0:00 /sbin/mount.ntfs-3g /dev/sda3 /xp-d -v -o rw,umask=022
  774 ?        S      0:00 /usr/sbin/cgmanager --daemon
  794 ?        Ss    0:00 /bin/sh /etc/rc.d/rc.M
  806 ?        Ss    0:00 /usr/sbin/syslogd
  810 ?        Ss    0:00 /usr/sbin/klogd -c 3 -x
  811 ?        R      0:01 /usr/bin/fc-cache -f
  920 ?        Ss    0:00 /usr/bin/dbus-daemon --system
  921 ?        S      0:00 sh /etc/rc.d/rc.networkmanager start
  926 ?        D      0:00 /usr/sbin/NetworkManager
  927 ?        R      0:00 ps axww


gmgf 05-05-2017 03:40 AM

Yes, i have one other install of current with openrc, and this install, doesn't have this cosmetic problem.

kjhambrick 05-05-2017 04:22 AM

Hmmm ... an interesting, if harmless issue here ...

I've done this to myself from time to time by referencing an unitialized or a misspelled Directory Variable in a /bin/sh script.

Example:
Code:

THE_DIR=                # THE_DIR is unitialized but not on purpose :)
mkdir ${THE_DIR}/.cache  # oops ... ${THE_DIR} will be created as /.cache
#
# or a misspelling ...
#
THE_DIR="$HOME"          # Initialize THE_DIR
mkdir ${THEDIR}/.cache  # but misspell THE_DIR when I reference it and oops[2]

Since I don't run many scripts as root, and because a joe user cannot create a Directory in the fs root, the above code fails if I bother to check RetCodes

OTOH, if I run such code as root, I end up with an unintended directory in the fs root.

Just sayin' :)

Anyhow, like burdi01, I found no references to a .cache directory in any Current NetworkManager files and I am running wicd so I have no /.cache directory on my systems.

But NetworkManager requires dbus (:) another Project with the LoveBucket name on it :)) and I do have a $HOME/.cache/dbus/ directory.

I've not scanned the dbus code but I wonder if the XDG_DATA_HOME variable that 55020 found affects the location of the .cache/dbus/ directory ?

But then, how would one set XDG_DATA_HOME during boot ???

-- kjh

burdi01 05-05-2017 04:37 AM

@rworkman:
Quote:

I think it might be bluez doing it but it just takes a bit of time and NM gets started before that cache dir is created...
That would be in contradiction with my finding that when using wicd (which precludes NM) the /.cache directory is not created.
Also, just as allend, I do not have bluez enabled (actually it is not even installed).

Anyway, I did as requested (and with an even longer sleep):
Code:

nm_start()
{
.....
echo -n "M2cB2: " ; ls -a /
echo "sleep 5" ; sleep 5
echo -n "M2cC: " ; ls -a /
  echo "Starting NetworkManager daemon:  $NETWORKMANAGER_BIN"
  $NETWORKMANAGER_BIN
echo -n "M2cD: " ; ls -a /
}

The .cache directory first pops up with the "M2cD" display.
:D

allend 05-05-2017 08:15 AM

This is working for me to stop the creation of /.cache directory.
Code:

bash-4.4$ diff ./a/rc.networkmanager ./b/rc.networkmanager
36c36
<  $NETWORKMANAGER_BIN
---
>  XDG_CACHE_HOME=/root/.cache $NETWORKMANAGER_BIN

From https://standards.freedesktop.org/ba...ec-latest.html
Quote:

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

rworkman 05-05-2017 09:08 AM

Quote:

Originally Posted by burdi01 (Post 5706503)
@rworkman:
That would be in contradiction with my finding that when using wicd (which precludes NM) the /.cache directory is not created.
Also, just as allend, I do not have bluez enabled (actually it is not even installed).

Anyway, I did as requested (and with an even longer sleep):
Code:

nm_start()
{
.....
echo -n "M2cB2: " ; ls -a /
echo "sleep 5" ; sleep 5
echo -n "M2cC: " ; ls -a /
  echo "Starting NetworkManager daemon:  $NETWORKMANAGER_BIN"
  $NETWORKMANAGER_BIN
echo -n "M2cD: " ; ls -a /
}

The .cache directory first pops up with the "M2cD" display.
:D

Well, here's the feedback from thaller in #networkmanager:
Quote:

19:56 < thaller> rworkman, seems related to glib and using the session bus... which uses "$XDG_RUNTIME_DIR/bus" as path... but NM should ever access the
session bus, something is wrong there.
14:05 < rworkman> thaller: re glib & session bus, it's definitely somehow related to NM, but no idea how :/
14:06 < thaller> rworkman, grep in glib sources where they create the .cache directory (not many places), install debugging symbols, and run in debugger with
a breakpoint
14:07 < thaller> I guess, you could also get a backtrace using systemtap, but I am not familiar enough with that.
Anybody feel up to that? :-)


All times are GMT -5. The time now is 09:10 AM.