[SOLVED] Time Machine on GL.iNet GL-XE300 Puli

I recently purchased a GL.iNet GL-XE300 Puli intending to set it up with a demanding set of requirements, one of which is using it for Time Machine backups of my Mac. I had successfully completed my required setup on another router (TP-Link TL-WR902AC v3) with OpenWrt installed. There is no official OpenWrt release for the GL-XE300 so I'm using the GL.iNet flavour of OpenWrt with Luci installed trough their GUI. The recipe I am following is below.

My setup on the GL-XE300 differs from the TL-WR902AC in three [possibly] meaningful ways...

  1. No need to install TravelMate because the GL.iNet firmware provides equivalent functionality.
  2. No need to install OpenVPN because the GL-XE300 already has it.
  3. The GL.iNet implementation of OpenVPN means a different approach to setting that up.

Everything works fine until I add the Time Machine backup part. Then attempting to load the GL.iNet web interface either fails to connect or returns a 403 error. In Luci it is either fails to connect or returns a 404 error.

Having re-done this a number of times I have found that the failure occurs when I mount the Time Machine volume. I have marked that point in my recipe with the comment, "# ERROR OCCURS AFTER THIS!”

Even while I have no web GUI everything else seems to work, including across multiple reboots. I can connect to the router's WiFi. The router connects to the last used WiFi host, & makes the last used VPN connection if one was running when connections to the GUI last worked. And my backups run repeatedly as they should. However with no GUI I cannot do things like change the remote host that I'm connected to (important for a travel router), or change the VPN connection that I'm using.

Can anyone provide any insight into why this is happening or how to resolve it?

GL-XE300 Recipe

Steps Taken

  1. Initial Router Setup
  2. Set Up ExtRoot & Swap
  3. Update Packages
  4. Set Up OpenVPN
  5. Set Up AFP Netatalk

1. Initial Router Setup

Connect to WiFi GL-XE300-xxx with password goodlife.

http://192.168.8.1
  1. Scan for & connect to remote networks.
  2. Set updates.
  3. Set time zone.
  4. Customise LAN IP address.
  5. Customise WiFi & guest WiFi.
  6. Install Luci.
  7. In Luci set custom hostname.
  8. In Luci download a backup.

When re-doing...

  1. Scan for & connect to a remote network.
  2. Install Luci.
  3. In Luci restore backup.
  4. Run in SSH...
