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...
- No need to install TravelMate because the GL.iNet firmware provides equivalent functionality.
- No need to install OpenVPN because the GL-XE300 already has it.
- 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
Connect to WiFi GL-XE300-xxx
with password goodlife
.
http://192.168.8.1
- Scan for & connect to remote networks.
- Set updates.
- Set time zone.
- Customise LAN IP address.
- Customise WiFi & guest WiFi.
- Install Luci.
- In Luci set custom hostname.
- In Luci download a backup.
When re-doing...
- Scan for & connect to a remote network.
- Install Luci.
- In Luci restore backup.
- 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
- Add one OpenVPN configuration.
- Start to test then stop.
- Download
/etc/openvpn
&/etc/config/ovpnclients
using SCP. - Remove the OpenVPN configuration.
- Make file sets for all required configurations using downloaded files as a template.
- Upload files using SCP.
- Select an OpenVPN configuration & start.
When re-doing...
- Upload files using SCP.
- 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.