using image backup on multiple RevPi devices

Topics about the Software of Revolution Pi
Post Reply
sofiene
Posts: 23
Joined: 24 Dec 2019, 15:36

using image backup on multiple RevPi devices

Post by sofiene »

hello

i have purchased a total of 25 RevPi core 3+ devices and i only configured one as a testing device
i would like to know if i can backup the system image of the configured RevPi via Win32DiskImager and install it on the other devices.
i would like to know:
  • if i'm going to need to reconfigure the DIO module on all devices.
  • if the password is going to be the same as the configured device on all other devices.
  • if the mac address is going to be the same on all the devices.
  • and if there is any other problem i have to consider.
thank you
User avatar
dirk
Posts: 2271
Joined: 15 Dec 2016, 13:19

Re: using image backup on multiple RevPi devices

Post by dirk »

Hi sofiene and welcome to the RevPi Community. If you make a copy of the image and write it to another device all settings will be equal.
The MAC address, the PiCtory configuration, the password will be the same.

So here is my recommendation for you how to provide a factory reset after "cloning" the devices:

1 - Reset the password i.e. to "raspberry" before you make an image. You can use the "passwd" command
2 - Delete the file "/home/pi/.revpi-factory-reset"
3 - Make the image

4 - Copy the image to a device
5 - Boot the device with a HDMI monitor - you will see the IP address at the end

6 - Now you can do this manually or with the attached Python script
a) you login and you will be prompted for entering device type, serial and mac address. You find the values on the front of the device.
b) you run the the attached Python script from a device in the same network.
You have to type in the IP address that you see on the HDMI monitor and use a barcode scanner to scan the two QR codes on the front.

7 - After a reboot the MAC address and the password are factory-default as on the sticker.

I wrote this script just for making my life easier. So I'll post it here without warranty and with all the uglyness :)
Useful tips are welcome.

Have a look at the comments "install SSH key" or "don't install SSH key" (yes it is a bit quick and dirty).
Here you may provide a SSH key for authentication so that you don't have to login using a password.
revpi-factory-reset.ssh.py.zip
(1.69 KiB) Downloaded 824 times
sofiene
Posts: 23
Joined: 24 Dec 2019, 15:36

Re: using image backup on multiple RevPi devices

Post by sofiene »

dirk wrote: 07 May 2020, 15:27 Hi sofiene and welcome to the RevPi Community. If you make a copy of the image and write it to another device all settings will be equal.
The MAC address, the PiCtory configuration, the password will be the same.

So here is my recommendation for you how to provide a factory reset after "cloning" the devices:

1 - Reset the password i.e. to "raspberry" before you make an image. You can use the "passwd" command
2 - Delete the file "/home/pi/.revpi-factory-reset"
3 - Make the image

4 - Copy the image to a device
5 - Boot the device with a HDMI monitor - you will see the IP address at the end

6 - Now you can do this manually or with the attached Python script
a) you login and you will be prompted for entering device type, serial and mac address. You find the values on the front of the device.
b) you run the the attached Python script from a device in the same network.
You have to type in the IP address that you see on the HDMI monitor and use a barcode scanner to scan the two QR codes on the front.

7 - After a reboot the MAC address and the password are factory-default as on the sticker.

I wrote this script just for making my life easier. So I'll post it here without warranty and with all the uglyness :)
Useful tips are welcome.

Have a look at the comments "install SSH key" or "don't install SSH key" (yes it is a bit quick and dirty).
Here you may provide a SSH key for authentication so that you don't have to login using a password.

revpi-factory-reset.ssh.py.zip

thank you for your response dirk
duelingcats
Posts: 7
Joined: 14 Nov 2024, 07:34

Re: using image backup on multiple RevPi devices

Post by duelingcats »

dirk wrote: 07 May 2020, 15:27 Hi sofiene and welcome to the RevPi Community. If you make a copy of the image and write it to another device all settings will be equal.
The MAC address, the PiCtory configuration, the password will be the same.

So here is my recommendation for you how to provide a factory reset after "cloning" the devices:

