Storjshare v2 (legacy) Linux Daemon Uninstall Guide

Hi v2 Node Operators,

With the official shutdown of Storjshare v2, it is finally time to remove the old software and data. I decided I wanted to clean things up as much as possible, so I found as much of the old installation instructions as I could and removed everything as a reverse of install. While I was at it I decided I would create this guide. I know there isn’t a big audience for this, but maybe it will help someone who has forgotten how this all started in the first place (like me!). Some of the steps aren’t 100% necessary, but I have done everything as per what I feel are best practices.

THIS GUIDE IS FOR v2 NODES ONLY. If you have no idea what a v2 node is, this guide is not for you. My node was running as a daemon (cli) on Debian, but most linux distros should be similar.

Step 1: Stop/remove node
First, if Storjshare is still running we want to remove the node and stop the daemon:

user@rock64:~$ storjshare status

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Node                                        β”‚ Status  β”‚ Uptime   β”‚ Restarts β”‚ Peers   β”‚ Allocs        β”‚ Delta   β”‚ Port     β”‚ Shared    β”‚ Bridges      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ c8fcf3f9cd5d6939ab4e1c0b77828c279397f1cc    β”‚ running β”‚ 56s      β”‚ 0        β”‚ 0       β”‚ 0             β”‚ 12ms    β”‚ ...      β”‚ ...       β”‚ disconnected β”‚
β”‚   β†’ /mnt/storj1/node1                       β”‚         β”‚          β”‚          β”‚         β”‚ 0 received    β”‚         β”‚          β”‚ (...%)    β”‚              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

To remove the node we will use the destroy option along with the node ID as shown. The node id can also be found in the config.json file (this may be called something else on your system, such as node.json):

user@rock64:~$ storjshare destroy -i c8fcf3f9cd5d6939ab4e1c0b77828c279397f1cc

  * share c8fcf3f9cd5d6939ab4e1c0b77828c279397f1cc destroyed

Now stop the daemon:

user@rock64:~$ storjshare killall

  * daemon has stopped

Step 2: Uninstall the Storjshare software
The Storjshare node software was originallty installed using npm. The package was installed globally, so we must use the -g flag to uninstall.

user@rock64:~$ npm uninstall -g --save storjshare-daemon
removed 357 packages in 21.429s

Step 3: Remove autostart cronjob
During installation we were instructed to create a watchdog script (see step 4) that would start the node at system start-up. An entry in the crontab was created to call this script at boot time. We should remove this entry in the crontab as it is no longer needed. Make sure not to change any other entries in the crontab.

user@rock64:~$ crontab -e

If you followed the original installation instructions, there should be the following entry in the crontab:

@reboot $HOME/watchdog.sh

Take note of the location of watchdog.sh, delete the entry, and save the file. It should output:

crontab: installing new crontab

Step 4: Delete the watchdog script
In my case the watchdog.sh script was located in the home directory. See the example below if you want to verify the contents prior to removal.

watchdog.sh example
#!/bin/bash
. $HOME/.bashrc
. $HOME/.profile
. $HOME/.env
APP=$(ps aux | grep -v grep | grep storjshare)
if [ -z "$APP" ];
then
echo "Restart storjshare-daemon"
storjshare daemon
fi
APP=$(ps aux | grep -v grep | grep 'farmer.js --config')
if [ -z "$APP" ];
then
echo "Restart farmers"
storjshare load
fi

Once you are satisfied you are deleting the correct file, it is safe to delete:

user@rock64:~$ rm watchdog.sh

Step 5: Delete the node storage folder and logs folder
The node storage directory contains the node data, but not the logs. If you can find the config.json file you used to create the node, this will tell you where you specified the storage folder and logs folder (or if you didn’t specify a logs folder, the default location). I don’t believe there was default location for the config.json file so this could have been placed anywhere. An excerpt from my config.json file:

  // Path to write the log file to disk, leave empty to default to:
  // $HOME/.config/storjshare/logs/[nodeid]_date.log
  "loggerOutputFile": "/mnt/storj1/node1logs",
  // Directory path to store contracts and shards
  "storagePath": "/mnt/storj1/node1",

IMPORTANT
Make sure you are deleting the correct folders when removing your v2 node data. Many of us ran v2 and v3 side-by-side. If you delete the wrong folders/files and nuke your v3 node, I take no responsibility.

For reference, the v2 top level directory should look something like this:

user@rock64:/mnt/storj1/node1$ ls -l
total 24
-rw-r--r--   1 user user  3248 Feb  1  2019 config.json
drwxr-xr-x   2 user user  4096 Feb  6 11:01 contracts.db
drwxr-xr-x 258 user user 12288 Aug  7  2017 sharddata.kfs
drwxr-xr-x   2 user user  4096 Feb  6 11:01 tokens.db

Once you delete the data folder and the logs folder, all of remnants of v2 should be gone from the system.

Additional Clean-up
Don’t forget to remove the port mapping in your firewall(s). The default port was 4000. If you no longer have a use for npm, you could remove this as well. If you are unsure, it won’t hurt to leave npm installed.



P.S. If the mods feel this should be placed somewhere else on the forum, please feel free to move it. I originally placed it in Uncategorized to avoid confusion for SNOs running v3.
4 Likes