How do I transfer the files from my Coral Dev Board to the SD card/ PC for training? - google-coral

I have connected my coral device to my Windows laptop running UBUNTU 20.04
1)When I try to " scp file.tar.gz #: /home/, I get an error stating
"ssh: connection to port 22: lost connection and sometimes refused connection".
I tried to put my Mendel boards IP and host username, then it asked me for my password but then denied permission.
2)Now I wanted to try it using the SD card. So I formatted the SD card in ext4 format and mounted it using " sudo mount /dev/mmcblk1 /mnt. And I can access contents of the SD card.
Now my question is- how do I transfer contents(files and pics) from SD to the Coral board and vice-versa?
I'd appreciate a detailed answer please. If you know the answer to query 1) please mention or if you know the answer to both pls try to help.
Thank you.

There are 2 ways to do this:
You can use mdt push or mdt pull to move file from and to the dev board.
Refer to this doc: https://coral.ai/docs/dev-board/mdt/#mdt-commands
mdt should already creates a public key o n your host machine in ~/.config/mdt/keys/mdt.key, you can try ssh/scp using that key
ssh -i ~/.config/mdt/keys/mdt.key mendel#ip-addr
If that doesn't works, you can also make your own key:
ssh-keygen
Then copy your public key on to the dev board's ~/.ssh/authorized_keys and everything should works as normal ssh :)
If you already mounted the sdcard, they it is as easy as copying or moving right?
cp /mnt/file-you-want /home/mendel/where-you-want

Related

Using Telnet Connection how to display and select the local file in Mac OS in Obj c

I am new to Mac OS development. Want to display the local file in mac machine using Telnet Connection, and also how to display the connected machine local file using obj c. Spend couple of days but no idea. kindly help me how to do this concept. Thanks advance.
To see local file executing telnet :
use the escape character (ctrl-] or other control depending on your keyboard country)
enter ! Followed by a ls command
you can enter any command that can be executed on the local machine after !
For the distant machine, it depends to which server application you connected (telnet, ftp, mail,…) :
Telnet is build to send/receive text between client (local host and server (distant host). With telnet you can connect to any port on the distant server. Sometimes you can interact, some other times you can’t.
Even seems simple, you can do a lot of thing with telnet connecting to a mail server and send mail from Santa Klaus .

I actually reset the MDT keys on my Coral Dev board but not it doesn't let me access the board

I get the following error when I use "mdt shell".
I have went through the documentation and all I want to know how I can access the board files? As the documentation tells me to remove the authorized keys from /home/mendel/.ssh/authorized-keys directory.
I have connected the serial port but I don't see anything when I try to Dmesg| grep but i get a sound like a device is connected to the PC. How can I access the coral files in order to delete the authorized files?
I'm using UBUNTU terminal on Windows.
'''
~$ mdt shell green-horse
Waiting for device green-horse...
Connecting to green-horse at 192.168.101.2
Key not present on green-horse -- pushing
Couldn't connect to keymaster on green-horse: [Errno 111] Connection refused.
Did you previously connect from a different machine? If so,
mdt-keymaster will not be running as it only accepts a single key.
You will need to either:
Remove the key from /home/mendel/.ssh/authorized_keys on the
device via the serial console
or -
Copy the mdt private key from your home directory on this host
in ~/.config/mdt/keys/mdt.key to the first machine and use
'mdt pushkey mdt.key' to add that key to the device's
authorized_keys file.
Failed to push via keymaster -- will attempt password login as a fallback.
Can't login using default credentials: Bad authentication type; allowed types: ['publickey']
'''
Did you insert the SD card on the first attempt to connect using mdt?
If so, remove it and try again.

Is there any way I can fix this problem with my coral dev board?

I was using coral board with my login credentials before but the SSH didn't seem to work so I removed the keys from the coral in order to generate new ones and now its not letting me in the board. I'm a noob at this, if you answer this please be specific. its for my college project. How do i change the accesskeys in the directory?
Waiting for a device...
Connecting to green-horse at 192.168.101.2
Key not present on green-horse -- pushing
Couldn't connect to keymaster on green-horse: [Errno 111] Connection refused.
Did you previously connect from a different machine? If so,
mdt-keymaster will not be running as it only accepts a single key.
You will need to either:
1) Remove the key from /home/mendel/.ssh/authorized_keys on the
device via the serial console
- or -
2) Copy the mdt private key from your home directory on this host
in ~/.config/mdt/keys/mdt.key to the first machine and use
'mdt pushkey mdt.key' to add that key to the device's
authorized_keys file.
Failed to push via keymaster -- will attempt password login as a fallback.
Can't login using default credentials: Bad authentication type; allowed types: ['publickey']
ssh should also works (it is what I use), but you'll need generate a key on your host machine and then put it in the ~/.ssh/authorized_keys on the board, there could be multiple keys placed in that file, and mdt needs to be one of them.
To recovers mdt access, you can check here: https://coral.ai/docs/dev-board/mdt/#recover-mdt-access
To ssh into the board, generate your own ssh key:
ssh-keygen
and your new key will be in ~/.ssh/id_rsa.pub, you can put that key on the board in order to ssh.

