Guide: Reflashing your device

Your device contains an SD card with the AutoPi Core preinstalled. The SD card is located inside the device.

If you find yourself in need of reflashing your device, then you can always get the latest AutoPi Core image right here:

Make sure that you select the right image for your device. Generation 2 devices should use the autopi_core_gen2_*.img.gz image while generation 3 (TMU) devices should use the autopi_core_tmu_*.img.gz image. We recommend using Etcher for flashing, it will take the GZ image directly and flash it:

Once you have flashed your device, you will need to have it re-accepted in the AutoPi Cloud. To do so, you need to first have the device boot up and connect to the internet. After that, log in to You should immediately see a notification letting you know that the device’s key isn’t accepted.

Another way of accepting the key is to go to the Settings page and navigating to your device’s general settings. There you should be able to see that the “Key state” field says unaccepted and a green “Accept” button should be showing. Clicking on the button, accepts the key.

When your device comes online the first time, the WiFi hotspot will have the following setup:

SSID: AutoPi-Initial
Password: autopi2018

Remember to update your device from the cloud after you reflash it, as that will ensure that all the configuration values are properly configured (like the WiFi SSID and password), and that the device has the correct authentication token for uploading data to the cloud.



yes, but we can’t because the sd card is protected from writing

I already found the folder, I can save it, but I can’t write. how can I do ?

I assume you are talking about the location to where you want to copy the files and not the card it self being write protected.
You need to give the PI user (that’s the pre-setup system user you are logging in with) the access to write to the folder you want to copy the files to, or you can “sudo su root” and copy the files from a network source directly to the folder. Also be sure that the file and folder rights are the same before and after the copy, so system has the right access to read/write/execute the files.


Yes, it is what I try to do, but still don’t know how to do.

Sudo su root, from autopi web terminal ?
Because ssh I can’t

Im assuming you you have re-flashed your card and you have SSH access to the device?
Are you connecting to the AutoPi from Windows, Mac or Linux ?

For me is best with Mac
Yes, because I had reflashing it few days ago, I can’t accès to ssh
I have pc windows too, so, I can try with but I don’t know how

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 :wink: 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 ( to SSH to the AutoPi.

  • To copy the minion files I use WinSCP ( 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 /etc/salt/pki/minion
    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.pem /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 on any device of your choice and check that your AutoPi is online and then perform the update or other task you want from .
1 Like

Thank’s you so much ! I will try tomorow.
I wknown_hostsill try to do step by step.
But the first problem I have is that:


I know I should delete the “known_hosts” but I don’t know how

Then, when i solve this ssh problem, I can fellow your tuto.

And where are you getting that error? On the AutoPi when trying to SSH in to it?
If you have the AutoPi connected to a screen through HDMI cable, just add a keyboard to it and log on locally on the AutoPi using the pi user and fix the SSH access rights or approved hosts access.


1 Like

I am too bad because I can’t do it
I connect with WinSCP (ok)
I am connect as : pi (ok)
I use putty from scp and login as : pi
I write: cp /etc/salt/pki
Then I am in the folder
I write: sudo cp minion minioncopy
Then i have this: sudo: unable to resolve host autopi-ddfd00ac3465
So I try to login a root
I write: sudo su root
Then try again login as root:
Same problem

Hi Remy

You can just ignore the “unable to resolve host”, it is a minor bug in our code, and will be fixed soon.

The last error in your screenshot is that you need to use the argument “-r” when copying the minion directory, this is needed when copying directories.
So instead try with the -r argument like so.

cp -r minion minioncopy

You only need to use sudo in the command, if you have not already executed “sudo -s”.
If the line in your terminal starts with “root@” like in your screenshot, then you are already running with the root privileges.

Best regards

1 Like

i succed …:grimacing::nerd_face:


Yeap sorry, missed the -r argument while I was writing up the steps.

1 Like

No problem :sweat_smile:
I am ready to flash again :slight_smile:

I just want to found before the known_hosts folder.
I can’t find on WinSCP

I need delete/edit ? the line where i usually connect from my Mac

If you have no issue with SSH in to you device then ignore the error and continue.

I just want to log again with my Mac ;).

I just got a bit lost when it comes to: “Remember to update your device from the cloud” - how is that done, I didn’t intuitively or by a search find how this is done.

I am having some trouble, after reflashing the unit. Internet connection just seems to work with WiFi and not via the SIM card, I’ve tried two different SIM from two different companies. After that, in the auto pi cloud, it keeps saying that my unit needs some software upgrades but does not seem to install them, even when the device is connected via WiFi, is there any way to install the upgrades via SSH in some way?