Thursday 5 September 2013

Amahi 7 and Greyhole on HP Proliant (N54L) Microserver

I've had a long winded ride in getting Amahi 7 with Greyhole installed and working.

Some of the problems I faced:
  • Amahi 7 supports only installing from a DVD; I don't want a dvd drive
  • Amahi 7 USB install guide did not work for me
  • Amahi 7 does not have greyhole integrated yet, so a manual install has to be done
  • hda-greyhole did not work well with Fedora 19's Samba
  • After installing hda-greyhole and configuring samba to use it, I could no longer access the share and was getting the following errors:
Sep  5 01:48:23 amahi smbd[13392]:   Error loading module '/usr/lib64/samba/vfs/greyhole.so': /usr/lib64/samba/libsmbd_base.so: version `SAMBA_4.0.0' not found (required by /usr/lib64/samba/vfs/greyhole.so)
Sep  5 01:48:23 amahi smbd[13392]: [2013/09/05 01:48:23.379707,  0] ../source3/smbd/vfs.c:184(vfs_init_custom)
Sep  5 01:48:23 amahi smbd[13392]:   error probing vfs module 'greyhole': NT_STATUS_UNSUCCESSFUL
Sep  5 01:48:23 amahi smbd[13392]: [2013/09/05 01:48:23.379830,  0] ../source3/smbd/vfs.c:349(smbd_vfs_init)
Sep  5 01:48:23 amahi smbd[13392]:   smbd_vfs_init: vfs_init_custom failed for greyhole
Sep  5 01:48:23 amahi smbd[13392]: [2013/09/05 01:48:23.379946,  0] ../source3/smbd/service.c:632(make_connection_snum)
Sep  5 01:48:23 amahi smbd[13392]:   vfs_init failed for service Music
Sep  5 01:48:23 amahi smbd[13392]: [2013/09/05 01:48:23.389801,  0] ../lib/util/modules.c:56(load_module)

Here is a summarised list of how I got things working.  I've had to recreate all the steps here, leaving out all the incorrect attempts and dead ends and trying to patch them in an order that might work, so this might (in fact likely) to  have errors, so be careful, here be dragons.

Standard disclaimer applies; use the details here at your own risk, you could certainly destroy all your data and risk a bricked system! Also, this is outside of Amahi supported practices.


Note
I run a headless system so all commands after the installation of Fedora, are run in a bash terminal.

I ran all commands as root (i.e. I executed sudo su – in the terminal first)

This assumes a fair amount of knowledge, like being able to use ping and edit files.

In a nutshell
  1. Upgrade Memory
  2. Update Bios
  3. Install Fedora 19
  4. Install Amahi
  5. Add Hard Drive
  6. Change Share locations
  7. Install Greyhole
Upgrade Memory
I installed more RAM (Corsair CMV8GX3M1A1333C9 Value Select 8GB (1x8GB) DDR3 1333 Mhz CL9 Mainstream Desktop Memory Module”) first after taking out the 2GB it came with as I prefer my RAM to be exactly the same in my servers.

The case is easy to take apart; after you take off all the cables connected to the motherboard (conveniently easy to get to as it is at the front) the motherboard comes out easily as it sits on a metal sliding base.  The only issue I had was taking off the two thumb screws holding the motherboard in place as they were too tight to remove by hand…but HP provide a handy L-shape star wrench to use.

Update Bios
The official bios for this board has been modded to support 6 ports of AHCI SATA 3gb/s.  You can find the modded bios here: http://www.avforums.com/forums/networking-nas/1521657-hp-n36l-n40l-n54l-microserver-updated-ahci-bios-support.html

To create a bootable USB key with the bios just download the .rar file, extract, and execute RunMe.exe.

Install Fedora 19
Prepare your USB stick

Download Unetbootin: http://unetbootin.sourceforge.net/unetbootin-windows-latest.exe
Unetbootin is a standalone executable so doesn't need to be installed.  You will need admin rights.
Make sure you have a USB stick with enough space in your machine, then execute UNetbootin.
In the UNetbootin window for Distribution select Fedora 19_Live_x64

Make sure under type at the bottom, "USB Drive" is selected and that next to Drive it shows your USB stick, else you run the risk of overwriting your data.
Once UNetbootin finishes, don’t reboot, just exit.

Remove your USB stick and boot off it on your server.  By default it should be able to boot off USB, however you may need to enable booting off USB in the Bios if that is not already set .

Complete Fedora installation by following the instructions that appear.

Log on, turn on SSH and make available after reboot:
service sshd start
chkconfig sshd on

DNS
Make sure you can connect to the internet (ping google.com for example).  If you can’t, try manually adding DNS servers to /etc/resolv.conf (you could add the openDNS servers for example: 208.67.222.222 and 208.67.220.220)

Install Amahi
To install Amahi execute:
rpm -Uvh http://f19.amahi.org/noarch/hda-release-6.9.0-1.noarch.rpm
yum -y install mariadb-libs mariadb-server
yum -y install hda-ctl hda-platform
hda-install 

If all went well, your Amahi control panel (https://www.amahi.org/users) should show your new install as running (might take a minute or two to catchcup)
Optionally you can turn off DHCP in your router at this stage

Add Hard Drive
I used parted for prepping my new 4TB hard drive, which appeared as /dev/sdb (read here: http://rainbow.chard.org/2013/01/30/how-to-align-partitions-for-best-performance-using-parted/)
parted /dev/sdb
at the parted prompt
mklabel gpt
mkpart primary ext4 4096s 100%
align-check opt 1
quit

Format
mkfs.ext4 -L greyhole01 /dev/sdb1
mount
hda-diskmount
using the output from the above command, first backup /etc/fstab, and then add to /etc/fstab.
For me this meant I added the following to the bottom of my fstab:
UUID=e68bc54a-b795-4ce0-802f-213f4ab71e60 /var/hda/files/drives/drive1 ext4 defaults 1 2

Change Share Locations
I changed my default share paths from the drive that the OS lived on to my new drive using the Amahi web interface (after creating the following folder /var/hda/files/drives/drive1/shares/).  This is so I have plenty of space before greyhole can move files and as it is a drive in the pool, when Greyhole moves the files it should happen quicker if it decides to store a copy on the same drive (of course copies that need to be moved to other pooled drives will take more time).

Install Greyhole
As I’d already followed the installation instructions for installing greyhole on Amahi, before finding out that Amahi 7 didn’t work, I didn’t have to recreate the DB schema.  Here is what I had previously done:
yum -y install hda-greyhole
hda-create-db-and-user greyhole
mysql -u greyhole -pgreyhole  greyhole < /usr/share/greyhole/schema-mysql.sql

To upgrade greyhole, I removed hda-greyhole first:
yum remove hda-greyhole

and installed it from the greyhole repository
curl -o /etc/yum.repos.d/greyhole.repo http://www.greyhole.net/releases/rpm/greyhole.repo
yum update greyhole

I edited the /etc/greyhole.conf file, adding in my storage_pool_drive:
storage_pool_drive = /var/hda/files/drives/drive1/gh, min_free: 10gb

...and changed the db_user and db_pass to (security minded people should change this at some point):
db_user = greyhole
db_pass = greyhole


In /etc/samba/smb.conf I added the following two lines to the shares I wanted to participate in the pool:
dfree command = /usr/bin/greyhole-dfree
vfs objects = greyhole

I then restarted Samba and greyhole
Service smb restart
Service greyhole restart

I now have a working Amahi 7 with greyhole system.  I’ve tested it and all seems to work very well.


In summary
The combination that did not work:
Samba: samba-4.0.9-1.fc19.x86_64
Amahi Greyhole: hda-greyhole-0.9.31-1.x86_64

The combination that does work:
samba-4.0.9-1.fc19.x86_64
greyhole-0.9.34-1.x86_64

I'm fairly sure I've made a few mistakes in creating this both in terms of steps taken to get Amahi+Greyhole running, and producing this document.  Please feel free to, constructively correct me :-)

Links
Some links that gave me solutions and others that helped get me pointed in the right direction

Amahi Install related
https://wiki.amahi.org/index.php/Amahi_7_installation
https://wiki.amahi.org/index.php/Express_CD
https://wiki.amahi.org/index.php/USB_Install
http://docs.amahi.org/amahi-7-express.html

Greyhole related
https://wiki.amahi.org/index.php/Greyhole
http://greyhole.googlecode.com/svn-history/r415/trunk/INSTALL
https://forums.amahi.org/viewtopic.php?f=39&t=2714&p=13570
https://getsatisfaction.com/greyhole/topics/after_upgrade_now_shares_seem_to_have_stopped_working
https://forums.amahi.org/viewtopic.php?f=39&t=4035

HD Installation related
https://wiki.amahi.org/index.php/Adding_a_second_hard_drive_to_your_HDA
http://rainbow.chard.org/2013/01/30/how-to-align-partitions-for-best-performance-using-parted/

General reading
http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/VFS.html

Too many others to list

3 comments:

  1. Thankyou so much for this! I've been gradually migrating my data from my old Amahi 6 install to Amahi 7 on a completely new server, I had got most of it working except greyhole. I don't know where you found the info to get it working but I'm so greatful that you posted it, mine is now working sweet as a nut!

    ReplyDelete
    Replies
    1. FYI, I've come across a couple of issues that I haven't had time to see how to fix:

      1. if you change share settings via the hda web interface, it will overwrite smb.conf but not replace the two lines that are required for greyhole:

      dfree command = /usr/bin/greyhole-dfree
      vfs objects = greyhole

      You have to add them back in manually.

      2. When I add users through the hda web interface, it does not fully complete the user setup fully. I have to manually set the users password by running the smbpasswd tool.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete