Nautilus and autofs

For the last few months I've been using Ubuntu 8.04 on a laptop for work, and a couple of days ago while working from home I hit an issue that I couldn't find mentioned anywhere. When opening Nautilus (the default GNOME file manager), it wouldn't display the contents of my home directory. When I'd been working onsite this problem hadn't occurred, and I hadn't changed any settings, so I was a bit nonplussed, especially as every other directory I tried displayed instantly. At first I thought the problem might be to do with bookmarks in Nautilus, or the tracker desktop search application (see this discussion) but that turned out not to be the case.

The problem turned out to be to do with Nautilus' handling of autofs and symlinks. The clients I'm currently working for have a Windows server with Samba shares to store various files. Since I often need access to the server I set the laptop up to automatically mount the Samba share on the laptop's filesystem when required, but since I'm not always onsite I didn't want to configure it to mount the share at boot time. Instead I configured access to the share using AutoFS. This meant that the share appeared under /cifs/share, which I don't find very convenient, and so I added a symlink in my home directory pointing to the share.

It appears that Nautilus does some kind of lookup on symlinks (I confess that I am not sure exactly what it's doing), and doesn't display anything until it's finished. When I was working onsite there was no problem, as the share was always accessible over the local network. However, when I was offsite, the share was of course inaccessible, and so the lookup was failing and Nautilus didn't display any of the contents of my home directory. The problem also occurred when using File Open dialogues in other programs, e.g. Firefox. Curiously, even when I connected to the site VPN so that the share was accessible the Nautilus lookup still failed.

The workaround I ended up using was to delete the symlink to the autofs share, which was far from ideal, but sadly I had other work to do than playing around to try and find out what was going wrong! It seems like bad behaviour on the part of Nautilus, since if an object is inaccessible it shouldn't prevent the loading/display of everything else. It's possible that the behaviour has been fixed in more recent releases, but since this is purely a work laptop I decided to be conservative and stick with Ubuntu 8.04 until the next Ubuntu LTS release is made. If I find any further information on the problem I will try to follow it up here.

An aside on autofs - I didn't find any very clear instructions on setting up autofs, and there were a few complications along the way, so here's a brief outline of how I set it up. In theory it's possible to set up autofs to use cifs to automatically mount Windows shares for any server, but in practice this doesn't always work. Since I only needed access to one server, it was easier to configure autofs to use cifs specifically for that server. I did this by adding the following line to /etc/auto.master:

/cifs /etc/auto.eritrea --timeout=60

In this example eritrea is the name of the server. The contents of /etc/auto.eritrea were as follows:

eritrea -fstype=cifs,file_mode=0640,dir_mode=0750,uid=pete,gid=pete,iocharset=utf8,credentials=/etc/eritrea.creds ://eritrea/share

For an explanation of the options supplied, see the cifs man page. Finally, I had to add a line to /etc/hosts pointing the server name eritrea to its IP address. Once that was done, going to the directory /cifs/eritrea and typing 'ls' would correctly list the contents of the Windows share.

Add new comment

CAPTCHA