Possible bug in configuration Backup/Restore

General support for the Pi-Star System
Post Reply
N6VL
Posts: 22
Joined: Mon Sep 10, 2018 3:52 am

Possible bug in configuration Backup/Restore

Post by N6VL »

I've been able consistently reproduce a problem with Backup/Restore. I've have a configuration for DMR2YSF saved to a zip file. Both DMR and DMR2YSF are enabled. I first do a factory reset followed by restoring from the zip file. In every instance the DMR2YSF mode is NOT enabled. Apparently the DMR2YSF mode is ignored in the restore process. I have to manually enable it afterwards.

Unsure if this is by design or an oversight?
KN2TOD
Posts: 335
Joined: Sun Nov 11, 2018 6:36 pm

Re: Possible bug in configuration Backup/Restore

Post by KN2TOD »

This is a bug. Neither of the DMR2 modes (DMR2YSF, DMR2NXDN) are saved in the config zip file. If these files are included in the zip, then they will restore as expected. That is to say, the bug is in the save process and not the restore process.

You can manually correct for this in the saved configuration:

Assuming you've invoked the save configuration process from the dashboard, a copy of the zip file is left in the /tmp directory; you can manually add these two file to that copy and then download the revised config from that directory:

Code: Select all

rpi-rw
cd /tmp
sudo zip /tmp/config_backup.zip /etc/dmr2*
You can also simply download these two files from the /etc directory and add them to a previously saved config file so that future restores will work as expected.
N6VL
Posts: 22
Joined: Mon Sep 10, 2018 3:52 am

Re: Possible bug in configuration Backup/Restore

Post by N6VL »

It "almost works"! The problem is that the two new files are added to the zip inside a /etc folder which does NOT work on restore. I create a new zip on my PC with those files in the zip / folder which DOES works. I don't know the Linux zip utility very well. I'm sure it's a simple command line tweak.
KN2TOD
Posts: 335
Joined: Sun Nov 11, 2018 6:36 pm

Re: Possible bug in configuration Backup/Restore

Post by KN2TOD »

My bad! Forgot an option:

Code: Select all

rpi-rw
cd /tmp
sudo zip -j /tmp/config_backup.zip /etc/dmr2*
Thanks for testing for me!!! :P
N6VL
Posts: 22
Joined: Mon Sep 10, 2018 3:52 am

Re: Possible bug in configuration Backup/Restore

Post by N6VL »

The other problem is getting the zip file off the Pi. I used a USB thumb drive. Formatted it FAT32 and had to mount it, copy zip file, and then unmount it. There has to be an easier way.

I have a Pi 4 running as a dedicated network drive, but don't want to do the same in a pistar. So far the USB drive is my only solution. I don't want to install samba or anything else if possible. Can I transfer the file through ssh? I want a mechanism easily setup on all my Pi based hotspots.
KN2TOD
Posts: 335
Joined: Sun Nov 11, 2018 6:36 pm

Re: Possible bug in configuration Backup/Restore

Post by KN2TOD »

You have two options here: a) modify the Pi-Star code so the necessary files are included in the backups, b) install an SSH or FTP of your choice to access Pi-Star's underlying file structure.
---
First, you can modify the backup process as follows:

Code: Select all

rpi-rw
cd /var/www/dashboard/admin
if [ ! "$(grep 'dmr2nxdn' config_backup.php)" ]; then
sudo sed -i 's/dmrgateway $backupDir 2>\&1");/dmrgateway $backupDir 2>\&1");\
\t  $output \.= shell_exec("sudo cp \/etc\/dmr2nxdn $backupDir 2>\&1");\
\t  $output \.= shell_exec("sudo cp \/etc\/dmr2ysf  $backupDir 2>\&1");/g' config_backup.php
fi
Note that this is a temporary fix insomuch as it will get unwound IF any Pi-Star updates are applied to the dashboard code portion of the system. (Unlikely at the moment, since there haven't been much if any fixes applied for a while now - maybe, some day, this fix can get applied so everyone can benefit. And, yes, this code has been tested as I have applied it numerous times on several of my own systems! ;) )

---
Secondly, you can search out an appropriate Windows- or Linux-based SSH or FTP client and set them up to access your Pi-Star system and the specific directories and files needed for any given situation.

For SSH, I would recommend MobaXterm or Termius, although there are several others that are also adequate; I'm partial to Termius and do most of my command line work via that app, but not usually (bulk) file transfers.

For regular file transfers, especially across multiple systems, especially for binary/zip files, I prefer FTP: the best, IMHO, is a program called WinSCP (euphemistically called "Win Scuppy"). Try it! I think you'll like it!!

Either way, SSH or FTP, watch out for the RO/RW status of your Pi-Star system; also permissions can be a pain sometimes.
N6VL
Posts: 22
Joined: Mon Sep 10, 2018 3:52 am

Re: Possible bug in configuration Backup/Restore

Post by N6VL »

I've been able to run your fix without any obvious issues. Using it on a second hotspot. I have three.

My SSH client is Windows Terminal. Yes I run Windows 11, because Windows 10 has another year to live. In a perfect world all my software would run in Linux. I've had good luck running Linux hosts (pi-star included) in Windows Terminal. It's free but not installed in Windows by default.

I used scp to copy from pi-star to Windows. It's run in PowerShell under Windows Terminal. For example:

Code: Select all

scp pi-star@pi-star0:/tmp/config_fix.zip .
But I no longer need to copy the zip file with your config_backup.php fix.
Post Reply