カラフルでかわいい prettyping

pingのカラフルなラッパーの prettyping というものを知りました.

少し試してみました.

$ curl -O https://raw.githubusercontent.com/denilsonsa/prettyping/master/prettyping
$ install -m 755 ./prettyping ~/bin/
$ ls -l ~/bin/prettyping
-rwxr-xr-x 1 pi pi 23396 Apr  1 22:08 /home/pi/bin/prettyping
$ ~/bin/prettyping 1.1.1.1
0 ▁ 10 ▂ 20 ▃ 30 ▄ 40 ▅ 50 ▆ 60 ▇ 70 █ 80 ▁ 90 ▂ 100 ▃ 110 ▄ 120 ▅ 130 ▆ 140 ▇ 150 █ 160 ▁ 170 ▂
180 ▃ 190 ▄ 200 ▅ 210 ▆ 220 ▇ 230 █ ∞
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
▂▅█▁▄▂█
 0/  7 ( 0%) lost;   76/ 107/ 178ms; last:   76ms
 0/  7 ( 0%) lost;   76/ 107/ 178/  27ms (last 7)

カラーで見るときれいです.

prettyping

安定した回線だと緑で面白くないので不安定な回線や遠くのアドレスを指定するといいかもしれません.今回は電波状況の悪い携帯回線で試しました.(-120dBM前後の圏外になったり戻ったりな場所)


https://www.youtube.com/watch?v=gL87DBohRaQ
環境
$ dpkg-query -W iputils-ping curl coreutils
coreutils	8.30-3
curl	7.64.0-4+deb10u1
iputils-ping	3:20180629-2+deb10u2
$ lsb_release -dr
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
$ arch
armv7l
$ cat /proc/device-tree/model ;echo
Raspberry Pi 3 Model B Rev 1.2

標準入力の結果をシームレスに選択してクリップボードにコピーする「yank」

ターミナルからの標準入力の結果をシームレスに選択してクリップボードにコピーしてくれる yank というコマンドを知りました.

yankは各種環境のパッケージが用意されています.
Debian sid amd64 / Ubuntu 21,04 amd64 / Raspberry Pi OS buster armhf では yank というパッケージで提供されているのでこれを導入します.

$ sudo apt install yank (1)
$ yank (2)
bash: yank: command not found
$ dpkg -L yank | grep bin/ (3)
/usr/bin/yank-cli
  1. yank パッケージを導入
  2. yankコマンドが見つからない
  3. Debian系では名前空間の衝突のためにコマンド名が yank-cli になっている.

とりあえず導入できましたが,Debian環境だと yank コマンドが見つかりません.他のパッケージと名前が競合してしまっているので yank-cli として提供されているようです.

The binary is installed at /usr/bin/yank-cli due to a naming conflict.

— ‘https://github.com/mptre/yank
$ apt-file search /bin/yank
emboss: /usr/bin/yank
yank: /usr/bin/yank-cli

競合しているのはなんds楼と検索してみると emboss というパッケージのようです.

ヨーロッパ分子生物学オープンソフトウェアスイート
EMBOSS は、分子生物学のユーザコミュニティ (例: EMBnet) のために開発された オープンソースな解析用ソフトウェアパッケージです。このソフトウェアを 使うことで、様々なフォーマットで書かれたデータを自動的に処理したり、 ウェブから配列データを透過的に取得したりもできます。また、このパッケージには 拡張ライブラリが含まれているので、真のオープンソース精神に則って ソフトウェアを開発しリリースできるプラットフォームです。 さらに、EMBOSS は様々な配列解析用パッケージやツールとシームレスに 統合されています。EMBOSS は、長く続いた商用パッケージソフトウェアへの流れを 断ち切ったのです。

なかなか熱そうなプロジェクトのようです.

使わないならalias等でyankに向けてもいいかもしれません.

とりあえず導入出来たので試してみます.

yank 01

$ apt-cache search yank | yank-cli
elpa-csv-mode - Emacs major mode for editing comma/char separated values
python3-readlike - GNU Readline-like line editing module
yank - interactively select and yank terminal output to stdout or xsel

apt-cache search の結果を yank で受けてカーソルなどで単語単位で移動してEnterで選択した部分をクリップボードにコピーします.
クリップボード貼付けをするとたしかにコピーされていました.
例えばパッケージ名をコピーして, $ sudo apt install \`xsel\` のようにして使うと便利そうです.

その他便利そうなオプションとして, -d があります.cutコマンドの-dと同じようにデリミタが指定できます.

$ nkf -w mntemsadext00_rct.csv | yank-cli -d,

こんな感じでcsvファイルに , を指定してあげると,各項目がコピーできます.

しかし,yankはページ跨ぎが出来ないようです.1ページ目のものしかコピーできません.こういう場合はyankに渡す前にフィルタしてあげるといいようです.grepや,昨日このblogで紹介したyankと同じ作者の「pick」もこういうときに便利です.

$ nkf -w mntemsadext00_rct.csv | grep 田代 | yank-cli -d,`
$ nkf -w mntemsadext00_rct.csv | pick | yank-cli -d,`

なにかの結果の一部が欲しいときに便利そうです.

環境1
$ dpkg-query -W yank pick
pick	2.0.2-1
yank	1.1.0-2
$ lsb_release -dr
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
$ uname -m
armv7l
$ cat /proc/device-tree/model ;echo
Raspberry Pi 3 Model B Rev 1.2
環境2
$ dpkg-query -W yank pick
pick	2.0.2-1.1
yank	1.2.0-1
$ lsb_release -dr
Description:	Debian GNU/Linux bullseye/sid
Release:	unstable
$ uname -m
x86_64

ターミナルダッシュボードのWTFを少し試す

WTFというGo製のターミナルダッシュボードを見かけたので少し試してみました.

導入はLinuxのamd64/armv6/arm64,macOSのamd64/arm64はGitHub releaseページにあるのでそれを使うのが手っ取り早いです.
今回はarmv6をRaspberry Pi 3 Model BのRaspberry Pi OS armhfで試しました.

$ wget https://github.com/wtfutil/wtf/releases/download/v0.36.0/wtf_0.36.0_linux_armv6.tar.gz https://github.com/wtfutil/wtf/releases/download/v0.36.0/wtf_0.36.0_checksums.txt (1)
$ sha256sum -c ./wtf_0.36.0_checksums.txt 2>&1 | grep wtf_0.36.0_linux_armv6.tar.gz: (2)
wtf_0.36.0_linux_armv6.tar.gz: OK
$ tar tvf ./wtf_0.36.0_linux_armv6.tar.gz (3)
-rw-r--r-- ccummer/staff 34534 2021-03-23 19:20 wtf_0.36.0_linux_armv6/CHANGELOG.md
-rw-r--r-- ccummer/staff 14878 2018-12-01 01:13 wtf_0.36.0_linux_armv6/LICENSE.md
-rw-r--r-- ccummer/staff 39700 2021-03-20 13:46 wtf_0.36.0_linux_armv6/README.md
-rwxr-xr-x ccummer/staff 41615360 2021-03-23 19:35 wtf_0.36.0_linux_armv6/wtfutil
$ tar xf ./wtf_0.36.0_linux_armv6.tar.gz (4)
$ wtf_0.36.0_linux_armv6/wtfutil (5)
  1. Releases ページから最新のバイナリとチェックサムファイルを入手
  2. チェックサムファイルの中を見ると桁数的にsha256のようだったので,sha256sumでチェックサムを確認
  3. アーカイブの確認
  4. アーカイブの展開
  5. WTF起動

バイナリアーカイブをダウンロードして展開しました.
wtf_0.36.0_linux_armv6/wtfutil を実行すると既定値で起動します.しかし娘の設定だとターミナルサイズ固定だったりあまり嬉しくありません.

リポジトリの _sample_configs 以下にサンプルがあるのでこれを指定して起動してみます.

設定ファイルは既定値は ~/.config/wtf/config.yml を使います.存在しない場合はデフォルトのものが生成されます.若しくは wtf の -c, --config= オプションで指定した設定ファイルを指定できます.

$ wtf_0.36.0_linux_armv6/wtfutil --config=../src/wtf/_sample_configs/sample_config.yml

wtf 01

wtfリポジトリの _sample_configs/sample_config.yml を指定して起動するとこんな感じでターミナルサイズにも追従していい感じです.

wtf 02

diff --git a/_sample_configs/sample_config.yml b/_sample_configs/sample_config.yml
index e16690a0..fa3bf5c0 100644
--- a/_sample_configs/sample_config.yml
+++ b/_sample_configs/sample_config.yml
@@ -73,10 +73,21 @@ wtf:
         width: 1
       refreshInterval: 15
       sort: "alphabetical"
+    feedreader:
+      enabled: true
+      feeds:
+        - https://nitter.matoken.org/matoken1/rss
+      feedLimit: 10
+      position:
+        top: 1
+        left: 3
+        height: 1
+        width: 1
+      updateInterval: 14400
     battery:
       type: power
       title: "⚡️"
-      enabled: true
+      enabled: false
       position:
         top: 1
         left: 3

Raspberry Piは電源ステータスは見えないので無効にして代わりにfeedreaderを有効にしてNitter経由でTwitterのRSSフィードを表示してみました.

日本語や絵文字も崩れず表示できて良さそうですね.

その他にもたくさんのモジュールがあるようです.こちらのページから確認できます.(Nitterを通さなくてもTwitterモジュールもあった)

自分の用途に合わせて設定していくと便利そうです.

環境
$ wtf_0.36.0_linux_armv6/wtfutil --version
0.36.0 (2021-03-23T10:33:30Z)
$ lsb_release -dr
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
$ uname -m
armv7l
$ cat /proc/device-tree/model ;echo
Raspberry Pi 3 Model B Rev 1.2

Raspberry Pi の OSイメージを書き込む Raspberry Pi Imager v1.6 の新機能で書き込み時にカスタマイズ

Raspberry Pi で利用するストレージへのOSイメージ書き込みツールのRaspberry Pi Imagerの最新版のv1.6がリリースされたようです.

自分は出た当初少し試しただけで他のツールに比べて嬉しいことがあまりないと感じたので使っていなかったのですが,このv1.6ではイメージのカスタマイズ機能が入ったようなので試してみました.

Raspberry Pi Imagerの導入

$ sudo apt install rpi-imager

Raspberry Pi OSであればパッケージが存在するのでこれを導入すればokです.

Linux/Windows/macOSはGitHubのreleaseページから入手できます.
若しくは,Raspberry Pi downloadsページにもあります.こちらだとGutHubとファイル名が違いますがamd64の.debをdiffしてみると同じもので署名ファイルもあります..AppImageもありますが試してみると最新ではないようでした.

$ wget https://github.com/raspberrypi/rpi-imager/releases/download/v1.6/rpi-imager_1.6_amd64.deb (1)
$ wget https://downloads.raspberrypi.org/imager/imager_1.6_amd64.deb https://downloads.raspberrypi.org/imager/imager_1.6_amd64.deb.sig (2)
$ diff ./imager_1.6_amd64.deb ./rpi-imager_1.6_amd64.deb (3)
$ gpg2 --verify ./imager_1.6_amd64.deb.sig (4)
gpg: assuming signed data in './imager_1.6_amd64.deb'
gpg: Signature made Tue 16 Mar 2021 08:56:51 PM JST
gpg:                using RSA key 54C3DD610D9D1B4AF82A37758738CD6B956F460C
gpg: Good signature from "Raspberry Pi Downloads Signing Key" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 54C3 DD61 0D9D 1B4A F82A  3775 8738 CD6B 956F 460C
$ gpg2 --verify ./imager_1.6_amd64.deb.sig ./rpi-imager_1.6_amd64.deb
gpg: Signature made Tue 16 Mar 2021 08:56:51 PM JST
gpg:                using RSA key 54C3DD610D9D1B4AF82A37758738CD6B956F460C
gpg: Good signature from "Raspberry Pi Downloads Signing Key" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 54C3 DD61 0D9D 1B4A F82A  3775 8738 CD6B 956F 460C
$ sudo apt install ././imager_1.6_amd64.deb (5)
  1. GitHubからダウンロード
  2. downloads.raspberrypi.orgからダウンロード
  3. ファイル名は違うけど同じ内容なのを確認
  4. 署名確認
  5. インストール

Debian sid amd64環境ではAppImageが古いので.debを導入しました.

Imagerの起動と書き込み設定

Raspberry Pi ロゴのアイコンの「Imager」や, rpi-imager を実行すると起動します.

ここで,「ctrl + shift + x」を押すことで今回のカスタマイズ用の拡張オプション画面が表示されます.

rpi imager01
rpi imager02
rpi imager03
rpi imager04

今回はhostnameの修正,SSHの有効化,ssh公開鍵の登録,Wi-Fi 設定,タイムゾーンの設定を行いました.

「SAVE」して「RASPBERRY PI OS LITE (32-BIT)」を書き込んでみました.

書き込みが終了しても1つ目のパーティション(/boot)がマウントされたままでした.これはバグかな?(1回しか試していないので勘違いかもしれない)

$ mount | grep /dev/mmcblk0p1 (1)
/dev/mmcblk0p1 on /media/matoken/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
$ sudo umount /dev/mmcblk0p1 (2)
  1. 1つ目のパーティションがマウントされたまま
  2. アンマウントする

カスタマイズ内容確認

書き込まれたメディアの中を見ると /boot/firstrun.sh が作成されていました.Raspberry Pi Imagerは直接設定を書き換えるわけではなく,OSイメージを書き込んだあと子のファイルを作って,Raspberry Pi OSの初回起動時にこのscriptを実行して設定を反映していくようです.

/boot/firstrun.sh
#!/bin/bash

set +e

CURRENT_HOSTNAME=`cat /etc/hostname | tr -d " \t\n\r"`
echo raspberrypi-custom >/etc/hostname
sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\traspberrypi-custom/g" /etc/hosts
FIRSTUSER=`getent passwd 1000 | cut -d: -f1`
FIRSTUSERHOME=`getent passwd 1000 | cut -d: -f6`
install -o "$FIRSTUSER" -m 700 -d "$FIRSTUSERHOME/.ssh"
install -o "$FIRSTUSER" -m 600 <(echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPgwY9aZPxN/YoBBzd7TOcCk7EuGO0E9PuUjCHPtTuHP mk@x220") "$FIRSTUSERHOME/.ssh/authorized_keys"
echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config
systemctl enable ssh
cat >/etc/wpa_supplicant/wpa_supplicant.conf <<WPAEOF
country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1

update_config=1
network={
	ssid="matoken"
	psk="○○○○○○○○○○○○"
}

WPAEOF
chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
rfkill unblock wifi
for filename in /var/lib/systemd/rfkill/*:wlan ; do
  echo 0 > $filename
done
rm -f /etc/xdg/autostart/piwiz.desktop
rm -f /etc/localtime
echo "Asia/Tokyo" >/etc/timezone
dpkg-reconfigure -f noninteractive tzdata
cat >/etc/default/keyboard <<KBEOF
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""
KBEOF
dpkg-reconfigure -f noninteractive keyboard-configuration
rm -f /boot/firstrun.sh
sed -i 's| systemd.run.*||g' /boot/cmdline.txt
exit 0

ちょっと雑かなと感じるところもありますが便利な感じです.
( /etc/wpa_supplicant/wpa_supplicant.confwpa_passphrase コマンドを通してpskにしておきたいとか)

自分はsd card書き込み前にPCでマウントしてパッケージを最新にしたりインストールしたりといったことをしているので,sd card書き込みをしなくてもこのファイルを書き出してくれると嬉しいかなと思いました.

アンインストール

$ sudo apt purge rpi-imager
$ rm -r ~/.config/Raspberry\ Pi/Imager.conf ~/.cache/Raspberry\ Pi/Imager

パッケージを削除して,設定ファイルとキャッシュを削除しました.

環境

$ dpkg-query -W rpi-imager
rpi-imager      1.6
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

Raspberry Pi OS armhfでWidevineDRMビデオを観られるようになったので試す

Raspberry Pi OS armhfに libwidevinecdm0 パッケージが入ったようです.Raspberry Pi 3 Model Bでも動作したのでメモしておきます.

libwidevinecdm0 パッケージはWidevineというDRM付きコンテンツを閲覧するためのパッケージです.

Widevineは結構あちこちで見かけます.siteには以下のようなサービスが載っていました.

libwidevinecdm0 services

まずWidevineに非対応な状態でNetflixのコンテンツを閲覧しようとするとこのようなエラーになります.

libwidevinecdm0 ng

Note
Netflixの会員じゃなくても次で試せます.
TV番組・ドラマを無料で視聴 | Netflix お試し無料配信

ここで libwidevinecdm0 パッケージを導入してChromiumを起動しなおせばOKなはずですがうまく行きません.
chrome://components/ を見ても Widevine が出てきません.

https://bitmovin.com/demos/drm にアクセスしてみると, Detected , using No DRM と表示されDRMが使えないようです.

Raspberry Pi 4 Model B/400以外の事例が見当たらないのでもしかして何らかの要件が足りなくてRaspberry Pi 4 より前のバージョンでは動かないのかな?とか思ったのですが,もう少し調べるとRaspberry Pi OSのChromiumには chromiumchromium-browser の2つのパッケージがあるようです.

chromium
$ apt show chromium
Package: chromium
Version: 88.0.4324.146-1~deb10u1
Priority: optional
Section: web
Maintainer: Debian Chromium Team <chromium@packages.debian.org>
Installed-Size: 114 MB
Provides: gnome-www-browser, www-browser
Depends: libasound2 (>= 1.0.16), libatk-bridge2.0-0 (>= 2.5.3), libatk1.0-0 (>= 2.2.0), libatomic1 (>= 4.8), libatspi2.0-0 (>= 2.9.90), libavcode
c58 (>= 7:4.0), libavformat58 (>= 7:4.1), libavutil56 (>= 7:4.0), libc6 (>= 2.28), libcairo2 (>= 1.6.0), libcups2 (>= 1.7.0), libdbus-1-3 (>= 1.9
.14), libdrm2 (>= 2.4.38), libevent-2.1-6 (>= 2.1.8-stable), libexpat1 (>= 2.0.1), libflac8 (>= 1.3.0), libfontconfig1 (>= 2.12.6), libfreetype6
(>= 2.3.9), libgbm1 (>= 17.1.0~rc2), libgcc1 (>= 1:4.0), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.39.4), libgtk-3-0 (>= 3.19.12), libha
rfbuzz0b (>= 2.2.0), libicu63 (>= 63.1-1~), libjpeg62-turbo (>= 1.5.0), libjsoncpp1 (>= 1.7.4), liblcms2-2 (>= 2.2+git20110628), libminizip1 (>=
1.1), libnspr4 (>= 2:4.9-2~), libnss3 (>= 2:3.22), libopenjp2-7 (>= 2.2.0), libopus0 (>= 1.1), libpango-1.0-0 (>= 1.14.0), libpng16-16 (>= 1.6.2-
1), libpulse0 (>= 0.99.1), libre2-5 (>= 20160901), libsnappy1v5, libstdc++6 (>= 7), libvpx5 (>= 1.6.0), libwebp6 (>= 0.5.1), libwebpdemux2 (>= 0.
5.1), libwebpmux3 (>= 0.6.1-2), libx11-6 (>= 2:1.4.99.1), libxcb1 (>= 1.9.2), libxcomposite1 (>= 1:0.3-1), libxdamage1 (>= 1:1.1), libxext6, libx
fixes3, libxml2 (>= 2.7.4), libxrandr2, libxslt1.1 (>= 1.1.25), zlib1g (>= 1:1.2.2), chromium-common (= 88.0.4324.146-1~deb10u1)
Recommends: chromium-sandbox
Suggests: chromium-l10n, chromium-shell, chromium-driver
Conflicts: libgl1-mesa-swx11, libnettle4, libsecret-1-0 (<< 0.18)
Breaks: chromium-lwn4chrome (<= 1.0-2), chromium-tt-rss-notifier (<= 0.5.2-2)
Homepage: http://www.chromium.org/Home
Download-Size: 48.9 MB
APT-Sources: http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
Description: web browser
 Web browser that aims to build a safer, faster, and more stable internet
 browsing experience.
 .
 This package contains the web browser component.
chromium-browser
$ apt show chromium-browser
Package: chromium-browser
Version: 88.0.4324.187-rpt1
Priority: optional
Section: web
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Installed-Size: 329 MB
Provides: chromium, chromium-browser-inspector, www-browser
Pre-Depends: dpkg (>= 1.15.6)
Depends: libasound2 (>= 1.0.16), libatk-bridge2.0-0 (>= 2.5.3), libatk1.0-0 (>= 2.2.0), libatspi2.0-0 (>= 2.9.90), libc6 (>= 2.18), libcairo2 (>=
 1.6.0), libcups2 (>= 1.7.0), libdbus-1-3 (>= 1.9.14), libdrm2 (>= 2.4.38), libexpat1 (>= 2.0.1), libgbm1 (>= 17.1.0~rc2), libgcc1 (>= 1:4.3), li
bgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.39.4), libgtk-3-0 (>= 3.21.5), libnspr4 (>= 2:4.9-2~), libnss3 (>= 2:3.22), libpango-1.0-0 (>= 1
.14.0), libx11-6 (>= 2:1.4.99.1), libxcb1 (>= 1.9.2), libxcomposite1 (>= 1:0.3-1), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxkbcommon0 (>
= 0.5.0), libxrandr2, libxtst6, bash (>= 4), xdg-utils, chromium-codecs-ffmpeg-extra (= 88.0.4324.187-rpt1) | chromium-codecs-ffmpeg (= 88.0.4324
.187-rpt1), libraspberrypi0, libgl1-mesa-dri
Recommends: chromium-browser-l10n
Suggests: webaccounts-chromium-extension, unity-chromium-extension, adobe-flashplugin
Conflicts: chromium, chromium-browser-inspector
Replaces: chromium, chromium-browser-inspector
Homepage: https://chromium.googlesource.com/chromium/src/
Download-Size: 103 MB
APT-Manual-Installed: no
APT-Sources: http://archive.raspberrypi.org/debian buster/main armhf Packages
Description: Chromium web browser, open-source version of Chrome
 An open-source browser project that aims to build a safer, faster, and more
 stable way for all Internet users to experience the web.

そしてうまく行かなかったのは chromium でした.
chromium-browser を入れて(排他なので chromim パッケージは削除される)再度試すと,chrome://components/Widevine が現れて,

libwidevinecdm0 componets

https://bitmovin.com/demos/drm にアクセスしてみると, Detected , using widevine と表示されるようになりNetflixのコンテンツも閲覧できました.

libwidevinecdm0 netflix

Note
攻殻機動隊 SAC_2045 より.なんだかOPがPortal感

ということで,Raspberry Pi 3 Model B + Raspberry Pi OS armhf でも libwidevinecdm0 パッケージと chromium-browser パッケージを導入することでWidevineのDRMコンテンツが観られるようになりました :)
(DRMなしで閲覧できたほうが嬉しいですが)

$ sudo apt update
$ sudo apt install chromium-browser libwidevinecdm0
$ chromium-browser &
環境
$ dpkg-query -W chromium-browser* libwidevinecdm0
chromium-browser        88.0.4324.187-rpt1
chromium-browser-inspector
chromium-browser-l10n   88.0.4324.187-rpt1
libwidevinecdm0 4.10.1679.0-1
$ lsb_release -dr
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
$ uname -m
armv7l
$ cat /proc/device-tree/model ;echo
Raspberry Pi 3 Model B Rev 1.2

Megatoolsを新規アカウントで利用しようとするとエラーとなる( ERROR: Can’t login to mega.nz: API call ‘us’ failed: Server returned error ENOENT )

Mega.nz のサービスをコマンドラインで行うためのツール群の Megatools というものがあります.

これを新規アカウントで利用しようとするとこのようなエラーになります.

$ megadf
ERROR: Can't login to mega.nz: API call 'us' failed: Server returned error ENOENT

これは Mega.nz のユーザ登録の仕様が変わったせいなようで新規に Mega.nz のウェブから登録したアカウントで起こるらしいです.

仕様変更前に登録したアカウントや,現在でも Megatools の megareg コマンドで登録したアカウントならMegatools が利用できるようです.

ということで megareg コマンドでアカントを登録し直して試してみました.

megareg コマンドにユーザー名、メールアドレス、パスワードを指定する

$ megareg --register -n 'REALNAME' -e 'EMAIL' -p 'PASSWORD'
Registration email was sent to EMAIL. To complete registration, you must run:

  megareg --verify 7e2c96BDD0DFnrlfo2hXmg==:/Lw2hwBBBBBBBBBBF2Lk1B==:5ceaxAEvkXQ @LINK@

(Where @LINK@ is registration link from the 'MEGA Signup' email)

登録確認メールが届くので、上の例の @LINK@ 部分をそのメールに書かれているURLに書き換えて megareg --verify を実行する

$ megareg --verify 7e2c96BDD0DFnrlfo2hXmg==:/Lw2hwBBBBBBBBBBF2Lk1B==:5ceaxAEvkXQ 'https://mega.nz/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
Account registered successfully!

利用できるか試してみる

$ megadf -u 'EMAIL' -p 'PASSWORD'
Total: 53687091200
Used:  0
Free:  53687091200

うまく行きました.

毎回コマンドの引数にアカウント情報は書きたくないので設定ファイルを用意して使います.

設定ファイルは, ~/.megarc, ./.megarc 若しくは --config $CONFIGFILE で指定します.設定ファイルの内容は最低限以下のような感じで詳細は man megarc を参照.

[Login]
Username = your@email
Password = yourpassword
環境1
$ dpkg-query -W megatools
megatools       1.10.2-1
$ lsb_release -dr
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
$ uname -m
armv7l
環境2
$ dpkg-query -W megatools
megatools       1.10.2-1
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

Raspberry Piのraspistilコマンドでジオタグ埋め込みを試すとエラーになる

Raspberry Pi の専用コマンドの中に raspistil コマンドというものがあります.
(Raspbianの libraspberrypi-bin パッケージ内にあります.)

このコマンドで専用カメラでの撮影が出来ます.
インターバル撮影してMapillaryにアップロードしてマッピングの足しに出来ないかなと少し試してみました.

何時もは撮影した画像に別撮りしたGPSデータを埋め込むのですが,raspistillのオプションを確認すると最近はgpsdから位置情報見て埋め込むオプションがあって便利そうです.

しかし,その -gps オプションを利用するとエラーになります.

$ raspistill -gps -o test2.jpg
libgps.so.22: cannot open shared object file: No such file or directory
Unable to load the libGPS library

とりあえずリンク張ったら動きました.

$ sudo ln -s /usr/lib/arm-linux-gnueabihf/libgps.so.23.0.0 /usr/lib/arm-linux-gnueabihf/libgps.so.22

add)
バグ報告したらすぐ修正されました.しばらくしたら反映されるでしょう :)

しかしexifを確認しても位置情報は埋め込まれていません.室内でGPS弱いのでまた後で屋外で試してみます.

しかし,8MPのimx219ではピントが無限遠ではなく近くに設定されているようでそのままではちょっとダメそう.そして画角はもっと広角なのが欲しいです.

raspistil01
raspistil02

ピントの方は以下のページを参考に少し調整してみるとこんな感じに.もう少し行けそうだけど壊しそうで怖い.

raspistil03

画角も狭いしこういうものを買うと良さそう.誰か買って試してみてください.(そして飽きたら安く譲って😏)

環境(Raspbian Buster Lite 2019-09-26を2019-11-12にapt update && apt upgradeした環境)
$ dpkg-query -W gpsd libgps23 libraspberrypi-bin
gpsd 3.17-7
libgps23:armhf 3.17-7
libraspberrypi-bin 1.20190925+1-1
$ lsb_release -dr
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
$ uname -a
Linux raspberrypi 4.19.75+ #1270 Tue Sep 24 18:38:54 BST 2019 armv6l GNU/Linux
$ cat /proc/device-tree/model ;echo
Raspberry Pi Model B Plus Rev 1.2

Raspbian Buster 2019-09-26

リリースされていました.

2019-09-26:
* rpi-eeprom included
  - This will automatically update the SPI EEPROM on the Raspberry Pi 4 to the latest stable version.
     See https://rpf.io/eeprom for more information.
* New icon theme for file manager icons
* Appearance Settings - option for identical desktop on both monitors
* Appearance Settings - option to show different desktop icons on both monitors
* Taskbar automatically moved to monitor 0 if monitor 1 not found at boot
* Switching of audio output between two HDMI devices added to volume plugin
* Switching of audio input devices added to volume plugin
* .asoundrc (ALSA config file) now uses 'plug' values to support more devices
* Audio Settings tool modified to integrate more closely with volume plugin to reduce duplicated code
* Screen Configuration tool now shows separate menus for resolution and refresh rate
* Primary and active monitor settings removed from Screen Configuration tool
* Overscan support added for FKMS driver
* New keyboard shortcuts added - Ctrl-Alt-End brings up shutdown menu; Ctrl-Alt-M moves taskbar between monitors
* Latest changes to Bluez ALSA interface integrated to improve connection to Bluetooth audio devices
* Mousepad used as simple text editor instead of leafpad
* Version 3.2 of Thonny added
* Version 74 of Chromium added
* Version 3.0.8 of VLC added
* Version 32.0.0.255 of Flash player added
* Version 6.5.0 of RealVNC Server added
* Version 6.19.715 of RealVNC Viewer added (full image only)
* Version 12.0.1 of Mathematica added (full image only)
* Version 0.20.8 of NodeRED added (full image only)
* Version 3.1.0 of Sonic Pi added (full image only)
* Scratch 3 added (full image only)
* Bug fix - URL handling in Terminal
* Bug fix - octal values in SSIDs in network plugin
* Bug fix - remaining value in progress bar when transferring files
* Bug fix - integration of xarchiver tool with file manager
* Bug fix - start menu opening on incorrect monitor
* Bug fix - minimised applications wrongly displayed on taskbar on second monitor
* Bug fix - Bluetooth icon disappearing on x86 platforms when Bluetooth turned off
* Bug fix - Screen Configuration tool not shown on x86 platforms and settings not being saved
* Various translation updates
* Various minor bug fixes
* Epiphany/Web removed
* ntfs-3g included
* pciutils added
* Linux kernel 4.19.75
* Raspberry Pi firmware 01508e81ec1e918448227ca864616d56c430b46d

このショートカットが便利かも?

  • New keyboard shortcuts added – Ctrl-Alt-End brings up shutdown menu; Ctrl-Alt-M moves taskbar between monitors

とりあえず,liteだけダウンロードキューに入れておきました.

$ wget https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip.torrent \
  https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip.sig
$ transmission-cli 2019-09-26-raspbian-buster-lite.zip.torrent

ADD: その後ダウンロードが終わったのでverify

$ gpg --verify ./2019-09-26-raspbian-buster-lite.zip.sig
gpg: assuming signed data in './2019-09-26-raspbian-buster-lite.zip'
gpg: Signature made Mon 30 Sep 2019 09:43:50 PM JST
gpg:                using RSA key 54C3DD610D9D1B4AF82A37758738CD6B956F460C
gpg: Good signature from "Raspberry Pi Downloads Signing Key" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 54C3 DD61 0D9D 1B4A F82A  3775 8738 CD6B 956F 460C

#Raspberry Pi 4 model B も先週あたりに工事設計認証が総務省のリストに載ったようだし日本発売も間近?(所謂技適問題)
##電源バグも修正してくれると嬉しい

sshuttle がエラーになる

SSH VPN がお手軽に利用できる sshuttle を久々に使おうとしたら失敗します.いくつかのremotehostを試してもうまくいかない.

Debian sid 環境でのエラー

$ sshuttle -v -r user@remotehost 0/0
Starting sshuttle proxy.
firewall manager: Starting firewall with Python version 3.7.4
firewall manager: ready method name nat.
IPv6 enabled: False
UDP enabled: False
DNS enabled: False
User enabled: False
TCP redirector listening on ('127.0.0.1', 12300).
Starting client with Python version 3.7.4
c : connecting to server...
Host key fingerprint is SHA256:kUoWT4bCu7+HiegN9R5tYqO5nnvpQPobzSk46T8WEwU
+---[ECDSA 256]---+
|   .E...o        |
|    o o= .       |
|     +o +        |
|    oo . .       |
|    oo. S        |
|   *++ o         |
|  *.+=X+o        |
| ..=+X*=.        |
| .o+%B+o         |
+----[SHA256]-----+
Enter passphrase for key '/home/matoken/.ssh/id_ed25519':
Authenticated to nnn.nnn.nnn.nnn ([nnn.nnn.nnn.nnn]:nn).
-c:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
Starting server with Python version 3.7.3
 s: latency control setting = True
c : Connected.
 s: auto-nets:False
firewall manager: setting up.
>> iptables -t nat -N sshuttle-12300
>> iptables -t nat -F sshuttle-12300
>> iptables -t nat -I OUTPUT 1 -j sshuttle-12300
>> iptables -t nat -I PREROUTING 1 -j sshuttle-12300
>> iptables -t nat -A sshuttle-12300 -j RETURN --dest 127.0.0.1/32 -p tcp
>> iptables -t nat -A sshuttle-12300 -j REDIRECT --dest 0.0.0.0/0 -p tcp --to-ports 12300 -m ttl ! --ttl 42
firewall manager: undoing changes.
>> iptables -t nat -D OUTPUT -j sshuttle-12300
>> iptables -t nat -D PREROUTING -j sshuttle-12300
>> iptables -t nat -F sshuttle-12300
>> iptables -t nat -X sshuttle-12300
c : fatal: server died with error code 255

最後の行のエラーメッセージで検索すると以下のIssue を見つけました.

参考にして -x remotehostip で使えるようになりました.-x は除外オプションで接続先のip を指定して除外するとOKのようです.

  • NG $ sshuttle -r user@remotehost 0/0

  • OK $ sshuttle -r user@remotehost 0/0 -x remotehostip

VPN 対象のサブネットと同様 -x にも複数のサブネット/ip の指定ができます.

Debian sid 環境
$ dpkg-query -W sshuttle
sshuttle        0.78.5-1
$ hostnamectl|grep -E 'Operating System|Architecture'
  Operating System: Debian GNU/Linux bullseye/sid
	  Architecture: x86-64

Raspbian Buster 環境でのエラー

ちなみに sshuttle を Raspbian Buster で試すとまた違うこんなエラーに.でもやっぱり -x で解決しました.

Raspbian Buster での error message
 :
client: Connected.
packet_write_wait: Connection to 192.168.1.102 port 22: Broken pipe
Traceback (most recent call last):
  File "/usr/bin/sshuttle", line 11, in <module>
	load_entry_point('sshuttle==0.78.5', 'console_scripts', 'sshuttle')()
  File "/usr/lib/python3/dist-packages/sshuttle/cmdline.py", line 82, in main
	opt.sudo_pythonpath)
  File "/usr/lib/python3/dist-packages/sshuttle/client.py", line 787, in main
	seed_hosts, auto_hosts, auto_nets, daemon, to_nameserver)
  File "/usr/lib/python3/dist-packages/sshuttle/client.py", line 547, in _main
	ssnet.runonce(handlers, mux)
  File "/usr/lib/python3/dist-packages/sshuttle/ssnet.py", line 598, in runonce
	h.callback(s)
  File "/usr/lib/python3/dist-packages/sshuttle/ssnet.py", line 488, in callback
	self.flush()
  File "/usr/lib/python3/dist-packages/sshuttle/ssnet.py", line 439, in flush
	wrote = _nb_clean(os.write, self.wsock.fileno(), self.outbuf[0])
  File "/usr/lib/python3/dist-packages/sshuttle/ssnet.py", line 79, in _nb_clean
	return func(*args)
BrokenPipeError: [Errno 32] Broken pipe
Raspbian Buster の環境
$ dpkg-query -W sshuttle
sshuttle        0.78.5-1
$ lsb_release -d
Description:    Raspbian GNU/Linux 10 (buster)
$ uname -m
armv6l
$ cat /proc/device-tree/model ;echo
Raspberry Pi Model B Rev 2

Ubuntu 18.04 LTS 環境(OK)

Ubuntu 18.04 LTS のsshuttle でも試してみましたがこれは -x を付けなくても問題なしでした.sshuttle 0.78.4 〜 0.78.5 の間の修正での影響でしょうか?

error の出なかった環境
$ dpkg-query -W sshuttle
sshuttle        0.78.3-1ubuntu1
$ lsb_release -d
Description:    Ubuntu 18.04.2 LTS
$ uname -m
x86_64