Clone a bootable RPI SD

I have used PI Copier to clone a bootable image of my RPI SD with Blynk Server all set up. Now the original SD I copied and the 2nd new SD I placed the the image on using PI Filler are both giving me errors when trying to start Blynk Server.

Starting Blynk Server:
pi@raspi:~/blynk-library/linux $ $ java -jar server-0.21.1.jar -dataFolder /home/pi/Blynk -bash: $: command not found

Connecting to Blynk Server:
pi@raspi:~/blynk-library/linux $ sudo ./blynk --server=192.168.1.138 --token=xxxxxxxxxxxx sudo: ./blynk: command not found

Everything seems to work correctly except the clone process has broken Blynk Server somewhere.

Based on the error[quote=“Shane_Pennington, post:1, topic:10815”]
command not found
[/quote]

I would suspect something changed (or was corrupted) in your directory and/or file structure during the cloning.

I don’t think the cloning has failed, your commands look to be wrong try:

java -jar server-0.21.1.jar -dataFolder /home/pi/Blynk

and

 sudo ~/blynk-library/linux/./blynk --server=192.168.1.138 --token=xxxxxxxxxxxx

the first command might need a path before the java command but try it as it is for now.
I always use DiskImager but I guess Pi Copier does the same thing.

Both are wrong commands. the $ in the first has to go and for the second one I think you are missing the “.sh” extension. Use TAB to finish commands/filenames in Linux. It saves you a lot of headaches :slight_smile:

even though the .sh suffix is expected I don’t believe it is required.

I apologize, should have looked the commands over better when I copied and pasted. My terminal window was narrow and it placed the $ where the page break was. It looks as if the server is running now

`pi        1305  0.5  5.5 327728 52768 pts/0    Sl   Jan13  14:52 java -jar /home/pi/server-0.21.6.jar -dataFolder /home/pi/Blynk`

I am still getting this when trying to connect to server.

`pi@raspi:~ $ sudo ~/blynk-library/linux/./blynk --server=192.168.1.138 --token=xxxxxxxxxxxxxxxxxx

sudo: /home/pi/blynk-library/linux/./blynk: command not found`

is not the correct path and command then.

as the pi user (not root) go to the blynk-library directory and see if you have a program called blynk (coloured green) when you do:

ls

It was before the clone attempt. Even when I call the script you helped me set up ./blynksetup it gives me an error.

I tested and tested and everything worked flawlessly before the clone.

`pi@raspi:~/blynk-library $ ls

examples keywords.txt library.properties linux README.md src
extras library.json LICENSE Makefile scripts tests`

`pi@raspi:~/blynk-library/linux $ ls

BlynkApiLinux.h BlynkDebug.cpp BlynkSocket.h Makefile
BlynkApiWiringPi.h BlynkOptionsParser.h build.sh README.md`

Nowhere to be found…

I assume you are using a MAC and that is why you are using Pi Copier rather than DisKImager, right?

Correct. I do have a PC also. I will give DI a try when I get this fixed. You have any recommendation on the quickest way to remedy this problem? Think a reinstall would do the trick without breaking something else?

You either cloned and restored the wrong images or you built the Blynk executable in a none standard location. Any idea which?

All you need to do is build the Blynk executable again.

blynk was located in linux dir I know that… unless I’m completely missing something.

Doesn’t this line below tell us exactly where it was located? It worked great before the clone/copy attempt.
sudo ~/blynk-library/linux/./blynk --server=xxx.xxx.xxx.xxx --token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

As far as the clone process…
I took the original working sd out of pi created a non compressed image with pi copier. Once complete reinserted the original sd into pi and it was broken.
The reason for a non compressed image is because pi filler requests you to select a non compressed image.

Then just out of curiosity went ahead an inserted a new blank sd into mac. With pi filler, I used that image I created with the orginal sd. When complete tried to boot with pi and I get the exact same thing… broken.

Yes the executable was in the linux directory if this command was working originally.

Have you reinstalled the Blynk server since your system failed or are you saying the server copied ok but not the executable? Very unlikely that only part of the image was recovered, generally all or nothing.

Yes Blynk Server is running but exe is gone.

This confirms server is up right?
pi 5420 0.9 5.5 327728 52832 pts/0 Sl 07:06 0:41 java -jar /home/pi/server-0.21.6.jar -dataFolder /home/pi/Blynk

I did find Blynk in home dir and used “ls”
pi@raspi:~/Blynk $ ls backup data deleted sp@xxxxxxxxxxxx.com.Blynk.user

What does that mean?

Yes

That is just the file structures used by Blynk

Try rebuilding the executable as the full instructions.

Not finding a way to rebuild exe in doc except preforming the steps below, which I’m sure that is not what your talking about.

How to launch Blynk Server on Raspberry Pi

Login to Raspberry Pi via ssh;
Install Java 8:
 sudo apt-get install oracle-java8-jdk
Check if you are using Java 8:
 java -version
 Output: java version "1.8.0_40"
Download Blynk server .jar file (or manually copy it to raspberry via ssh and scp command):
 wget "https://github.com/blynkkk/blynk-server/releases/download/v0.21.5/server-0.21.7.jar"
Run the server on default hardware port 8442 and default application port 8443 (SSL port)
 java -jar server-0.21.7.jar -dataFolder /home/pi/Blynk

No that is for installing the server.

It starts with WiringPi to make the Pi pins available to Blynk etc.

Let me know if you can’t find it but you must have done it once.

Ok I see. I think you are talking about this…
~/blynk-library/linux $ ./build.sh raspberry

From memory there is much more than that relating to Wiring Pi etc but it’s not something I have done for a long time.

In your opinion is using an Arduino or ESP more dependable and much simpler for IOT projects? If so im going to stop fighting with this RPI and use an Arduino or ESP.