unable to connect google coral using OTG port

When I'm running google coral using serial port I'm able to run demo apps but when I'm trying to run
google coral using data port (type c cable) I'm unable to connect with a dev board
rahul#ubuntu:~$ mdt shell
Waiting for a device...
Connecting to wishful-yarn at 192.168.101.2
Key not present on wishful-yarn -- pushing
It looks like you're trying to connect to a device that isn't connected
to your workstation via USB and doesn't have the SSH key this MDT generated.
To connect with MDT shell you will need to first connect to your device
ONLY via USB.
The problem is caused by the PyPI package mendel-development-tool itself. This error is raised by the 'NonLocalDeviceError' exception as can be seen in line 83 of command.py in the code of the package. Whenever the IP of the device does not start with 192.168.100, this exception is raised by sshclient.py (in line 86). This worked for the last Release of Mendel Linux (chef), since the IP address of the usbnet connection was 192.168.100.2. In my case the new Release of Mendel (day), which came lately in November 2019 had the IP 192.168.101.2. To check the IP check the output of
mdt devices
If you installed the package using pip3 as user, like it is recommended by the documentation (pip3 install --user mendel-development-tool), this can be fixed by a quick local patch:
Open the file in your favourite text editor
vim $HOME/.local/lib/python3.6/site-packages/mdt/sshclient.py +86
Replace line 86, which is
if not self.address.startswith('192.168.100'):
raise NonLocalDeviceError()
by the following code
if not self.address.startswith('192.168.10'):
raise NonLocalDeviceError()
Most likely the authors might update the PyPI package to this solution, since the master branch of command.py already has the proposed code. Once the package has been updated you just have to update it on your host.
pip3 install --upgrade mendel-development-tool
The issue is google coral dev is connecting to WIFI also.
First you need to delete the wifi in google coral using nmtui --> edit connection --> delete.
Then connect your host computer to google coral dev board through USB C OTG data cable.
Through serial console to devboard, delete the contents of the /home/mendel/.ssh/authorized_keys
reset the mdt service in google coral devboard using mdt-keymaster
sudo service mdt-keymaster restart
Delete the mdt key in your host computer through rm ~/.config/mdt/keys/mdt.key
Correct the IP issue in NonLocalDeviceError as above
Then try mdt shell
if nothing working, reflash the coral board by using below procedure
Connect your dev board via serial cable and login [Ist terminal].
Once login hit sudo reboot-bootloader to put devboard in fastboot mode.
Open 2nd terminal and perform below steps to flash mendel linux
cd $HOME/Downloads
curl -O https://dl.google.com/coral/mendel/enterprise/mendel-enterprise-chef-13.zip
unzip mendel-enterprise-chef-13
cd mendel-enterprise-chef-13
bash flash.sh
Once Flashing the board complete shutdown google coral sudo shutdown now
Connect devboard again, then follow the previous steps 1-5 again.

scp files through gateway to remote machine

I can't figure out how to scp a file to another machine if there is a gateway connecting my client machine to the remote server. From my client machine I can connect to both the gateway and subsequently to the remote server using SSH without any problems.
When I try to scp my directory dir to the remote server I have no clue how to move past the gateway, because my ssh connection is actually an two-step approach. Scp'ing dir to the gateway first fails, with the remark "Permission denied".
Something like
~$: scp -r /var/www/dir usrname#remotesrv.com:/var/www/dircp
doesn't work and the only approach I found so far involves public/private keys. Is it only possible to copy files through a gateway with keys? And if that's so, can somebody tell me how to overcome the problem with copy&pasting into the terminal which sometimes just won't work (using Ubuntu 11.10). Already installed autokey hoping to circumvent buggy Ubuntu shortcuts by changing them to another hotkey, but the program is crashing all the time.
I would appreciate your help in one way or another!

Resources