Backup Raspberry

This should be the last step of the initial setup of the Raspberry. After this, I can start adding new services and play with it safely. The other two things I did are:

The tool I am considering for backup is autorestic. I’ve never used it personally but I got good reviews from colleagues and friends and there are many good articles online.

The destination of the backup will be backbaze B2. Also in this case, I’ve never used it but it seems very cheap and reliable.

I started following their installation guide that has a one-line command.

When I tried to run it (wget -qO - | bash) I got:

/usr/local/bin/autorestic.bz2: Permesso negato
bzip2: Can't open input file /usr/local/bin/autorestic.bz2: No such file or directory.
chmod: impossibile accedere a '/usr/local/bin/autorestic': File o directory non esistente
bash: riga 47: autorestic: comando non trovato
Successfully installed autorestic

I could not understand what was going on and I tried to replicate what the is doing:

bzip2 -fd autorestic_1.7.5_linux_arm64.bz2
./autorestic_1.7.5_linux_arm64 install

The last command failed:

os.Rename() failed (rename /tmp/autorestic-3881862718 /usr/local/bin/restic: permission denied), retrying with io.Copy()
Error: open /usr/local/bin/restic: permission denied
cannot lock before reading config location

and I had to run it with sudo:

sudo ./autorestic_1.7.5_linux_arm64 install
Successfully installed 'restic' under /usr/local/bin

I thought it was installed, but it seems it installed only restic. By having a better look at the, I missed one step: to move the autorestic binary into /usr/local/bin: sudo mv autorestic_1.7.5_linux_arm64 /usr/local/bin/autorestic.

By now I think I have everything installed, I created a .autorestic.yml and run: autorestic check -v

Using config paths: . /home/alcaprar autorestic
Using config: 	 /home/alcaprar/autorestic/.autorestic.yml
Using lock:	 /home/alcaprar/autorestic/.autorestic.lock.yml
> Executing: /usr/local/bin/restic check
Initializing backend "backblaze"...
> Executing: /usr/local/bin/restic init
Error: exit status 1

At this stage, I think I messed up with sudo before and I will try to install them into /home/USER/bin instead of /usr/local/bin. From your home:

bzip2 -fd autorestic_1.7.5_linux_arm64.bz2
chmod +x autorestic_1.7.5_linux_arm64.bz2
mv autorestic_1.7.5_linux_arm64.bz2 ./bin/autorestic
bzip2 -fd restic_0.15.0_linux_arm64.bz2
chmod +x restic_0.15.0_linux_arm64.bz2
mv restic_0.15.0_linux_arm64.bz2 ./bin/restic

At this point I re-tried autorestic check -v but I still got the same output :(. I then came across this comment on an issue that says that the backup command emits the output of the underlying restic command. And I tried it (autorestic backup -a -v), and discovered I had a typo in the config.

I quickly fixed it, then executed autorestic check -v which worked like a charm and then autorestic backup -a. It worked!!

For today that’s it. It was pretty simple to set it up (apart from some little problems). The next thing to do is to make it recurrent.