How to use the crypto processor on the dev board? - google-coral

On the data sheet, the SoM comes with an ATECC608A crypographic coprocessor, but there are no documentations on how to use it. Are there some usecase for this HW and any instructions on how to use it?

This library is included in the coral-cloud repo. It is generally installed with the Coral cloudiot package (python3-coral-cloudiot) but could also directly installed with python3-cryptoauthlib.
echo "deb https://packages.cloud.google.com/apt coral-cloud-stable main" | sudo tee /etc/apt/sources.list.d/coral-cloud.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt update
sudo apt install python3-coral-cloudiot
The sdk can be found here: https://github.com/MicrochipTech/cryptoauthlib

The internal ECC608 seems to be connected to the internal i2c (I2C1). The external i2c busses are I2C2 and I2C3.
If adapted to bus I2C1 (bus 0), the example code finds an ECC608 at address 0x60 on my device and I can read out the serial number of the chip.
Although - the ECC608 has many configuration and key-storage options. If haven't found any documentation on the internal use of the chip yet.

Related

Docker rootless mode setup tool script can't find slirp4netns binary

I am trying to set up Docker rootless mode on Ubuntu 18.04, using the dockerd-rootless-setuptool.sh script. But I'm struggling to get the script to find the slirp4netns binary I downloaded (slirp4netns provides user-mode networking for unprivileged network namespaces). On Ubuntu 20 this is installable as a package using apt, but for lower Ubuntu versions a pre-built binary is provided here.
I am running the script (as non-root) with:
dockerd-rootless-setuptool.sh install
But it complains:
Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed
I have downloaded the latest stable binary for slirp4netns (v1.1.12) as per the instructions:
curl -o slirp4netns --fail -L https://github.com/rootless-containers/slirp4netns/releases/download/v1.1.12/slirp4netns-$(uname -m)
chmod +x slirp4netns
I moved the binary (as root) to /usr/local/lib. What am I doing wrong? Do I need to update an environment variable? I don't really want to upgrade my entire OS just to get a single library.
Thanks.
It was my own stupidity. As the person says in the comment to my question, all I needed to do was to move the binary to /usr/local/bin. I had assumed /usr/local/lib was on PATH, but it wasn't.

How do I solve "Hash Sum Mismatch" on "apt-get install docker-ce"?

