From Fedora Project Wiki

< KDE

 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Home directory on NFS''' (''Network File System'') with KDE might cause problems while desktop's IPC (''Inter Process Communication'') socket's are stored on networked disk and I/O-speed of network and storage itself doesn't match speeds that today's desktop systems can provide with local disk. This might appear as sluggishness and occasional hangups on desktop.
'''Home directory on NFS''' (''Network File System'') with KDE causes problems when on Fedora desktop's IPC (''Inter Process Communication'') sockets are stored on user's home directory and hence on networked disk - when that NFS-service has interrutps, it breaks that vital IPC-communication.


User's KDE IPC files under ~/.kde directory:
This could be avoided if packaging time configuration would point them into local disk like all other local programs like systemd, rpm, firefox, ssh and XDG-standard complying softwre do.
<pre style='font-size: 0.9em;'>
 
lrwxrwxrwx. 1 tuju tuju  22 Nov 5 2012 cache-wasa.netnix.ee -> /var/tmp/kdecache-tuju
__TOC__
lrwxrwxrwx1 tuju tuju  26 Feb 2 15:47 socket-wasa.netnix.ee -> /run/user/500/ksocket-tuju
 
lrwxrwxrwx.  1 tuju tuju   13 Nov 5 2012 tmp-wasa.netnix.ee -> /tmp/kde-tuju
 
</pre>
== Symptoms ==
This appears complete hangups on the desktop, and can be verified from kernel messages:
  # dmesg
  [1833578.276386] nfs: server example.com not responding, still trying
  [1833579.939514] nfs: server example.com not responding, still trying
[1833579.939515] nfs: server example.com not responding, still trying
  [1833579.940249] nfs: server example.com not responding, still trying
  [1833579.940384] nfs: server example.com OK
 
and each "not responding" -message is result of complete desktop hang that recovers after problem at server end is over.
 
== Unplugging the warning light ==
Wether the server is ''not responding'' or just busy (at some point the same thing) can be changed with [https://linux.die.net/man/5/nfs nfs options], namely ''timeo'' and ''retrans''. With autofs home, these nfs mount options are given in ''/etc/auto.master'' file:
 
   /net    -hosts udp,timeo=600,retrans=5
 
And once the autofs service has been restarted and mounts remounted, options are visible in mount listing. If the root cause, for example lack of bandwidth still exists, this merely shuts off the red lamp from dashboard, hangups will remain.
 
* [https://access.redhat.com/solutions/28211 RHEL mount hangs: nfs: server ... not responding, still trying]


== Moving KDE IPC-communication ==
Following user's environment variables can be used to change where these different IPC-files are stored and point them into local disk. To make them system-wide for every user, each setting can be put into own file and dropped into ''/etc/profile.d'' directory to get included into user's login process.
Following user's environment variables can be used to change where these different IPC-files are stored and point them into local disk. To make them system-wide for every user, each setting can be put into own file and dropped into ''/etc/profile.d'' directory to get included into user's login process.


== XDG_CONFIG_HOME ==
=== XDG_CONFIG_HOME ===
'''XDG_CONFIG_HOME'''
 
File: /etc/profile.d/xdg.config.sh
<pre>
<pre>
if [ -d /data/$USER/.config ]; then
if [ -d /srv/home/$USER/.config ]; then
   XDG_CONFIG_HOME=/data/$USER/.config
   XDG_CONFIG_HOME=/srv/home/$USER/.config
   export XDG_CONFIG_HOME
   export XDG_CONFIG_HOME
fi
fi
</pre>
</pre>


== XDG_CACHE_HOME ==
=== XDG_CACHE_HOME ===
'''XDG_CACHE_HOME'''
 


File: /etc/profile.d/xdg.cache.sh
<pre>
<pre>
# could be more paranoid, and not accept any previously defined XDG_CACHE_HOME
# could be more paranoid, and not accept any previously defined XDG_CACHE_HOME
Line 40: Line 65:




== XDG_DATA_HOME ==
=== XDG_DATA_HOME ===
'''XDG_DATA_HOME''' 
 
File: /etc/profile.d/xdg.data.sh
<pre>
<pre>
if [ -d /data/$USER/.local/share ]; then
if [ -d /srv/home/$USER/.local/share ]; then
   XDG_DATA_HOME=/data/$USER/.local/share
   XDG_DATA_HOME=/srv/home/$USER/.local/share
   export XDG_DATA_HOME
   export XDG_DATA_HOME
fi
fi
</pre>
</pre>


=== KDEHOME ===
'''KDEHOME''' affects where user's .kde directory is located and hence where those problematic socket files are located. Setting KDEHOME makes user's KDE settings machine specific which might be problematic in an environment where users move from desktop machine to another and expect to see the same, personalized desktop at each machine.
User's KDE IPC files under ~/.kde directory:
<pre style='font-size: 0.9em;'>
lrwxrwxrwx.  1 tuju tuju  22 Nov  5  2012 cache-wasa.netnix.ee -> /var/tmp/kdecache-tuju
lrwxrwxrwx.  1 tuju tuju  26 Feb  2 15:47 socket-wasa.netnix.ee -> /run/user/500/ksocket-tuju
lrwxrwxrwx.  1 tuju tuju  13 Nov  5  2012 tmp-wasa.netnix.ee -> /tmp/kde-tuju
</pre>


== KDEHOME ==
'''KDEHOME''' affects where user's .kde directory is located and hence where those problematic socket files are located. Setting KDEHOME makes user's KDE settings machine specific which might be problematic in environment where users move from desktop machine to another and expect to see the same, personalized desktop at each machine.


File: /etc/profile.d/kde.home.sh
<pre>
<pre>
# cat USE_LOCAL_DATA.sh  
# cat USE_LOCAL_DATA.sh  
Line 61: Line 97:
</pre>
</pre>


At the same time while setting KDEHOME, user's .kde directory content should be moved into newly created local host home directory to avoid loosing any KDE settings and application data.
At the same time, while setting KDEHOME, user's .kde directory content should be moved into a newly created localhost home directory to avoid losing any KDE settings and application data.
 
KDEHOME contains directories like share/config and share/apps etc that should be considered user's data, not just mere dotfiles/settings and should be included into backup solution.


Disabling '''selinux''' permanently should be considered if new location does not match with default ''/home'' directory fcontext settings - which is most likely the case.
Disabling '''selinux''' permanently should be considered if new location does not match with default ''/home'' directory fcontext settings - which is most likely the case.
== KDirWatchPrivate and Gamin ==
Attaching a gdb debugger intoa  a hanging process with
gdb -p <pid>
and running a
thread apply all where
shows all threads. One of them might have:
Thread 1 (Thread 0x7fa8e1c56900 (LWP 25745)):
#0  0x00007fa8db9ce460 in __GI___nanosleep (requested_time=0x7ffea3cef990, remaining=0x7ffea3cef990) at ../sysdeps/unix/sysv/linux/nanosleep.c:27
#1  0x00007fa8dc84b51d in qt_nanosleep(timespec) () from /lib64/libQt5Core.so.5
#2  0x00007fa8dde123c8 in KDirWatchPrivate::useFAM(KDirWatchPrivate::Entry*) () from /lib64/libKF5CoreAddons.so.5
#3  0x00007fa8dde1286b in KDirWatchPrivate::addWatch(KDirWatchPrivate::Entry*) () from /lib64/libKF5CoreAddons.so.5
that shows ''KDirWatchPrivate()'' class and it uses '''gamin''' (gamin provides /usr/lib64/libfam.so.0) and its [https://www.google.com/search?&q=site%3Abugzilla.redhat.com+gam_server notorious gam_server] process. gam_server can be guided to two kind of modes for different directories, kernel notifications and polling. These can be set in /etc/gamin/mandatory_gaminrc file with
poll /net/*
fsset nfs poll 10
where the last line might be enough to switch gamin monitoring to poll-method on NFS-shares. All these probably need a complete restart.
See also:
* [https://www.systutorials.com/docs/linux/packages/gamin-0.1.10/gamin.html systutorials.com - Gamin the File Alteration Monitor]
* [https://people.gnome.org/~veillard/gamin/debug.html gamin debugging instructions]
== Commands ==
$ lsof -N -nP | grep kmail


== See Also ==
== See Also ==
* [[KDE]]
* [[KDE]]
 
* [https://bugzilla.redhat.com/show_bug.cgi?id=957786 bug 957786]
* [https://bugs.kde.org/show_bug.cgi?id=275261 bug 275261: Akonadi on NFS mounted home directories is very fragile]
* http://julio.meroh.net/2005/09/nfs-file-handles.html
* https://utcc.utoronto.ca/~cks/space/blog/unix/NFSFilehandleInternals
* http://unix.stackexchange.com/questions/60422/how-to-interpret-this-output-of-lsof-command
* http://nfs.sourceforge.net/nfs-howto/ar01s05.html
* http://nfs.sourceforge.net/


[[Category:KDE]]
[[Category:KDE]]
[[Category:NFS]]
[[Category:NFS]]

Latest revision as of 13:18, 4 May 2022

Home directory on NFS (Network File System) with KDE causes problems when on Fedora desktop's IPC (Inter Process Communication) sockets are stored on user's home directory and hence on networked disk - when that NFS-service has interrutps, it breaks that vital IPC-communication.

This could be avoided if packaging time configuration would point them into local disk like all other local programs like systemd, rpm, firefox, ssh and XDG-standard complying softwre do.


Symptoms

This appears complete hangups on the desktop, and can be verified from kernel messages:

# dmesg
[1833578.276386] nfs: server example.com not responding, still trying
[1833579.939514] nfs: server example.com not responding, still trying
[1833579.939515] nfs: server example.com not responding, still trying
[1833579.940249] nfs: server example.com not responding, still trying
[1833579.940384] nfs: server example.com OK

and each "not responding" -message is result of complete desktop hang that recovers after problem at server end is over.

Unplugging the warning light

Wether the server is not responding or just busy (at some point the same thing) can be changed with nfs options, namely timeo and retrans. With autofs home, these nfs mount options are given in /etc/auto.master file:

 /net    -hosts  udp,timeo=600,retrans=5

And once the autofs service has been restarted and mounts remounted, options are visible in mount listing. If the root cause, for example lack of bandwidth still exists, this merely shuts off the red lamp from dashboard, hangups will remain.

Moving KDE IPC-communication

Following user's environment variables can be used to change where these different IPC-files are stored and point them into local disk. To make them system-wide for every user, each setting can be put into own file and dropped into /etc/profile.d directory to get included into user's login process.

XDG_CONFIG_HOME

XDG_CONFIG_HOME

File: /etc/profile.d/xdg.config.sh

if [ -d /srv/home/$USER/.config ]; then
  XDG_CONFIG_HOME=/srv/home/$USER/.config
  export XDG_CONFIG_HOME
fi

XDG_CACHE_HOME

XDG_CACHE_HOME


File: /etc/profile.d/xdg.cache.sh

# could be more paranoid, and not accept any previously defined XDG_CACHE_HOME
if [ -z "${XDG_CACHE_HOME}" ] ; then
  XDG_CACHE_HOME="/var/tmp/xdgcache-${USER}"
  export XDG_CACHE_HOME
fi

if [ -d "${XDG_CACHE_HOME}" ]; then
  # verify existing dir is suitable
  if ! `test -G "${XDG_CACHE_HOME}" -a -w "${XDG_CACHE_HOME}"` ; then
    # else, make a new/secure one with mktemp
    XDG_CACHE_HOME="$(mktemp -d ${XDG_CACHE_HOME}-XXXXXX)"
    export XDG_CACHE_HOME
  fi
else
  mkdir -p "${XDG_CACHE_HOME}" 
fi


XDG_DATA_HOME

XDG_DATA_HOME 

File: /etc/profile.d/xdg.data.sh

if [ -d /srv/home/$USER/.local/share ]; then
  XDG_DATA_HOME=/srv/home/$USER/.local/share
  export XDG_DATA_HOME
fi

KDEHOME

KDEHOME affects where user's .kde directory is located and hence where those problematic socket files are located. Setting KDEHOME makes user's KDE settings machine specific which might be problematic in an environment where users move from desktop machine to another and expect to see the same, personalized desktop at each machine.

User's KDE IPC files under ~/.kde directory:

lrwxrwxrwx.  1 tuju tuju   22 Nov  5  2012 cache-wasa.netnix.ee -> /var/tmp/kdecache-tuju
lrwxrwxrwx.  1 tuju tuju   26 Feb  2 15:47 socket-wasa.netnix.ee -> /run/user/500/ksocket-tuju
lrwxrwxrwx.  1 tuju tuju   13 Nov  5  2012 tmp-wasa.netnix.ee -> /tmp/kde-tuju


File: /etc/profile.d/kde.home.sh

# cat USE_LOCAL_DATA.sh 

if [ -d /srv/home/$USER/.kde ]; then
  KDEHOME=/srv/home/$USER/.kde
  export KDEHOME
fi

At the same time, while setting KDEHOME, user's .kde directory content should be moved into a newly created localhost home directory to avoid losing any KDE settings and application data.

KDEHOME contains directories like share/config and share/apps etc that should be considered user's data, not just mere dotfiles/settings and should be included into backup solution.

Disabling selinux permanently should be considered if new location does not match with default /home directory fcontext settings - which is most likely the case.


KDirWatchPrivate and Gamin

Attaching a gdb debugger intoa a hanging process with

gdb -p <pid>

and running a

thread apply all where

shows all threads. One of them might have:

Thread 1 (Thread 0x7fa8e1c56900 (LWP 25745)):
#0  0x00007fa8db9ce460 in __GI___nanosleep (requested_time=0x7ffea3cef990, remaining=0x7ffea3cef990) at ../sysdeps/unix/sysv/linux/nanosleep.c:27
#1  0x00007fa8dc84b51d in qt_nanosleep(timespec) () from /lib64/libQt5Core.so.5
#2  0x00007fa8dde123c8 in KDirWatchPrivate::useFAM(KDirWatchPrivate::Entry*) () from /lib64/libKF5CoreAddons.so.5
#3  0x00007fa8dde1286b in KDirWatchPrivate::addWatch(KDirWatchPrivate::Entry*) () from /lib64/libKF5CoreAddons.so.5

that shows KDirWatchPrivate() class and it uses gamin (gamin provides /usr/lib64/libfam.so.0) and its notorious gam_server process. gam_server can be guided to two kind of modes for different directories, kernel notifications and polling. These can be set in /etc/gamin/mandatory_gaminrc file with

poll /net/* 
fsset nfs poll 10

where the last line might be enough to switch gamin monitoring to poll-method on NFS-shares. All these probably need a complete restart.

See also:

Commands

$ lsof -N -nP | grep kmail

See Also