Duplicated RPi: re-install agent?

We have a duplicated Raspberry Pi (i.e. - the SD card is copied from the first installation). The Remote-it agent thinks it’s the original installation - what’s the best way to differentiate between the two? I’m thinking to just change the hostname, but will that be enough for the agent to tell the difference?

The best way to do this is by uninstalling remote.it then reinstalling.
To remove remote.it run the following command on one of the devices:

sudo apt purge remoteit

Then you can proceed to use the Add Device one-line install.

FYI they still might look similar if both of the hostnames are the same, but there will be 2 devices. You can change the hostname of one if you want to differentiate prior to choosing one of the options.

Multiple Devices:

If you want to make multiple copies of an SD card then you will need to make a master image which has been registered and then you have deleted the file /etc/remoteit/config.json and make a file /etc/remoteit/registration that has a bulk registration code in it. Then you can copy the SD card.

See our article Registration with Pre-configured Services


Follow this next part only if you want a custom name.

Setup your first device with your software and Remote.It using the device package and modify the oem.sh file which sets the identity and name. This first device will register with hostname but that is ok, you can later remove this device since it will be the master image.

Make sure your modification works before putting this into production as it might have undesired consequences such as registration failure or bricking the device since you will be modifying a shell script

Open /usr/share/remoteit/oem.sh. By default the device name is generated by the function r3_get_name(), modify the function to use the name you want.

To use the MAC address: There is a function r3_get_macaddr(). You should be sure that you fix the network adapter so that the MAC address doesn’t change if a different network adapter becomes active on the device, otherwise it will re-register as the new MAC address.

To use a different name such as a serial number or other custom name: You will need to write a file to the device that oem.sh can read upon start up with a network connection.

The example below has been modified to read a file for the name by reading a file placed on the system for serial number.

 r3_get_name() { # Modified to use the r3_get_serial() function # uname -n r3_get_serial } r3_get_serial() { # Modify this for the path to the serial number file below is an example cat /sys/firmware/devicetree/base/serial-number }

You can confirm the updated function works as expected from the shell command line function after modifying on your master device, given that you have written the serial-number file.
/usr/share/remoteit/oem.sh && r3_get_name
> 00000000f637bc7

Before burning the device image or SD card:

  • Ensure that the modified oem.sh is in place
  • Remove your serial number file
  • Update the registration file in /etc/remoteit/registration to be empty
  • Delete the /etc/remoteit/config.json file

After burning the image and BEFORE starting up the new device with a network connection

  • Write your serial number file with value to the path that is in oem.sh when you have the serial number or identifier file in place
  • Update the /etc/remoteit/registration with your Bulk Registration ID (from the OEM Process)
  • Start up with network connection.

Please test this first before moving into full production.