Linux Update Guide -Advanced

This guide will help DIY Linux users to update spd to a new version. It is written based on upgrading from 1.6.0 to 1.6.2 but the steps should still be relevant for future software updates too. Certain assumptions have been made in this guide so some step may need tweaking to your exact setup. The main assumption is that you are reasonably proficient in Linux and have already setup your provider up using a startup script and symlink to the ‘current’ ScPrime folder.
The first step is to understand where you currently have spd installed to. In this guide, we have spd installed in /home/scprime/ScPrime/ScPrime-v1.6.0-linux-amd64, ‘scprime’ is our Linux user and we have already created a symlink to the 1.6.0 folder using ‘current’.
Next download the update file from here, above we are downloading 1.6.2 using the following command:
Once the file is downloaded, extract it to the ScPrime folder using the following:
Now we have both the 1.6.0 install folder and the 1.6.2 install folder.
The next thing we want to check while spd is still running is where is our metadata folder. This step is vital as it’s where most problems occur. To see how spd is currently running, run the following command:
ps -ef | grep spd
This will show you something like this:
From this we can see that spd is running using the ‘scprime’ user account, is using non-default ports 44282, 44283 and 44285 and the metadata folder is in /home/scprime/.scprime. Note this is the default location Linux will use if you started it without the -d flag, /home/<USER>/.scprime and this folder is hidden in Linux. Also note we are using the -M gctwh flag which basically tells spd to load up the gateway, consensus, transaction pool, wallet and host modules but most importantly, not the renter module. The renter module is only used for storing data on the network and not required when setting up a provider.
The most important part of the update is to ensure we start spd using the same metadata location as with the previous version, otherwise you are creating a new provider and risk losing any stored data from before.
Now that we know where our metadata is located, check the output of:
./spc host -v
To ensure the provider is showing ‘Host appears to be working’ as the Connectability Status. You can also see the current version is 1.6.0 below. It’s also working taking a note of the Provider ID here, this can help identify if after update you’ve created a new provider or not:
Next we will stop spd using the following command:
./spc stop
Then we’ll change the symlink to point at the new 1.6.2 folder (obviously for future releases this will need to point at the new folder). Note we need to change directory to one level up from where we were back to the /home/scprime/ScPrime folder:
ln -vnfs ScPrime-v1.6.2-linux-amd64/ current
Now we can see the ‘current’ folder points at the 1.6.2 folder. This helps in that various scripts etc. don’t need updating as they are already pointing at the ‘current’ folder.
Another important step to take at this point is to backup your metadata folder. This should be something you’re doing on a daily basis anyway but it’s good practice as part of an update just in case. Where you backup to is up to you, could copy off the provider to an FTP server on your home network for example. In this example we’re going to copy to a USB drive we have plugged in. We are just going to copy the whole ~/.scprime folder to our USB Backup location using the following command:
cp -r ~/.scprime/* /mnt/USB_Backup/metadata_backup/
Check and make sure you see all the files and folders above in the backup location.
Now we are ready to start up spd with the new version. If you have configured the auto startup script as per the Linux Setup guide here, then the easiest way to start up spd is to simply reboot. Alternatively manually startup spd using the exact same command we noted earlier in the ‘ps -ef | grep spd’ output (there’s an exception to this if running non-default ports and only for upgrading to 1.6.2 discussed later).
Once spd is running again, we can go in to the ScPrime/current folder and run ‘./spc host -v’ to check the host appears online, our Provider ID is the same as before the update and that we’re now running the new version, 1.6.2 in the case below.
At this point, give it 30 mins or so and then check on Grafana that your host is online.

Running on Non-Default Ports

Specifically for the update to 1.6.2, this version now only requires 2 ports to be forwarded and by default these are 4282 and 4283 for the host-addr and host-api-addr ports. If you were running on non-default ports before as we were in the outputs here, we were running spd using the following command:
spd --host-addr :44282 –siamux-addr :44283 --host-api-addr :44285 -d <METADATA> -M gctwh
Now the siamux-addr port is not required and the host-api-addr port should move to the port one higher than the host-addr. So using our example above, we need to change this to:
spd --host-addr :44282 --host-api-addr :44283 -d <METADATA> -M gctwh
If using an autostart script then it will need changing in that script prior to reloading the host to start up the new version as below:
created 5/31/22 v1.0