(Amiberry powered) Lightwave render farm, pt 3

By | 2020-05-31

In the previous article, we talked about the different options regarding the shared content directory that we’ll be using. We will now see some example configurations and how to set them up.

Scenario 1: Having the shared content directory on a Linux server

This scenario also includes the case where one of the Raspberry Pi boards is acting as the server, and holds the directory with all the content, which all the other machines will use. Here’s what you need to do, to make things work:

  • Install the Samba service on the Linux machine that will be sharing the content directory:
sudo apt update
sudo apt install samba samba-common-bin
  • Open the Samba configuration file, so we can make some changes to it:
sudo nano /etc/samba/smb.conf

By default, the smb.conf file inludes a Read-Only share definition for the home directory. The easiest way to proceed, is to make that one read/write (that is assuming you have your content directory somewhere under your home directory). To do that:

  • Find the line that says read only and set it equal to no.
  • Change the “create mask” and “directory mask” both to 0775. This will make all your newly created files and directories to have group=rw permissions.
  • Finally, save and exit.

Alternatively, you could share a specifc directory only, by replicating the options from the [homes] share definition, inside the smb.conf file, with a new share name (e.g. [projects]).

  • Create a Samba password for remote access, as user pi:
sudo smbpasswd -a pi
  • And finally, restart the Samba service:
sudo service smbd restart

Here’s an example entry (sharing a specific directory named /home/pi/projects as “projects“):

[projects]
comment = Projects
path = /home/pi/projects
browseable = yes
read only = no
create mask = 0775
directory mask = 0775

(Optional): You may need to enable the SMB1 protocol, if you want to connect to this share from within AmigaOS. Unfortunately, the newer and more secure versions of SMB are not supported on the Amiga clients, and SMBv1 is disabled by default on Samba server for security reasons. If you find yourself in such a situation, follow these extra steps:

  • Open /etc/samba/smb.conf
  • Add the following statement in the global settings section of the file:
[global]
...
ntlm auth = ntlmv1-permitted
...
  • Restart the Samba service:
sudo service smbd restart

Scenario 2: Having the shared content directory on a Windows server

If you have a Windows computer in your LAN, you might want to use that as the Shared content location. To do that, you’ll need to enable “Sharing” for your content directory, and allow read/write access to the Raspberry Pi username(s). You can alternatively allow read/write for all, which is less secure of course, but if you’re only using this inside your home LAN, it might be OK. You’ll have to judge for yourself on this one.

To enable Sharing:

  • Right-click on the folder that contains your 3D content and select Properties.
  • Go to the “Sharing” tab
  • Select Share
  • Select Everyone and give Read/Write access (or select specific usernames, if you want)
  • Confirm with OK

(Optional): To enable SMB v1 support on Windows, in case you want to mount this share from within AmigaOS (e.g. from a real Amiga), you will additionally need to follow these steps:

  • Open the Control Panel
  • Open Programs and Features
  • Select “Turn Windows Features on or off”
  • Enable “SMB 1.0/CIFS File Sharing Support”

Mounting the shared directory from the Raspberry Pi

Regardless of which scenario you chose to share the content directory, you will need to have the other machines mount it eventually. On all the “Slaves”, you will need to install the Samba client component, and autofs (which will allow us to auto-mount the shared directory on demand):

sudo apt install autofs smbclient

You should now have a few files that autofs installed:

/etc/auto.master
/etc/auto.smb

Start by making /etc/auto.smb executable:

sudo chmod 755 /etc/auto.smb

To mount a Samba share, we’ll need credentials (a username and a password). We don’t want to have to specify those manually every time, especially since we want this auto-mount to work automatically and on-demand. So, we’ll create a file that will hold our credentials, and we’ll tell autofs to use that when connecting to our server. Let’s start by creating a new directory, to place the credentials file into. I’ll name that “creds“:

sudo mkdir /etc/creds

And now let’s create a file for credentials, per server. For example, if our server is named “koula.local“:

sudo nano /etc/creds/koula.local

Enter your username/password credentials for that server:

username=user
password=mysecretpassword

Now let’s secure the file, so that only root can read it:

sudo chmod 600 /etc/creds/koula.local

Next, we need a new row in the /etc/auto.master file:

/cifs /etc/auto.smb --timeout 300

Save the changes to the file (Ctrl-O, Ctrl-X), and restart the service so it will pick it up:

sudo systemctl restart autofs

Finally, let’s test that the auto-mounting works:

ls -al /cifs/koula.local/projects

If all went well, you should see the contents of the shared directory under your /cifs/<servername> directory! Test that this works even after rebooting your board, to avoid any surprises later. We will be using this directory as a mounted virtual Hard Drive in Amiberry, so that ScreamerNet can read/write files there, so make sure you have full read/write access!

Note: you might need to use the full hostname & domain name, as per the examples above.

Mounting the shared directory from AmigaOS

If you want to use a real or emulated Amiga as part of your setup, you will need to mount the shared directory from within AmigaOS. This works, but the performance will be worse than the Linux approach above, and you also have some restrictions (the Amiga Samba client does not support newer protocol versions than the old SMBv1).

Regardless, if you still want to do this, here’s what you’ll need:

  • SMBFS (there’s a version on Aminet, but it’s quite old). There’s a newer one on SourceForge instead.
  • SMB-Mounter from Aminet (Optional, but nice to have front-end)

Extract the archives, and place the smbfs binary inside the SMB Mounter directory. Start up SMB Mounter, and go to the program’s Settings. We’ll need to specify where it can find the smbfs binary:

In this example, I’ve placed smbfs in my C: directory

Now let’s add an entry in the Mount list that SMB Mounter has:

  • Select New -> SMB
  • The Name you want to have for this mount, will be automatically filled-in as you complete the rest of the fields and press enter.
  • Enter the Workgroup or Domain name
  • Enter the Hostname of your server (e.g. for my examples above, it would be “KOULA”)
  • Enter the Service you want to mount. This should be the shared directory name, as it appears through Samba. For my examples above, it would be “Projects”)
  • Enter your username and Password information
  • The Volume of this new mount, will be also automatically filled-in, if you press Enter at any point while filling-in the other fields.

Once you’re done with the new entry, click on OK and double-click on it to attempt to mount it. If all went well, you should see a new Volume appear on your Workbench. At this point, don’t forget to Save your mount configuration in SMB Mounter, by going to Projects->Save all mounts – It’s not saved otherwise!

In the next part of the guide, we’ll setup Amiberry itself and the configuration needed to make this work.