Pages

Updating Ubuntu 11.10 to 12.04 gives problems with Samba and Greyhole

I run an Ubuntu server as a central home server holding all my media (photographs, music etc.) and the files we all use and share as a family in a safe and easy environment - rather than have different versions stored on each person's PCs and devices.. The server provides file shares via Samba and provides file resilience using Greyhole. Both have been configured and the server has run successfully for over a year since it was installed. Recently I upgraded my server from Ubuntu version 11.10 to Ubuntu version 12.04 LTS using the Ubuntu instruction Run 'do-release-upgrade' to upgrade All went well apart from two 'little' issues.
  • The first issue was that Zoneminder (a CCTV security monitoring program)  'broke' during the upgrade due to changes made within mySQL during the upgrade.
  • The second was that my shared folders stopped working.
While the first issue I can leave till another day, the second issue needed fixing right away as the server contents were needed that evening.

No pressure then.... ;o)

The first step I tried was to be clear about what had gone wrong. My Samba config was unchanged from before the upgrade and both services (Samba and Greyhole) had started without error. From my Windows 7 desktop I could access and browse my home directory without any issues. (I use this folder as a link between my Windows world and my Ubuntu world so this share is not maintained by Greyhole). However, while I could see all the other shares held on my server I could not browse into them to access the files. Instead, Windows 7 reported that it could not access the shares in an error window like the example below:
The next steps were to look at the logs for Samba on my server.
martin@homesvr:~$ martin@homesvr:~$ cd /var/log/samba/ martin@homesvr:/var/log/samba$ cat log.win7desktop
I noticed lots and lots of error messages like this:
[2013/04/14 20:09:42.217273, 0] smbd/service.c:869(make_connection_snum) vfs_init failed for service movies [2013/04/14 20:09:42.226322, 0] smbd/vfs.c:173(vfs_init_custom) error probing vfs module 'greyhole': NT_STATUS_UNSUCCESSFUL [2013/04/14 20:09:42.226446, 0] smbd/vfs.c:315(smbd_vfs_init) smbd_vfs_init: vfs_init_custom failed for greyhole [2013/04/14 20:09:42.226518, 0] smbd/service.c:869(make_connection_snum) vfs_init failed for service movies [2013/04/14 20:09:42.231051, 0] smbd/vfs.c:173(vfs_init_custom) error probing vfs module 'greyhole': NT_STATUS_UNSUCCESSFUL [2013/04/14 20:09:42.231172, 0] smbd/vfs.c:315(smbd_vfs_init) smbd_vfs_init: vfs_init_custom failed for greyhole [2013/04/14 20:09:42.231244, 0] smbd/service.c:869(make_connection_snum) vfs_init failed for service movies
However, for Greyhole there were no real issues:
martin@homesvr:~$ greyhole -S Currently idle. Recent log entries: Apr 14 20:09:52 7 sleep: Nothing to do... Sleeping. Apr 14 20:10:02 7 sleep: Nothing to do... Sleeping. Apr 14 20:10:12 7 sleep: Nothing to do... Sleeping. Apr 14 20:10:22 7 sleep: Nothing to do... Sleeping. Apr 14 20:10:33 7 sleep: Nothing to do... Sleeping. Apr 14 20:10:43 7 sleep: Nothing to do... Sleeping. Apr 14 20:10:53 7 sleep: Nothing to do... Sleeping. Apr 14 20:11:03 7 sleep: Nothing to do... Sleeping. Apr 14 20:11:13 7 sleep: Nothing to do... Sleeping. Apr 14 20:11:23 7 sleep: Nothing to do... Sleeping. Last logged action: sleep on 2013-04-14 20:11:23 (7s ago) martin@homesvr:~$ martin@homesvr:~$ greyhole -i /media/hdd2/gh: 0 kBps /media/hdd1/gh: 0 kBps /media/hdd3/gh: 0 kBps /media/hdd4/gh: 0 kBps ---
So this led me to suppose that the breakdown is between Samba and Greyhole, and, entering the following command:
martin@homesvr:~$ cat /etc/samba/smb.conf
shows me the config for the share I was investigating:
[movies]
    comment = Movie Library
    path = /share/movies
    browsable = yes
    guest ok = yes
    read only = yes
    force user = nobody
    force group = nogroup
    write list = martin
    dfree command = /usr/bin/greyhole-dfree
    vfs objects = greyhole
Note the dfree command line and the vfs objects line. These are the lines you have to put in the Samba config file if you want Greyhole to manage the files in a Samba share. The vfs objects line is an instruction to Samba to use the greyhole.so object to handle files on a Greyhole storage resource. Looking in the directory where Samba keeps the vfs objects you can see that in fact greyhole.so is a symlink to the actual file located elsewhere within the Greyhole libraries.
martin@homesvr:~$ ls -al /usr/lib/samba/vfs total 604 drwxr-xr-x 2 root root 4096 Apr 14 13:50 . drwxr-xr-x 5 root root 4096 Jan 2 2012 .. -rw-r--r-- 1 root root 31496 Mar 7 22:40 acl_tdb.so -rw-r--r-- 1 root root 27400 Mar 7 22:40 acl_xattr.so -rw-r--r-- 1 root root 15184 Mar 7 22:40 audit.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 cap.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 catia.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 crossrename.so -rw-r--r-- 1 root root 6920 Mar 7 22:40 default_quota.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 dirsort.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 expand_msdfs.so -rw-r--r-- 1 root root 19280 Mar 7 22:40 extd_audit.so -rw-r--r-- 1 root root 6920 Mar 7 22:40 fake_perms.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 fileid.so -rw-r--r-- 1 root root 52048 Mar 7 22:40 full_audit.so lrwxrwxrwx 1 root root 39 Jan 3 2012 greyhole.so -> /usr/lib64/greyhole/greyhole-samba35.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 linux_xfs_sgid.so -rw-r--r-- 1 root root 15112 Mar 7 22:40 netatalk.so -rw-r--r-- 1 root root 15112 Mar 7 22:40 preopen.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 readahead.so -rw-r--r-- 1 root root 23376 Mar 7 22:40 readonly.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 recycle.so -rw-r--r-- 1 root root 27400 Mar 7 22:40 scannedonly.so -rw-r--r-- 1 root root 35592 Mar 7 22:40 shadow_copy2.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 shadow_copy.so -rw-r--r-- 1 root root 27400 Mar 7 22:40 smb_traffic_analyzer.so -rw-r--r-- 1 root root 19208 Mar 7 22:40 streams_depot.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 streams_xattr.so -rw-r--r-- 1 root root 15112 Mar 7 22:40 syncops.so -rw-r--r-- 1 root root 43784 Mar 7 22:40 time_audit.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 xattr_tdb.so martin@homesvr:~$
And, following the symlink, we find:
martin@homesvr:~$ ls -al /usr/lib64/greyhole/ total 56 drwxr-xr-x 2 root root 4096 Jan 3 2012 . drwxr-xr-x 4 root root 4096 Jan 3 2012 .. -rw-r--r-- 1 root root 13415 Jun 22 2011 greyhole-samba34.so -rw-r--r-- 1 root root 14560 Jun 22 2011 greyhole-samba35.so -rw-r--r-- 1 root root 14529 Nov 29 2011 greyhole-samba36.so martin@homesvr:~$
So, re-linking the greyhole.so to greyhole-samba36.so should fix this as I was running Samba 3.5.11 under the old 11.10 version of Ubuntu and I am now running Samba 3.6.3 under the 12.04 version.
martin@homesvr:~$ sudo ln -s /usr/lib64/greyhole/greyhole-samba36.so /usr/lib/samba/vfs/greyhole.so martin@homesvr:~$ ls -al /usr/lib/samba/vfs total 604 drwxr-xr-x 2 root root 4096 Apr 14 20:33 . drwxr-xr-x 5 root root 4096 Jan 2 2012 .. -rw-r--r-- 1 root root 31496 Mar 7 22:40 acl_tdb.so -rw-r--r-- 1 root root 27400 Mar 7 22:40 acl_xattr.so -rw-r--r-- 1 root root 15184 Mar 7 22:40 audit.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 cap.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 catia.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 crossrename.so -rw-r--r-- 1 root root 6920 Mar 7 22:40 default_quota.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 dirsort.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 expand_msdfs.so -rw-r--r-- 1 root root 19280 Mar 7 22:40 extd_audit.so -rw-r--r-- 1 root root 6920 Mar 7 22:40 fake_perms.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 fileid.so -rw-r--r-- 1 root root 52048 Mar 7 22:40 full_audit.so lrwxrwxrwx 1 root root 39 Apr 14 20:33 greyhole.so -> /usr/lib64/greyhole/greyhole-samba36.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 linux_xfs_sgid.so -rw-r--r-- 1 root root 15112 Mar 7 22:40 netatalk.so -rw-r--r-- 1 root root 15112 Mar 7 22:40 preopen.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 readahead.so -rw-r--r-- 1 root root 23376 Mar 7 22:40 readonly.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 recycle.so -rw-r--r-- 1 root root 27400 Mar 7 22:40 scannedonly.so -rw-r--r-- 1 root root 35592 Mar 7 22:40 shadow_copy2.so -rw-r--r-- 1 root root 11016 Mar 7 22:40 shadow_copy.so -rw-r--r-- 1 root root 27400 Mar 7 22:40 smb_traffic_analyzer.so -rw-r--r-- 1 root root 19208 Mar 7 22:40 streams_depot.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 streams_xattr.so -rw-r--r-- 1 root root 15112 Mar 7 22:40 syncops.so -rw-r--r-- 1 root root 43784 Mar 7 22:40 time_audit.so -rw-r--r-- 1 root root 23304 Mar 7 22:40 xattr_tdb.so martin@homesvr:~$
Given a moment or two to settle and re-trying the browsing from the desktop my access was restored. Checking the logs once more:
martin@homesvr:~$ greyhole -S Currently working on task ID 535303: write movies/Million Dollar Baby.m4v Recent log entries: Apr 14 20:36:50 7 write: File /share/movies/Million Dollar Baby.m4v is locked by another process. Will wait until it's unlocked to work on it. Apr 14 20:36:50 7 sleep: Only locked files operations pending... Sleeping. Apr 14 20:37:00 6 write: Now working on task ID 535302: write movies/Million Dollar Baby.m4v Apr 14 20:37:00 6 write: File changed: movies/Million Dollar Baby.m4v - 797MB Apr 14 20:37:00 7 write: Will use source file: /media/hdd3/gh/movies/Million Dollar Baby.m4v Apr 14 20:37:00 7 write: Loading metafiles for movies/./Million Dollar Baby.m4v ... Apr 14 20:37:00 7 write: Got 2 metadata files. Apr 14 20:37:00 7 write: 2 metadata files loaded. Apr 14 20:37:01 7 write: File /share/movies/Million Dollar Baby.m4v is locked by another process. Will wait until it's unlocked to work on it. Apr 14 20:37:01 7 sleep: Only locked files operations pending... Sleeping. Last logged action: sleep on 2013-04-14 20:37:01 (4s ago) martin@homesvr:~$
And I am now successfully browsing all my shares. This is something to be aware of as Greyhole is not updated or checked during the OS upgrade to Ubuntu 12.04.

I hope that this helps someone.

Addendum...
... if anyone is interested, the Zoneminder issue was actually a bug in the upgrade of the Zoneminder application to 1.25.0-1.

The bug is registered here:
https://bugs.launchpad.net/ubuntu/+source/zoneminder/+bug/940632

And the workaround is as follows (you *did* write down your MySQL admin password during the installation, didn't you?):

martin@homesvr:~$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 63 Server version: 5.5.29-0ubuntu0.12.04.2 (Ubuntu) mysql> GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY "zmpass"; mysql> quit Bye martin@homesvr:~$

So that's my server successfully updated to Ubuntu 12.04LTS with both issues now resolved.