1 - Reset the password i.e. to "raspberry" before you make an image. You can use the "passwd" command
2 - Delete the file "/home/pi/.revpi-factory-reset"
3 - Make the image

4 - Copy the image to a device
5 - Boot the device with a HDMI monitor - you will see the IP address at the end

6 - Now you can do this manually or with the attached Python script
a) you login and you will be prompted for entering device type, serial and mac address. You find the values on the front of the device.
b) you run the the attached Python script from a device in the same network.
You have to type in the IP address that you see on the HDMI monitor and use a barcode scanner to scan the two QR codes on the front.

7 - After a reboot the MAC address and the password are factory-default as on the sticker.

I wrote this script just for making my life easier. So I'll post it here without warranty and with all the uglyness :)
Useful tips are welcome.

Have a look at the comments "install SSH key" or "don't install SSH key" (yes it is a bit quick and dirty).
Here you may provide a SSH key for authentication so that you don't have to login using a password.

revpi-factory-reset.ssh.py.zip
Dirk,

I have a revpi 4 connect unit configured and software installed on that I need to make an image of to deploy to future revpi units similarly as the original poster. I have bookworm installed on my revpi 4 and was looking for the /home/pi/.revpi-factory-reset file. I did not see it. Has the process for resetting changed since you originally posted the script? I know this was asked about 5 years ago.
User avatar
RamiGspo
KUNBUS
Posts: 21
Joined: 02 Jun 2022, 23:20

Re: using image backup on multiple RevPi devices

Post by RamiGspo »

Hello duelingcats,

Great to hear that you are preparing a clean deployment strategy for your RevPi Connect 4.

You are right, some details have changed since the original post about cloning images. Specifically, regarding your question on Bookworm, the file /home/pi/.revpi-factory-reset is no longer used, and the equivalent reset mechanism now uses the file /etc/revpi/factory-reset. Removing this file before creating your image will give you a similar “first boot” effect on each device when flashing, but please note that it will not reset everything automatically and you would still need to handle certain device-specific configurations manually.

However, I personally do not recommend cloning an image and using it across all devices. While cloning may seem quick, it often copies device-specific settings that can cause conflicts, skips future package updates or necessary adjustments per device, and creates challenges when managing larger fleets, especially if configurations need to change over time.

For example, when cloning, you will copy the /etc/machine-id file generated during the first boot of the system, leading to all your devices having identical identities on the network, which can cause conflicts or confusion in device management systems later. To avoid this, you would need to delete /etc/machine-id before creating your image so that a unique ID is generated on first boot after flashing, but there can still be other side effects that may not be immediately visible during short test phases and can appear later when systems are in production.

One of the cleanest options you might consider is to build your own image using our open repository "debos-build". We use this internally to generate our official images, and you can use it as a starting point to create your customized, versioned images while maintaining a clean and reproducible state for every device you flash. Here is the repository: https://gitlab.com/revolutionpi/debos-build#debos-build . Using this approach, you can easily track changes, maintain version control, and ensure your devices always start from a known, clean state, even after updates.

Another alternative I personally like is using Ansible or a similar configuration management tool. With this approach, you can flash the latest released image on each device and then use Ansible playbooks to install your packages, configure users, copy necessary files, and adjust network settings across all devices consistently. This way, you maintain a clear, automated process to replicate configurations and can selectively define what settings apply to all devices and which are device-specific, ensuring reproducibility and simplifying future updates across your fleet.

Additionally, although we do not actively support it (and it is not my preferred method either), it is worth mentioning that you might consider running your application inside a container on RevPi for certain use cases. This approach allows you to separate your application from the base OS, making updates and migrations much easier, and helps ensure consistent deployments across devices while keeping your system clean and your application fully self-contained. Personally, I do not use Docker much but often use LXC containers for certain tasks, which work quite well. It might be worth experimenting to see if this approach aligns with your workflow and maintenance strategy.

I hope this helps... at least a little ;-)

Best regards,

RamiGspo
Mit freundlichen Grüßen | Best regards | Muchas gracias

Ramiro Gsponer.
Post Reply