rm -rf /mnt/overlay/*

2. Set Up ExtRoot & Swap

Install packages...

opkg update
opkg install block-mount e2fsprogs fdisk kmod-fs-ext4 kmod-usb-ohci kmod-usb-storage kmod-usb-uhci kmod-usb2 kmod-usb3 nano usbutils

Set up ExtRoot...

block detect | uci import fstab
uci set fstab.@mount[0].enabled='1'
uci set fstab.@global[0].anon_mount='1'
uci commit fstab
/etc/init.d/fstab boot
mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt

block detect > /etc/config/fstab; \
   sed -i s/option$'\t'enabled$'\t'\'0\'/option$'\t'enabled$'\t'\'1\'/ /etc/config/fstab; \
   sed -i s#/mnt/sda1#/overlay# /etc/config/fstab; \
cat /etc/config/fstab
block info

Output...

root@OpenWrt:~# block info
...
/dev/sda1: UUID="9b150345-5a3e-4164-b494-3e91dccfde8d" LABEL="overlay" VERSION="1.0" MOUNT="/mnt/sda1" TYPE="ext4"
/dev/sda2: UUID="0c01be5c-efb0-4032-9dba-87aada184546" LABEL="swap" VERSION="1" TYPE="swap"
/dev/sda3: UUID="1536-CA6E" LABEL="web_dev" TYPE="exfat"

Using those UUIDs, edit fstab to look like...

config 'global'
	option anon_swap            '0'
	option anon_mount           '1'
	option auto_swap            '1'
	option auto_mount           '1'
	option delay_root           '5'
	option check_fs             '0'

config 'mount'
	option target               '/mnt/overlay'
	option uuid                 '9b150345-5a3e-4164-b494-3e91dccfde8d'
	option enabled              '1'

config 'swap'
	option uuid                 '0c01be5c-efb0-4032-9dba-87aada184546'
	option enabled              '1'

Reboot...

reboot

Check...

grep -e /overlay /etc/mtab
df /overlay /

Should give output like...

root@GL-XE300:~# grep -e /overlay /etc/mtab
/dev/sda1 /overlay ext4 rw,relatime,data=ordered 0 0
overlayfs:/overlay / overlay rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work 0 0
root@GL-XE300:~# df /overlay /
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1               116912      5004    103168   5% /overlay
overlayfs:/overlay      116912      5004    103168   5% /

Set opkg lists to /overlay & update...

sed -i -e "/^lists_dir\s/s:/var/opkg-lists$:/usr/lib/opkg/lists:" /etc/opkg.conf
opkg update

3. Update Packages

Use either GL-XE300 GUi or Luci.

6. Set Up OpenVPN

  1. Add one OpenVPN configuration.
  2. Start to test then stop.
  3. Download /etc/openvpn & /etc/config/ovpnclients using SCP.
  4. Remove the OpenVPN configuration.
  5. Make file sets for all required configurations using downloaded files as a template.
  6. Upload files using SCP.
  7. Select an OpenVPN configuration & start.

When re-doing...

  1. Upload files using SCP.
  2. Select an OpenVPN configuration & start.

5. Set Up AFP Netatalk

opkg install avahi-utils hfsfsck kmod-fs-hfs kmod-fs-hfsplus mkhfs netatalk shadow-groupadd shadow-groupmod shadow-useradd shadow-usermod sshfs

Upload prepared AFP files...

scp ./afp/afp.conf root@GL-XE300:/etc/
scp -p ./afp/afp_service root@GL-XE300:/etc/avahi/services/afp.service

Fix permissions...

chmod 644 /etc/afp.conf
chmod 644 /etc/extmap.conf

Add timemachine group...

groupadd timemachine

For each user...

useradd -M -G timemachine tmuser
passwd tmuser

Create mount point & set permissions...

block umount
mkdir -p /TimeMachine
chown root:timemachine /TimeMachine
#chmod -R 776 /TimeMachine
touch /TimeMachine/USB_DISK_NOT_PRESENT
chmod 444 /TimeMachine/USB_DISK_NOT_PRESENT

Add backup drive to fstab...

config 'global'
	option anon_swap            '0'
	option anon_mount           '1'
	option auto_swap            '1'
	option auto_mount           '1'
	option delay_root           '5'
	option check_fs             '0'

config 'mount'
	option target               '/mnt/overlay'
	option uuid                 '9b150345-5a3e-4164-b494-3e91dccfde8d'
	option enabled              '1'

config 'swap'
	option uuid                 '0c01be5c-efb0-4032-9dba-87aada184546'
	option enabled              '1'

config 'mount'
	option target               '/TimeMachine'
	option device               '/dev/sdb1'
	option fstype               'hfsplus'
	option options              'rw,sync'
	option enabled              '1'
	option enabled_fsck         '1'

Remount volumes...

block mount # ERROR OCCURS AFTER THIS!
block info

Output...

root@GL-XE300:~# block info
/dev/mtdblock5: UUID="934529054" VERSION="1" TYPE="ubi"
/dev/ubiblock0_0: UUID="baa0c1dc-435ec14b-711f3b15-c76dcbea" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/ubi0_1: UUID="a02770ab-18a7-4504-a86b-ee1fb6609cfc" VERSION="w4r0" MOUNT="/mnt/ubi0_1" TYPE="ubifs"
/dev/sda1: UUID="9b150345-5a3e-4164-b494-3e91dccfde8d" LABEL="overlay" VERSION="1.0" MOUNT="/mnt/overlay" TYPE="ext4"
/dev/sda2: UUID="0c01be5c-efb0-4032-9dba-87aada184546" LABEL="swap" VERSION="1" TYPE="swap"
/dev/sda3: UUID="1536-CA6E" LABEL="www" MOUNT="/www" TYPE="exfat"
/dev/sdb1: LABEL="TimeMachine" MOUNT="/TimeMachine" TYPE="hfsplus"

Create Backups folder & set permissions...

mkdir -p /TimeMachine/Backups
chown -R root:timemachine /TimeMachine
chmod 776 /TimeMachine
chmod -R 777 /TimeMachine/Backups

Restart the afpd daemon...

/etc/init.d/afpd restart

Start the dbus & avahi daemons...

/etc/init.d/dbus start
/etc/init.d/avahi-daemon start

Preserve Configuration on firmware upgrade...

echo '/etc/afp.conf' >> /lib/upgrade/keep.d/afp
echo '/etc/avahi/' >> /lib/upgrade/keep.d/afp
echo '/etc/extmap.conf' >> /lib/upgrade/keep.d/afp
echo '/home/' >> /lib/upgrade/keep.d/afp
echo '/var/netatalk/' >> /lib/upgrade/keep.d/afp

Verify...

sysupgrade -l

Restart to make sure these changes take effect...

reboot

Setup Time Machine on macOS.

First off, are you using an official build (from downloads.openwrt.org) or the GL customized firmware? For the latter you should ask there for support.

That makes no sense. /overlay is everything you write to the base / filesystem that is not in the /rom. Automatically (though indirectly) opkg will install packages there. Don't write files directly to /overlay.

In order to nuke everything back to only the ROM and start over, run firstboot-- again don't write to /overlay yourself.

External /overlay should not be necessary here since there is plenty of internal flash, especially if your build mounts the NAND chip. Have you tried installing everything except the data disk internal?

That particular model doesn't seem like a good choice for a file server-- single core CPU, Ethernet limited to 100 Mb, and no USB3.

1 Like

Using hfsplus on linux is very "experimental" especially "journaled" hfsplus is only supported readonly I would not do that especially for a backup drive.

Journalling is absolutely not supported & I have it disabled on the drive I'm using. I have read the caveats of using HFS+ on the OpenWrt pages, but it works, while my attempts with Ext4, ExFAT, & NTFS have not. Backups are running even when I don't have a web GUI.

There is no official build for the GL-XE300, so I'm using the GL.iNet flavour. I thought that should be clear from multiple elements of my post, & have edited to make it more explicitly so. I've also emailed GL.iNet at the same time as making this post.

That step is directly from the OpenWrt page on Extroot configuration, in the section Preserving opkg lists. Everything up to that point continues to work correctly after that step.

I had decided between posting this & sleeping to try doing away with the Extroot this evening. The router has a Micro SD slot that I have a 64 GB card in. I'm sure I can find other use for it.

Then the TL-WR902AC that I worked my setup out with is even less adequate, but it also works. Both are travel routers & I'm setting this up for when I'm on the move later this year. The GL-XE300 also takes a 4G data SIM giving me more outward connection options, & has an internal battery so I get some use of it without access to a power outlet.

While it's a complete mystery as to why it makes a difference, doing away with Extroot has solved it. I now have a backup running, & adding to existing backups, & still have my web GUIs.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.