AFP can’t write because of locked volume

afpNetworkpermissionsharing

I'm trying to write contents to my shared folders on my Raspberry Pi over AFP.
However I keep getting the same error/warning regarding permissions and locked volume:

Screenshot

I'm fairly sure permissions are right, I'm logged and as the default pi user and used chown -R pi /mnt/seagate on the pi to own my HDD mount for the pi user.
This didn't work so I tried setting permissions for my /var/www folder with chmod -R 777 /var/www, resulting in the same error pictured above.

Checking the permissions in the Finder for the home folder (which should be no issue, being logged in as the pi user) I see that everyone has RW permissions.

screen
screen

I think the issue isn't my pi's fault (hence why I posted this here and not on raspberrypi). I think there must be something wrong with my AFP configuration on my Mac (also note that I used this method of sharing folders from pi with AFP to mac before and it always worked before).
I attached a screenshot of my afp configuration below since I have no clue what could be wrong. If needed to help, I can also provide the configurations for netatalk (afp protocol on the pi).

afp_conf_screen

Best Answer

Probably some permissions and/or the settings are set wrong on your Raspberry. I suspect the external drive or a shared folder on the external drive to have wrong permissions set. Compare that with the your home folder on the Raspberry where you probably have full r/w access.

Please try this as a first step. You may apply special settings/configs later. Below i assume that your external disk is sdb and contains one ext4 volume sdb1 with the name seagate. The volume/partition itself should not be owned by pi but by root!

First stop netatalk with:

sudo /etc/init.d/netatalk stop

Unmount your external volume after checking the the mounted volumes with df or cat /proc/mounts to get the identifier of your external disk:

sudo umount /dev/sdb1

First we have to fix your mount point:

The following permissions should apply (check this with ls -la on the Raspberry):

For /mnt

drwxr-xr-x  3 root root  4096 Apr  6 13:52 mnt

Check that the folder /mnt contains a folder seagate with ls -la:

drwxr-xr-x  3 root root 4096 Apr  6 13:52 .
drwxr-xr-x 22 root root 4096 Apr  6 11:21 ..
drwxr-xr-x  8 root root 4096 Apr  6 14:14 seagate

Add the folder if necessary with sudo mkdir /mnt/seagate and change permissions and ownership accordingly with chown and chmod.

Get the UUID of all volumes with sudo blkid. You should get a similar output like that one:

/dev/sda5: UUID="7a7dd5de-758e-4488-b78d-dd7f7c61cfbc" TYPE="swap" 
/dev/sda1: UUID="9b4285a8-3290-469a-91f3-7517f286856e" TYPE="ext4" 
/dev/sdb1: LABEL="seagate" UUID="522e7f4c-ee90-4265-82c1-e46f48f969b5" TYPE="ext4"

sda1 and sda5 are your internal main and swap partition. sdb1 is the first volume on your external disk.

Check with sudo nano /etc/fstab if your fstab file mounts the volume of the external disk at /mnt/seagate. Replace the UUIDs below with those found in your setup.

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=9b4285a8-3290-469a-91f3-7517f286856e /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=7a7dd5de-758e-4488-b78d-dd7f7c61cfbc none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
UUID=522e7f4c-ee90-4265-82c1-e46f48f969b5" /mnt/seagate/     ext4    errors=remount-ro 0       1

Remount sdb1 with sudo mount /dev/sdb1 and check the mountpoint with df. It should look like this:

...
...
/dev/sdb1   8256916  170156   7667332    3% /mnt/seagate

Now create a base folder for the user pi:

sudo mkdir /mnt/seagate/pi

Move all your personal folders to pi with:

sudo mv /mnt/seagate/folder sudo mv /mnt/seagate/pi/folder

Example:

sudo mv "/mnt/seagate/Film - 1" "/mnt/seagate/pi/Film - 1"

Then apply ownership recursively with

sudo chown -R pi:pi /mnt/seagate/pi

Reapply ownership and permissions of /mnt/seagate/lost+found with

sudo chown -R root:root /mnt/seagate/lost+found
sudo chmod 700 /mnt/seagate/lost+found

Now you have to check netatalk and fix it if necessary:

Locate the following startup options and change them as noted below in /etc/default/netatalk with sudo nano /etc/default/netatalk:

ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no 

Go to the end of the file /etc/netatalk/afpd.conf. It should look similar to this:

# default:
- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword

Now configure the shared volumes in /etc/netatalk/AppleVolumes.default near the end of the file:

~/              "Home Directory"
/mnt/seagate/pi "pi-seagate" allow:pi

The first is the directory to share, the second is the name visible in the "Connect to Server" -> "Volumes to select" window and later on your desktop and the third is/are the allowed user(s).

Restart netatalk with:

sudo /etc/init.d/netatalk start

Try to connect to the share(s) with your Mac OS X 10.10 client by entering: "afp://ip-address" in 'Go to...' -> 'Connect to Server'.