ChinoDuino(Chino × Arduino)

自発性のないプログラマーがArduinoと出会って悪戦苦闘する様を綴っていく⇒今はいろいろ(^^;

Greengrass試してみたよ(chino × Greengrass)

AWS Greengrassを試してみようと思い、以下開発者ガイドに沿ってやってみたときの備忘録

docs.aws.amazon.com

【目次】

環境

やってみた感想など

  • Raspberry Pi のセットアップのやり方も書いてあり驚き!
  • Amazon EC2 インスタンスのセットアップがあったが、用途が理解できていない【要復習!】
  • Greengrass Core ソフトウェアをRaspberry Piへインストールするところが手間取ってしまった
    • でもインストール完了できれば、AWSコンソールからデプロイなどでき、ほぼRaspberry Piを触ることがなくなりそう
  • Lambdaで書いたソースがRaspberry Piで実行できることに驚き!
  • AWS IoT デバイス SDKより、AWS Greengrass コア SDKの方が簡単にpublishできた

Greengrass BlackBeltオンラインセミナー

こちら、すごく勉強になります

  • 一部内容を抜粋
    • LambdaはGreengrass用のLambdaを使用する
      • このLambdaには、long-liveモードという実行し続けられるモードがある
      • Python3系は非対応(TT)

aws.amazon.com

はまったところなど

sqlite3のインストール時

モジュール 1: Greengrass の環境設定 - AWS Greengrass

上記ページの「8.これで、AWS Greengrass の Raspberry Pi を・・・」の部分

  • エラー
pi@chinopi:~/greengrass $ sudo apt-get install sqlite3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sqlite3 : Depends: libsqlite3-0 (= 3.7.13-1+deb7u4) but 3.8.7.1-1+deb8u2 is to be installed
E: Unable to correct problems, you have held broken packages.
pi@chinopi:~/greengrass $
  • 解決策
pi@chinopi:~/greengrass $ sudo apt-get install libsqlite3-0=3.7.13-1+deb7u4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libsqlite3-dev
The following packages will be DOWNGRADED:
  libsqlite3-0
0 upgraded, 0 newly installed, 1 downgraded, 1 to remove and 99 not upgraded.
Need to get 415 kB of archives.
After this operation, 1,403 kB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libsqlite3-0 armhf 3.7.13-1+deb7u4 [415 kB]
Fetched 415 kB in 5s (70.1 kB/s)      
(Reading database ... 187757 files and directories currently installed.)
Removing libsqlite3-dev:armhf (3.8.7.1-1+deb8u2) ...
dpkg: warning: downgrading libsqlite3-0:armhf from 3.8.7.1-1+deb8u2 to 3.7.13-1+deb7u4
(Reading database ... 187746 files and directories currently installed.)
Preparing to unpack .../libsqlite3-0_3.7.13-1+deb7u4_armhf.deb ...
Unpacking libsqlite3-0:armhf (3.7.13-1+deb7u4) over (3.8.7.1-1+deb8u2) ...
Setting up libsqlite3-0:armhf (3.7.13-1+deb7u4) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
pi@chinopi:~/greengrass $ 

バイスAWS Greengrass起動時

  • エラー
pi@chinopi:/greengrass/ggc/packages/1.5.0 $ sudo ./greengrassd start
Setting up greengrass daemon
Validating hardlink/softlink protection
Validating execution environment
Found cgroup subsystem: cpuset
Found cgroup subsystem: cpu
Found cgroup subsystem: cpuacct
Found cgroup subsystem: blkio
Found cgroup subsystem: devices
Found cgroup subsystem: freezer
Found cgroup subsystem: net_cls

Starting greengrass daemon
Greengrass daemon 3824 failed to start
[2018-04-14T11:02:57.600941406Z] Failed to invoke PutLogEvents on local Cloudwatch, logGroup: /GreengrassSystem/certmanager, error: RequestError: send request failed
caused by: Post http://localhost:8000/2016-11-01/cloudwatch/logs/: dial tcp 127.0.0.1:8000: getsockopt: connection refused, response: {

}
[2018-04-14T11:02:57.768114857Z] Failed to invoke PutLogEvents on local Cloudwatch, logGroup: /GreengrassSystem/syncmanager, error: RequestError: send request failed
caused by: Post http://localhost:8000/2016-11-01/cloudwatch/logs/: dial tcp 127.0.0.1:8000: getsockopt: connection refused, response: {

}
・・・・・・
  • 解決策

https://forums.aws.amazon.com/thread.jspa?threadID=264348

上記を参考に、デバイス側で以下コマンドを実行

$ sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel