Skip to content

Ubiquiti - Unifi Cloud Gateway Persistent ZeroTier Install - Possible Solution #2488

@YodaMcFries

Description

@YodaMcFries

Hi All!

We've created a semi-solution for Persistent ZeroTier installs on the new Unifi Cloud Gateway (UCG) Series
For context:
The issue we are having is that after a firmware upgrade the UCG does not reinstall any packages in the /config/data/firstboot/install-packages/ directory like the UDM series does, however, the UCG keeps the config file for the ZeroTier installation, meaning a quick reinstall of the package and the UCG reconnects to the network and all is well.

To resolve this we have implemented the following:
Follow this guide on the ZeroTier Website under the ''ARM64" tab
https://docs.zerotier.com/ubiquiti/

Once ZeroTier is installed and working, the following can be done.

A script is to be created that installs the ZeroTier application if it is not already installed:
Create the following script file:

vi /config/data/firstboot/install-packages/install.sh

Once in the text editor paste the following:

#!/bin/sh
 
# Install ZeroTier if it's not already installed
if ! command -v zerotier-cli >/dev/null 2>&1; then
    dpkg -i /config/data/firstboot/install-packages/zerotier-one.deb
fi

Once this is pasted save and quite the file.
After that, run the following command to make the script executable

chmod +x /config/data/firstboot/install-packages/install.sh

For the script to be run after an upgrade you will need to create a persistent service that runs on boot.

To do this you will need to paste the following command:

sudo tee /etc/systemd/system/zerotier-reinstall.service > /dev/null << 'EOF'
[Unit]
Description=Install ZeroTier if not present
After=network.target
[Service]
Type=oneshot
ExecStart=/config/data/firstboot/install-packages/install.sh
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
EOF

Once this has been done, run the following command to enable this service to run on boot.

systemctl enable zerotier-reinstall.service

Your system should now have a persistent ZeroTier installation, Congrats!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions