Evince on NFS Kills Ubuntu Desktop

All the PCs here at the Fort­ress of Solitude run Ubuntu, so when I installed a new server it made sense to use NFS for file-sharing. I made that decision because NFS just works and is much easier to set-up than Samba Win­dows CIFS.

Everything worked well except for two bugs:

  1. Ubuntu Unity 2D would crash
  2. View­ing dir­ect­or­ies that con­tained many PDF files would freeze the desktop
The first bug had a fairly easy work­around but it took longer to track down a solu­tion for the second. Of course, I would have found the source of the prob­lem more quickly if I had just looked at the log on my cli­ent PC!:
[...] apparmor="DENIED" operation="sendmsg" parent=1 profile="/usr/bin/evince-thumbnailer" [...]
[...] kernel: [  708.816888] nfs: RPC call returned error 13

In other words, the evince-thumbnailer can­not cre­ate thumb­nail pre­views for pdf doc­u­ments because it is being denied access to the net­work by AppAr­mor. Which leads us to Ubuntu Bug #778638 where a fix has been released. See the bug report for the fix that can be applied manu­ally or by installing updated Evince soft­ware pack­ages from the Ubuntu Natty Pro­posed repository.

Using SSH to Forward a Remote Port Locally

Aside

A recent job reminded me that ssh can be used to for­ward a port on a remote sys­tem to one on the local cli­ent machine, like so:

ssh -L 8000:localhost:80 username@remoteserver

In that example, I could now visit http://localhost:8000 in a web browser to access the remote web server over the ssh con­nec­tion. This is use­ful for troubleshoot­ing or set­ting up ser­vices before allow­ing pub­lic access.

How to Make Ubuntu Unity 2D Launcher Work with an NFS Mounted Home

Back in July I repor­ted a bug that I was hav­ing with Ubuntu’s Unity 2D Launcher. The launcher would crash and restart con­stantly, chew­ing up a lot of CPU time. I had to switch back to the clas­sic Gnome desktop to con­tinue work­ing, I can’t run Unity (3D) because of a bug in NVIDIA’s drivers that pre­vent icons being dis­played in the launcher.

For­tu­nately Florian Bou­cault picked up the bug report and poin­ted out that dconf — the sys­tem that Unity 2D uses to store its con­fig­ur­a­tion — does not cur­rently work over NFS.

The work­around is to store dconf data­bases loc­ally by set­ting XDG_CONFIG_HOME dur­ing the user login pro­cess, before X gets star­ted. Here is a script that will do the job when placed in /etc/profile.d/

# /etc/profile.d/local-config.sh

# Set XDG_CONFIG_HOME, XDG_CONFIG_CACHE and ICEAUTHORITY to a local path

# Gnome dconf does not cur­rently work over NFS,
# so make sure con­figs are stored locally.

# Ubuntu Bug: https://bugs.launchpad.net/ubuntu/+source/unity-2d/+bug/817368
# Gnome Bug: https://bugzilla.gnome.org/show_bug.cgi?id=595579

# All other pro­grams that hon­our the loc­a­tion of XDG_CONFIG_HOME
# will also store their con­fig­ur­a­tions here.

# Set CONFIG_BASE_DIR to any local dir­ect­ory where the user
# has write access to cre­ate it.

CONFIG_BASE_DIR=/home/configs/${USER}
[ –d ${CONFIG_BASE_DIR} ] || mkdir –p ${CONFIG_BASE_DIR}

export XDG_CONFIG_HOME=$CONFIG_BASE_DIR/config
export XDG_CACHE_HOME=$CONFIG_BASE_DIR/cache

# X11 throws an error on login when .ICEau­thor­ity is loc­ated on NFS
# Ubuntu Bug: https://bugs.launchpad.net/ubuntu/+bug/761991

export ICEAUTHORITY=$CONFIG_BASE_DIR/.ICEauthority

I also took the oppor­tun­ity to move .ICEau­thor­ity from my home dir­ect­ory because I get an error that it can’t be updated every time I log in.