I hope you're all well!
This is my first question ever on stack overflow, so if i'm missing anything, just tell me and it'll be my pleasure to update my question.
So, to summarize my problem, I am trying to install Docker-ce on an Ubuntu 18.04 VM by following the official steps at Docker-Engine Installation and I am getting the error "Hash Sum Mismatch" when running the command "sudo apt-get install docker-ce docker-ce-cli containerd.io".
I went through the official steps a few times and I've tried the following things so far :
1) The following commands, followed by the official installation steps
apt-get clean
rm -rf /var/lib/apt/lists/*
apt-get clean
apt-get update
apt-get upgrade
2) Creation of a file with the following lines, placed at "/etc/apt/apt.conf.d/99fixbadproxy", followed by the official installation steps
Acquire::http::Pipeline-Depth 0;
Acquire::http::No-Cache true;
Acquire::BrokenProxy true;
3) Installation of other versions of docker-ce with the following commands
sudo apt-get install docker-ce 5:19.03.8~3-0~ubuntu-bionic
sudo apt-get install docker-ce 5:19.03.6~3-0~ubuntu-bionic
sudo apt-get install docker-ce 5:18.09.9~3-0~ubuntu-bionic
4) I tried installing different repositories (i think they're called repositories) by adding "nightly" or "test" or both after the word "stable" of the following command
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
And I think that is pretty much it. I did tried other things but unfortunately i don't remember them because I've been working on this issue for quite some time now.
I did not try on a fresh new installation of Ubuntu 18.04 though.
If I'm missing anything in my question, please let me know!
Take care everybody!
EXPLANATION and Solution: Quick Fix
This issue is caused by the Windows Hypervisor Platform. This issue cannot be resolved for now (asfar as I know).
A partial fix is at hand though. And I say"partial" because it involves disabling the platform (also known as"Hyper-V") which will probably break other virtualization solutions you have installed since this is enabled manually. Anyway, here's how to disable it and get your VM running again,
Shut down the Virtual Machine.
Press Windows logo key + X, then hit A to run Command Prompt(powershell) as administrator.
Type
bcdedit /set hypervisorlaunchtype off
When you see"The operation completed succesfully", reboot your windows. After reboot, boot your VM and update/upgrade.
For anyone still having issues with this, I managed to get it working by disabling HyperV (as most people have already suggested). However, on my setup, disabling HyperV using the mentioned approaches didnt actually disable HyperV since my windows machine used HyperV for both CredentialGuard and Secure Boot, both of which needed to be disabled before HyperV was actually fully disabled
If running systeminfo.exe in an elevated terminal shows A hypervisor has been detected. Features required for Hyper-V will not be displayed, then HyperV is not fully disabled. Disabling credential guard and secure boot coupled with a few restarts (after running all the commands to disable HyperV that have already been mentioned) solved all issues for me.
Just for reference, if HyperV is fully disabled, you should see
Hyper-V Requirements: VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes
when running systeminfo.exe

Google Coral serial number

I need a unique identifier of my device and on Raspberry PI I could get a serial number of the cpu from the /proc/cpuinfo file. But on Coral there is no serial information in /proc/cpuinfo.
Are there any other ways to uniquely identify my device? What about /etc/machine-id?
Following Florian's answer here, using the ATECC608A serial is an option as NXP's serial on the SOC is hard to access.
The coral's cloudiot package has a wrapper around cryptoauthlib sdk to get the serial number.
Install coral's cloudiot:
echo "deb https://packages.cloud.google.com/apt coral-cloud-stable main" | sudo tee /etc/apt/sources.list.d/coral-cloud.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt update
sudo apt install python3-coral-cloudiot
Get Serial Number:
python3 -c 'from coral.cloudiot.ecc608 import ecc608_serial; print("ATECC608A Serial:", ecc608_serial())'
Reply from Google support
NXP SoC has a unique serial number which could be read from sw.
It is suggested to check IMX8M reference manual for that information.
That approach will require you to add/modify kernel driver to expose that SN via sysfs node.
There is another option of getting an ID from the board. The SoM of the Coral Dev Board also features a built-in cryptochip which offers a unique ID you can use. There was a discussion together with some python code on how to use it here:
How to use the crypto processor on the dev board?
I havent tried yet, if the serial number of the ecc608 can also be accessed by file system means. The ecc608 is available on the 0th I2C bus of the system.

Google Assistant service for Raspberry Pi zero - Illegal Instruction

Installation on Pi zero.
The installation was successful, but when I tried sample code
googlesamples-assistant-hotword --project_id my-dev-project --device_model_id my-model
It returns Illegal Instruction.
The pushtotalk sample didn't work neither.
Appreciate the help.
I finally got the assistant to work on Pi 0 with pushtotalk sample by installing python -m pip install --upgrade --no-binary :all: grpcio before the SDK installation.
However, the assistant will either take forever to give me NO response or not able to finish the response, in either situation, I'll have to close the terminal to end the session. I've opened an issue in github, and it seems like an incompatibility error in the gRPC package. https://github.com/googlesamples/assistant-sdk-python/issues/267
The hotword sample uses the Google Assistant Library, which is not available on the Raspberry Pi Zero.
try run again
python -m pip install --upgrade google-assistant-library
python -m pip install --upgrade google-assistant-sdk[samples]
Been having the same problem with raspberry pi 1. Only solution I could find so far is to use the pushtotalk and have echo automatically input newline using this.
googlesamples-assistant-pushtotalk --project-id gassist-d4d83 --device-model-id gassist-d4d83-rpi-meicej|echo -n
That does the job for me. Don't know if it helps anyone.
Edit: Only part that's bad is, it's always listening. Maybe I can modify the code.

DWA-131 driver fail using beaglebone as wi-fi hostspot

I'm trying to create a wi-fi hostspot using a beaglebone black rev-C and DWA-131 nano wi-if adapter.
I followed this article to install the driver:
http://www.linux-hardware-guide.com/2013-11-16-d-link-dwa-131-n300-usb-wifi-adapter
And this project do setup the hostapd: https://github.com/jekader/hostapd-rtl
But when I try to start I'm getting the following error:
Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=4
l2_packet_init: ioctl[SIOCGIFINDEX]: No such device
no br0 interface , let l2_sock_recv==l2_sock_xmit=0x0x51648
ioctl[SIOCSIWMODE]: Operation not supported
Could not set interface to mode(3)!
Could not set interface to master mode!
rtl871xdrv driver initialization failed.
rmdir[ctrl_interface]: No such file or directory
My hostapd.conf is:
interface=usb0
driver=rtl871xdrv
bridge=br0
ssid=NETWORK-NAME
channel=1
wmm_enabled=0
wpa=1
wpa_passphrase=NETWORK-PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
Hostapt version? Driver's name or config?
ps: I'm not confortable because my network interface for the wi-fi is usb0 instead of wlan0. Is a driver issue?
I had same compilation issues. Following is working very well, you get the source directly from git.
sudo apt-get install git build-essential
git clone https://github.com/Mange/rtl8192eu-linux-driver.git
cd rtl8192eu-linux-driver
make
sudo make install

Resources