Ok, Im a Microsoft guy so cant help you with Mac “how to” since Mac is just a reskinned Linux in my Microsoft fan boy world but I can give you the steps I do when I re-flash my AutoPi. Do note that the way I do the Linux steps are not by any means the best Linux way to do it, im just a Microsfot guy so there is probably some better way to do the Linux commands and elevation of user access for the folders and pi user.
Before you re-flash the device, SSH in to AutoPi and manually backup the key files in
/etc/salt/pki/minion to the computer you are SSH’ íng from. In my case that is a Microsoft PC connected to the AutoPi Wifi hotspot and using Putty (https://www.putty.org/) to SSH to the AutoPi.
- To copy the minion files I use WinSCP (https://winscp.net/) to copy the files to my Windows PC.
- in SSH session go to
/etc/salt/pki/ and run the commands:
This command will copy the minion folder to new folder (This is not needed if you will scrap/re-flash the same card and not take a full backup of the card), I do this step since I usually take a full backup of the card in case I want to restore it later (Here I use foldername_DateofCopy: minioncopy09022019, but you can use any folder name you want).
sudo cp minion minioncopy09022019
This command will give owner rights access to User “pi” for the copied folder, this is required since WinSCP will use AutoPi user ‘pi’ to connect and we need the access rights to copy the folder content.
sudo chown pi minioncopy09022019
*Connect to your AutoPi with WinSCP and copy the content of the folder “minioncopy09022019” or the original “minion” if you did not make a copy and just gave pi user access to the original folder.
Re-flash the AutoPi card with the above instructions in the Guide.
Add the card back in to your hardware and boot up the AutoPi.
Connect to the AutoPi Wifi hotspot (since the re-flashed AutoPi now has the core images User and Password, you need to connect with User:pi Password: autopi2018)
if you have connected with putty previously to the AutoPi then you will get a security warning about the host key windows has for the device (mac address) does not match the existing one:
Ignore the security warning as this will change again with the next steps (i.e select ‘yes’).
Open WinSCP and connect to your AutoPi and copy the backup of the minion folder from you computer to AutoPi.
I copy my backup to the pi user location ‘/home/pi/’ but you can add it to any location on the AutoPi you think makes sense.
Open a SSH session to AutoPi and change user to root:
‘sudo su root’
- And copy the files from the folder “minioncopy” to the folder
Go to your backup folder that you copied over to AutoPi, in my case:
root@raspberrypi:/etc/salt/pki/minion# cd /home/pi/minioncopy09022019/
Copy the backup files to the minion folder:
root@raspberrypi:/home/pi/minioncopy09022019# cp minion_master.pub minion.pem minion.pub /etc/salt/pki/minion/
- reboot the AutoPi so it can re-read the copied config files and connect to internet so it can re-connect with AutoPi server, go to https://my.autopi.io on any device of your choice and check that your AutoPi is online and then perform the update or other task you want from https://my.autopi.io .