いよいよ今週土曜日3年ぶりリアルでみんなに会える、みんなのサマーセミナー2022は尼崎市立尼崎高等学校で開催
私の授業は8月6日4階2G教室10時から「メイドカデン!?でええやん!」で講演します
授業内容は実践IOTハウス紹介とDockerでIOTハウスのデモ予定
絶賛生徒募集中です!

いよいよ今週土曜日3年ぶりリアルでみんなに会える、みんなのサマーセミナー2022は尼崎市立尼崎高等学校で開催
私の授業は8月6日4階2G教室10時から「メイドカデン!?でええやん!」で講演します
授業内容は実践IOTハウス紹介とDockerでIOTハウスのデモ予定
絶賛生徒募集中です!
IOT-Houseに使用しているgmailにこんなメッセージが「5月30 日より、安全性の低いログイン技術を使用するアプリにアクセスできなくなる可能性があります」
ちなみに/var/log/exim4/mainlogにはこんなログが
022-06-09 MM:SS ... login authenticator failed H=smtp.gmail.com [xxx.xxx.xxx.xxx] 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials o...... - gsmtp
メールが届いてから対処方法が分からず放置していたけど、ここに有効な情報が
https://tarufu.info/google-app-password/ 感謝!
要約するとGoogleの2段階認証の有効化とアプリパスワードを取得してgmailのプレーンパスワードの代わりに設定すれば良いとの事
http://pepolinux.osdn.jp/ #gmail設定
IOT-Houseでは2020年4月からhomebridge-alexaを無償でメイドカデンとして有難く便利に使わせて頂いてたが今後有償化となる
我が家は2022年4月末からトライアル、5月末から有償化、便利で手放せないのでSubscriptionsを敢行
詳しくは
ログ「4165665 May 6 18:05 auth.log.1」のように「***.1」に溜まり続ける
/var/logはtmpfsなので一杯になってもログが取れないだけやけど、気持ち悪い
logrotateをデバックモードで
# logrotate -d /etc/logrotate.conf 2>log
# less log
considering log /var/log/auth.log -->size 0
Now: 2022-05-06 18:06
Last rotated at 2022-05-01 00:00
log does not need rotating (log size is below the 'size' threshold)・・・ログをローテーションする必要はありません(ログサイズが「サイズ」のしきい値を下回っています)・・・ちなみsize 10kで設定
root@iot002:/www/remote-hand/tmp# ll /var/log/
total 6992
drwxrwxr-x 10 root root 700 May 5 00:00 ./
drwxr-xr-x 10 root root 4096 Jan 6 15:17 ../
-rw-r--r-- 1 root root 0 Oct 23 2017 alternatives.log
drwxr-xr-x 2 root root 200 May 6 00:00 apache2/
drwxr-xr-x 2 root root 80 Oct 23 2017 apt/
-rw-r----- 1 root adm 0 May 1 00:00 auth.log
-rw-r----- 1 root adm 4165665 May 6 18:05 auth.log.1
-rw-r--r-- 1 root root 0 Oct 23 2017 bootstrap.log
・
-rw-r----- 1 root adm 0 May 1 00:00 syslog
-rw-r----- 1 root adm 2665858 May 6 18:05 syslog.1
logrotateを強制
# logrotate -f /etc/logrotate.conf
-rw-r--r-- 1 root root 0 Oct 23 2017 alternatives.log
drwxr-xr-x 2 root root 200 May 6 18:12 apache2/
drwxr-xr-x 2 root root 80 Oct 23 2017 apt/
-rw-r----- 1 root adm 12385 May 6 18:35 auth.log
-rw-r----- 1 root adm 4168962 May 6 18:12 auth.log.1
-rw-r--r-- 1 root root 0 Oct 23 2017 bootstrap.log
-rw-rw---- 1 root utmp 0 May 6 18:12 btmp
-rw-rw---- 1 root utmp 1152 May 1 11:47 btmp.1
-rw-r----- 1 root adm 1194 May 6 18:33 daemon.log
-rw-r----- 1 root adm 137 May 6 18:12 daemon.log.1
drw
・
rw-r----- 1 root adm 8583 May 6 18:35 syslog
-rw-r----- 1 root adm 286 May 6 18:12 syslog.1
-rw-r----- 1 _apt adm 0 Oct 23 2017 ufw.log
-
これでいけるか
やっぱり、CP2112が落ちる
でも4/29にリカバーリ処理を追加したのでBME680センサーデータの欠損が無くなった
May 3 16:11:54 iot01f kernel: [6163514.412185] usb usb2-port1: disabled by hub
(EMI?), re-enabling...
May 3 16:11:54 iot01f kernel: [6163514.412208] usb 2-1: USB disconnect, device
number 31
May 3 16:11:54 iot01f kernel: [6163514.688051] usb 2-1: new full-speed USB devi
ce number 32 using uhci_hcd
May 3 16:11:55 iot01f kernel: [6163514.867329] usb 2-1: New USB device found, i
dVendor=10c4, idProduct=ea90
May 3 16:11:55 iot01f kernel: [6163514.867336] usb 2-1: New USB device strings:
Mfr=1, Product=2, SerialNumber=3
May 3 16:11:55 iot01f kernel: [6163514.867339] usb 2-1: Product: CP2112 HID USB
-to-SMBus Bridge
May 3 16:11:55 iot01f kernel: [6163514.867342] usb 2-1: Manufacturer: Silicon L
aboratories
May 3 16:11:55 iot01f kernel: [6163514.867345] usb 2-1: SerialNumber: 0057FBBE
May 3 16:11:55 iot01f kernel: [6163514.883982] cp2112 0003:10C4:EA90.0019: hidr
aw0: USB HID v1.01 Device [Silicon Laboratories CP2112 HID USB-to-SMBus Bridge]
on usb-0000:00:1d.0-1/input0
May 3 16:11:55 iot01f kernel: [6163514.940337] cp2112 0003:10C4:EA90.0019: Part
Number: 0x0C Device Version: 0x02
May 3 16:11:56 iot01f upowerd[22466]: unhandled action 'unbind' on /sys/devices
/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/0003:10C4:EA90.0018
May 3 16:11:56 iot01f upowerd[22466]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0
May 3 16:11:56 iot01f upowerd[22466]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1
May 3 16:11:56 iot01f mtp-probe: checking bus 2, device 32: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1"
May 3 16:11:56 iot01f mtp-probe: bus: 2, device: 32 was not an MTP device
May 3 16:11:56 iot01f upowerd[22466]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/0003:10C4:EA90.0019
May 3 16:11:56 iot01f upowerd[22466]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0
May 3 16:11:56 iot01f upowerd[22466]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1
あかんなーIOTハウスメインマシンのCP2112が落ちる2度目や、一日前からBME680センサーからデータを拾えてない
セマフォを確認
# ipcs -t
------ メッセージキュー 送信/受信/変更回数 --------
msqid 所有者 送信 受信 変更
------ 共有メモリ 結合/分離/変更日時 --------
shmid 所有者 結合 分離 変更
12517376 lightdm Apr 3 16:46:30 Apr 3 16:46:30 Apr 3 16:46:29
12550145 lightdm Apr 3 16:46:32 未セット Apr 3 16:46:32
------ セマフォ 命令/変更回数 --------
semid 所有者 最終操作 最終変更
6848512 root Thu Apr 28 17:41:00 2022 Wed Apr 27 18:27:47 2022
6127617 www-data Thu Apr 28 17:40:55 2022 Wed Apr 6 16:07:14 2022
ログをWed Apr 27 18:27:47で検索するとUSBポートが切られ2秒後再接続されている
その後からBME680センサーからデータ拾えず、pepocp2112ctldデーモンを再起度すれば治るけど、どげんとせにゃならん
# less /var/log/syslog.1
Apr 27 18:27:47 iot01f kernel: [5653267.060291] usb usb2-port1: disabled by hub (EMI?), re-enabling...
Apr 27 18:27:47 iot01f kernel: [5653267.060308] usb 2-1: USB disconnect, device number 30
Apr 27 18:27:47 iot01f kernel: [5653267.332058] usb 2-1: new full-speed USB device number 31 using uhci_hcd
Apr 27 18:27:47 iot01f kernel: [5653267.520076] usb 2-1: New USB device found, idVendor=10c4, idProduct=ea90
Apr 27 18:27:47 iot01f kernel: [5653267.520083] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 27 18:27:47 iot01f kernel: [5653267.520086] usb 2-1: Product: CP2112 HID USB-to-SMBus Bridge
Apr 27 18:27:47 iot01f kernel: [5653267.520089] usb 2-1: Manufacturer: Silicon Laboratories
Apr 27 18:27:47 iot01f kernel: [5653267.520092] usb 2-1: SerialNumber: 0057FBBE
Apr 27 18:27:47 iot01f kernel: [5653267.539921] cp2112 0003:10C4:EA90.0018: hidraw0: USB HID v1.01 Device [Silicon Laboratories CP2112 HID USB-to-SMBus Bridge] on usb-0000:00:1d.0-1/input0
Apr 27 18:27:47 iot01f kernel: [5653267.598045] cp2112 0003:10C4:EA90.0018: Part Number: 0x0C Device Version: 0x02
Apr 27 18:27:49 iot01f upowerd[22466]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/0003:10C4:EA90.0017
Apr 27 18:27:49 iot01f upowerd[22466]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0
Apr 27 18:27:49 iot01f upowerd[22466]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1
Apr 27 18:27:49 iot01f mtp-probe: checking bus 2, device 31: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1"
Apr 27 18:27:49 iot01f mtp-probe: bus: 2, device: 31 was not an MTP device
Apr 27 18:27:49 iot01f mtp-probe: checking bus 2, device 31: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1"
Apr 27 18:27:49 iot01f mtp-probe: bus: 2, device: 31 was not an MTP device
Apr 27 18:27:49 iot01f upowerd[22466]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/0003:10C4:EA90.0018
Apr 27 18:27:49 iot01f upowerd[22466]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0
Apr 27 18:27:49 iot01f upowerd[22466]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1
# uname -a
Linux iot001 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux
# gpio readall
+-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
IOT-houseのラズパイは527日も動作しています
top - 12:01:21 up 527 days, 15:14, 1 user, load average: 5.26, 5.06, 4.96
Tasks: 103 total, 5 running, 97 sleeping, 0 stopped, 1 zombie
%Cpu(s): 47.2 us, 48.5 sy, 0.0 ni, 2.9 id, 0.0 wa, 0.0 hi, 1.3 si, 0.0 st
KiB Mem: 380460 total, 353724 used, 26736 free, 92440 buffers
KiB Swap: 102396 total, 0 used, 102396 free, 213060 cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2796 root 20 0 2960 2424 2064 S 2.6 0.6 17960:33 run
2791 root 20 0 2896 2328 2040 S 2.3 0.6 15367:33 run
26581 root 20 0 0 0 0 Z 1.9 0.0 0:00.06 run
27098 root 20 0 2944 2340 1996 S 1.9 0.6 3697:06 run
25030 root 20 0 4692 2476 2116 R 1.6 0.7 0:00.46 top
3 root 20 0 0 0 0 R 1.3 0.0 8625:38 ksoftirqd/0
2797 root 20 0 2852 2312 2064 S 1.3 0.6 7954:59 run
10122 root 20 0 2908 2392 2088 S 1.0 0.6 5739:06 run
18989 pi 20 0 9332 3252 2660 S 1.0 0.9 0:00.23 sshd
5358 avahi 20 0 3508 2648 2264 S 0.6 0.7 957:29.09 avahi-daemon
26594 root 20 0 2784 2316 2136 S 0.6 0.6 0:00.02 pepogpioctl
26608 root 20 0 2540 1512 1400 R 0.6 0.4 0:00.02 jq
26609 root 20 0 2784 2328 2148 S 0.6 0.6 0:00.02 pepogpioctl
1553 root 20 0 1772 1248 1152 S 0.3 0.3 674:53.33 ifplugd
2775 root 20 0 1732 864 792 S 0.3 0.2 74:30.96 svscan
Raspberry Piが入手困難な時、Windows、MAC、LinuxでIOTができる
IOT-House_old_pcは如何、GPIOにはUSB接続のMM-CP2112A、I2C接続の環境ガスセンサーBME680を使います