Raspberry Pi公式のOS書き込みソフトウェアの Raspberry Pi Imager を少し試す

Instagram の動画がわかりやすいですね.
Raspberry Pi公式のOSイメージ書き込みソフトウェアです.少し試してみました.

導入

ダウンロードページにはWindows/macOSの他 Ubuntu amd64 向けの.debへのリンクしか無いのですが, https://downloads.raspberrypi.org/imager/ にアクセスすると AppImage と .sig がありました.
どちらも amd64 なので他のArchtectureじゃ使えないようです.Raspbianのarmhf版くらいは欲しいですね.

とりあえず Ubuntu 20.04 amd64 では .deb を,Debian sid amd64 では AppImage を試してみました.

debの場合

ダウンロードして署名検証して dpkg -i で導入したのですがpkgが足りなくてエラーが出力されました.足りないパッケージは apt install -f で導入しました.足りなかったパッケージは qml-module-qt-labs-settingslibdleyna-core-1.0-5 でした.(環境により変わるはず)

$ wget https://downloads.raspberrypi.org/imager/imager_amd64.deb https://downloads.raspberrypi.org/imager/imager_amd64.deb.sig
$ gpg --verify ./imager_amd64.deb.sig
gpg: assuming signed data in './imager_amd64.deb'
gpg: Signature made Fri Mar  6 20:49:08 2020 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 dpkg -i ./imager_amd64.deb
$ sudo apt install -f
$ sudo rpi-imager
AppImage の場合

ダウンロードして署名検証して実行権を付けるだけです.

$ wget https://downloads.raspberrypi.org/imager/imager_amd64.AppImage https://downloads.raspberrypi.org/imager/imager_amd64.AppImage.sig
$ gpg --verify ./imager_amd64.AppImage.sig
gpg: assuming signed data in './imager_amd64.AppImage'
gpg: Signature made Fri 06 Mar 2020 10:34:08 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
$ chmod +x ./imager_amd64.AppImage
$ sudo ./imager_amd64.AppImage
余録).debを展開してとりあえず実行
$ ar x ./imager_amd64.deb
$ tar xf data.tar.xz
$ sudo ./usr/bin/rpi-imager

起動

root権が必要です.一般ユーザでも起動できるのですが,書き込み時にSD cardにアクセスできないエラーが出てしまいます.

20200308 15:03:05 1211621

OS list 取得エラー(一時的なサーバ側の問題)

現在サーバ側でSSLの問題があり大抵以下のようなエラーになります.9回に1回の割合で成功するらしいですが,私は30回ほど試してやっとうまく行きました.数日待てば治るそうなのでしばらく待ってから試す方がいいかもしれません.

20200307 17:03:40 265752

Caleb says:5th Mar 2020 at 3:32 pm
Currently giving me a “Error downloading OS list from Internet” when running it on a raspberry pi 4b

Avatar Gordon Hollingworth says:5th Mar 2020 at 5:05 pm
Yes, that’s because downloads.raspberrypi.org needs its SSL stuff updated. It should happen in the next few days!

Otherwise keep loading it, there’s a 1 in 9 chance you’ll get through to the server that does work!

Gordon

ちなみにOS listが取得できなくても自分でダウンロードしたイメージの書き込みやSD cardの消去は出来ます.

20200307 17:03:24 252063

Imagerの起動

起動するとこんな画面です.「CHOOSE OS」でOSイメージの選択(Raspbian各種とLibreELEC),ユーティリティ,消去,カスタムが選択できます.
「CHOOSE SD CARD」でSD cardやUSBメモリなどが選択できます.

20200307 17:03:12 251909

OSイメージの選択

20200308 15:03:20 1209635
20200308 15:03:02 1210096

SD card等の選択「CHOOSE SD CARD」

この画面を表示してからSD cardやUSBメモリ等を挿入するとリアルタイムに表示さるのでわかりやすいです.内蔵diskは出てきませんが,マウント中のHDDなどは出てくるので間違えないように注意しましょう.
選択できるストレージは1度に1つだけのようです.複数のメディアに書き込む場合は複数回の実行が必要です.

20200308 15:03:27 1210403

OSイメージ書き込み

「WRITE」ボタンを押すことで書き込みが開始されます.SecureEraseを試みてイメージ書き込み,ベリファイを行います.終わるまでしばらく待ちましょう.

20200308 15:03:57 1211527
20200308 15:03:30 1211923
20200308 15:03:30 1215554

自動ダウンロードしたイメージ

deb版の方は ~root/.cache/Raspberry Pi/Imager/lastdownload.cache として 最後に利用したものだけ が残るようです.なので同じイメージであれば2回目はダウンロードせずに済みます.
別のイメージを利用すると上書きされてそのイメージになります.

AppImage は /tmp/runtime-root 以下のようなので再起動したら消えてしまいますね.

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’

rpi-imagerでLibreELEC RPi1を書き込んだ後出来たキャッシュファイルと LibreELEC からダウンロードしたファイルを比較
# sha256sum ./lastdownload.cache
80cd38e0a576f75caaecf511970ae563c5b605896074809643aecfdc91344bcf  ./lastdownload.cache
# wget http://releases.libreelec.tv/LibreELEC-RPi.arm-9.2.0.img.gz
# sha256sum LibreELEC-RPi.arm-9.2.0.img.gz
80cd38e0a576f75caaecf511970ae563c5b605896074809643aecfdc91344bcf  LibreELEC-RPi.arm-9.2.0.img.gz
# diff -as lastdownload.cache LibreELEC-RPi.arm-9.2.0.img.gz
Files lastdownload.cache and LibreELEC-RPi.arm-9.2.0.img.gz are identical

おわりに

てことで応用が聞かない感じなのでRaspberry Piを初めて使う人向けかなーと感じました.LibreELECなんかも同じようなツールを用意しているしOSイメージ書き込みで躓く人が多いのでツールが用意されているのかもしれないですね.
更に面倒だという人はOSイメージ入りのストレージを購入すると良さそうです.

個人的なおすすめは現在だとダウンロードは手動で書き込みには balenaEtcher がいいかなと思います.これもマルチプラットホーム対応で更に同時に複数のストレージに書き込みも可能です.

試した環境

deb版を試したUbuntu環境
$ dpkg-query -W rpi-imager qml-module-qt-labs-settings libdleyna-core-1.0-5
libdleyna-core-1.0-5:amd64
qml-module-qt-labs-settings:amd64       5.12.5-5
rpi-imager      1.0
$ lsb_release -dr
Description:    Ubuntu Focal Fossa (development branch)
Release:        20.04
$ uname -m
x86_64
AppImage版を試したDebian環境
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

Nextcloud 17.0.2 → 18.0.1 upgrade memo

Nextcloudを17.0.2から18.0.1にupgradeしました.

$ sudo -u www-data php ./occ status
  - installed: true
  - version: 18.0.1.3
  - versionstring: 18.0.1
  - edition:

17系のeolは2020-09で18系のeolは2021-01のようです.もうしばらく17でもいいかも.

今回以下のページを参考に updater.phar でupgradeしました.
※実行前に念の為dbバックアップとかしておきましょう.

$ cd $NEXTCLIUDPATH
$ sudo -u www-data php ./updater/updater.phar
Nextcloud Updater - version: v16.0.3-3-ga0c2b25 dirty

Current version is 17.0.2.

Update to Nextcloud 18.0.1 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-18.0.1.zip
Open changelog ↗

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrityapp:check-code
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] Y
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
2020-03-02T19:16:42+00:00 Set log level to debug
2020-03-02T19:16:42+00:00 Repair step: Repair MySQL collation
2020-03-02T19:16:42+00:00 Repair info: All tables already have the correct collation -> nothing to do
2020-03-02T19:16:42+00:00 Repair step: Repair SQLite autoincrement
2020-03-02T19:16:42+00:00 Repair step: Copy data from accounts table when migrating from ownCloud
2020-03-02T19:16:43+00:00 Repair step: Drop account terms table when migrating from ownCloud
2020-03-02T19:16:43+00:00 Updating database schema
2020-03-02T19:16:46+00:00 Updated database
2020-03-02T19:16:46+00:00 Disabled incompatible app: announcementcenter
2020-03-02T19:16:46+00:00 Disabled incompatible app: data_request
2020-03-02T19:16:46+00:00 Disabled incompatible app: external
2020-03-02T19:16:46+00:00 Disabled incompatible app: files_snapshots
2020-03-02T19:16:46+00:00 Disabled incompatible app: fulltextsearch_elasticsearch
2020-03-02T19:16:46+00:00 Disabled incompatible app: gallery
2020-03-02T19:16:46+00:00 Disabled incompatible app: gpxedit
2020-03-02T19:16:46+00:00 Disabled incompatible app: quota_warning
2020-03-02T19:16:46+00:00 Disabled incompatible app: ransomware_protection
2020-03-02T19:16:46+00:00 Disabled incompatible app: sharerenamer
2020-03-02T19:16:46+00:00 Disabled incompatible app: social
2020-03-02T19:16:46+00:00 Disabled incompatible app: socialsharing_diaspora
2020-03-02T19:16:46+00:00 Disabled incompatible app: socialsharing_email
2020-03-02T19:16:46+00:00 Disabled incompatible app: socialsharing_twitter
2020-03-02T19:16:46+00:00 Disabled incompatible app: spreed
2020-03-02T19:16:46+00:00 Updating <accessibility> ...
2020-03-02T19:16:46+00:00 Repair step: Migrate old user config
2020-03-02T19:16:46+00:00 Migrate old user config
2020-03-02T19:16:46+00:00
2020-03-02T19:16:46+00:00  Starting ...
    0/0 [>-]   0%2020-03-02T19:16:46+00:00
 Starting ...
    1/0 [->]   0%2020-03-02T19:16:46+00:00
 Starting ...
    2/0 [-->]   0%2020-03-02T19:16:46+00:00
 Starting ...
    3/0 [--->]   0%2020-03-02T19:16:46+00:00
2020-03-02T19:16:46+00:00 Updated <accessibility> to 1.4.0
2020-03-02T19:16:46+00:00 Updating <federatedfilesharing> ...
2020-03-02T19:16:46+00:00 Updated <federatedfilesharing> to 1.8.0
2020-03-02T19:16:46+00:00 Updating <files_pdfviewer> ...
2020-03-02T19:16:47+00:00 Updated <files_pdfviewer> to 1.7.0
2020-03-02T19:16:47+00:00 Updating <files_rightclick> ...
2020-03-02T19:16:47+00:00 Updated <files_rightclick> to 0.15.2
2020-03-02T19:16:47+00:00 Updating <files_videoplayer> ...
2020-03-02T19:16:47+00:00 Updated <files_videoplayer> to 1.7.0
2020-03-02T19:16:47+00:00 Updating <logreader> ...
2020-03-02T19:16:47+00:00 Updated <logreader> to 2.3.0
2020-03-02T19:16:47+00:00 Updating <password_policy> ...
2020-03-02T19:16:47+00:00 Updated <password_policy> to 1.8.0
2020-03-02T19:16:47+00:00 Updating <privacy> ...
2020-03-02T19:16:48+00:00 Updated <privacy> to 1.2.0
2020-03-02T19:16:48+00:00 Updating <provisioning_api> ...
2020-03-02T19:16:48+00:00 Updated <provisioning_api> to 1.8.0
2020-03-02T19:16:48+00:00 Updating <recommendations> ...
2020-03-02T19:16:48+00:00 Updated <recommendations> to 0.6.0
2020-03-02T19:16:48+00:00 Updating <serverinfo> ...
2020-03-02T19:16:48+00:00 Updated <serverinfo> to 1.8.0
2020-03-02T19:16:48+00:00 Updating <support> ...
2020-03-02T19:16:49+00:00 Updated <support> to 1.1.0
2020-03-02T19:16:49+00:00 Updating <survey_client> ...
2020-03-02T19:16:49+00:00 Updated <survey_client> to 1.6.0
2020-03-02T19:16:49+00:00 Updating <text> ...
2020-03-02T19:16:49+00:00 Updated <text> to 2.0.0
2020-03-02T19:16:49+00:00 Updating <twofactor_backupcodes> ...
2020-03-02T19:16:49+00:00 Repair step: Add background job to check for backup codes
2020-03-02T19:16:49+00:00 Updated <twofactor_backupcodes> to 1.7.0
2020-03-02T19:16:49+00:00 Updating <updatenotification> ...
2020-03-02T19:16:50+00:00 Updated <updatenotification> to 1.8.0
2020-03-02T19:16:50+00:00 Updating <federation> ...
2020-03-02T19:16:50+00:00 Updated <federation> to 1.8.0
2020-03-02T19:16:50+00:00 Updating <lookup_server_connector> ...
2020-03-02T19:16:50+00:00 Updated <lookup_server_connector> to 1.6.0
2020-03-02T19:16:50+00:00 Updating <oauth2> ...
2020-03-02T19:16:50+00:00 Repair step: Update OAuth token expiration times
2020-03-02T19:16:50+00:00 Updated <oauth2> to 1.6.0
2020-03-02T19:16:50+00:00 Updating <files> ...
2020-03-02T19:16:51+00:00 Updated <files> to 1.13.1
2020-03-02T19:16:51+00:00 Updating <activity> ...
2020-03-02T19:16:52+00:00 Updated <activity> to 2.11.0
2020-03-02T19:16:52+00:00 Updating <cloud_federation_api> ...
2020-03-02T19:16:52+00:00 Updated <cloud_federation_api> to 1.1.0
2020-03-02T19:16:52+00:00 Updating <dav> ...
2020-03-02T19:16:52+00:00 Repair step: Fix component of birthday calendars
2020-03-02T19:16:52+00:00 Repair info: 4 birthday calendars updated.
2020-03-02T19:16:52+00:00 Repair step: Regenerating birthday calendars to use new icons and fix old birthday events without year
2020-03-02T19:16:52+00:00 Repair info: Repair step already executed
2020-03-02T19:16:52+00:00 Repair step: Fix broken values of calendar objects
2020-03-02T19:16:52+00:00  Starting ...
    0/0 [>-]   0%2020-03-02T19:16:52+00:00 Fix broken values of calendar objects
2020-03-02T19:16:52+00:00
2020-03-02T19:16:52+00:00
2020-03-02T19:16:52+00:00 Repair step: Registering building of calendar search index as background job
2020-03-02T19:16:52+00:00 Repair info: Repair step already executed
2020-03-02T19:16:52+00:00 Repair step: Registering background jobs to update cache for webcal calendars
2020-03-02T19:16:52+00:00 Repair info: Added 0 background jobs to update webcal calendars
2020-03-02T19:16:52+00:00 Repair step: Registering building of calendar reminder index as background job
2020-03-02T19:16:52+00:00 Repair info: Repair step already executed
2020-03-02T19:16:52+00:00 Repair step: Clean up orphan event and contact data
2020-03-02T19:16:52+00:00 Repair info: 0 events without a calendar have been cleaned up
2020-03-02T19:16:52+00:00 Repair info: 0 properties without an events have been cleaned up
2020-03-02T19:16:52+00:00 Repair info: 0 changes without a calendar have been cleaned up
2020-03-02T19:16:52+00:00 Repair info: 0 cached events without a calendar subscription have been cleaned up
2020-03-02T19:16:52+00:00 Repair info: 0 changes without a calendar subscription have been cleaned up
2020-03-02T19:16:52+00:00 Repair info: 0 contacts without an addressbook have been cleaned up
2020-03-02T19:16:52+00:00 Repair info: 0 properties without a contact have been cleaned up
2020-03-02T19:16:52+00:00 Repair info: 0 changes without an addressbook have been cleaned up
2020-03-02T19:16:52+00:00 Repair step: Remove activity entries of private events
2020-03-02T19:16:53+00:00 Repair info: Removed 0 activity entries
2020-03-02T19:16:53+00:00 Updated <dav> to 1.14.0
2020-03-02T19:16:53+00:00 Updating <encryption> ...
2020-03-02T19:16:53+00:00 Repair step: Write default encryption module configuration to the database
2020-03-02T19:16:53+00:00 Updated <encryption> to 2.6.0
2020-03-02T19:16:53+00:00 Updating <files_external> ...
2020-03-02T19:16:53+00:00 Updated <files_external> to 1.9.0
2020-03-02T19:16:53+00:00 Updating <files_sharing> ...
2020-03-02T19:16:54+00:00 Repair step: Fix the share type of guest shares when migrating from ownCloud
2020-03-02T19:16:54+00:00 Repair step: Copy the share password into the dedicated column
2020-03-02T19:16:54+00:00 Repair step: Set existing shares as accepted
2020-03-02T19:16:54+00:00 Updated <files_sharing> to 1.10.1
2020-03-02T19:16:54+00:00 Updating <files_trashbin> ...
2020-03-02T19:16:54+00:00 Updated <files_trashbin> to 1.8.0
2020-03-02T19:16:54+00:00 Updating <files_versions> ...
2020-03-02T19:16:54+00:00 Updated <files_versions> to 1.11.0
2020-03-02T19:16:54+00:00 Updating <sharebymail> ...
2020-03-02T19:16:55+00:00 Updated <sharebymail> to 1.8.0
2020-03-02T19:16:55+00:00 Updating <workflowengine> ...
2020-03-02T19:16:56+00:00 Repair step: Populating added database structures for workflows
2020-03-02T19:16:56+00:00 Updated <workflowengine> to 2.0.0
2020-03-02T19:16:56+00:00 Updating <admin_audit> ...
2020-03-02T19:16:56+00:00 Updated <admin_audit> to 1.8.0
2020-03-02T19:16:56+00:00 Updating <comments> ...
2020-03-02T19:16:56+00:00 Updated <comments> to 1.8.0
2020-03-02T19:16:56+00:00 Updating <firstrunwizard> ...
2020-03-02T19:16:56+00:00 Updated <firstrunwizard> to 2.7.0
2020-03-02T19:16:56+00:00 Updating <nextcloud_announcements> ...
2020-03-02T19:16:57+00:00 Updated <nextcloud_announcements> to 1.7.0
2020-03-02T19:16:57+00:00 Updating <notifications> ...
2020-03-02T19:16:57+00:00 Updated <notifications> to 2.6.0
2020-03-02T19:16:57+00:00 Updating <systemtags> ...
2020-03-02T19:16:57+00:00 Updated <systemtags> to 1.8.0
2020-03-02T19:16:57+00:00 Updating <theming> ...
2020-03-02T19:16:57+00:00 Updated <theming> to 1.9.0
2020-03-02T19:16:57+00:00 Checking for update of app accessibility in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "accessibility" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app activity in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "activity" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app admin_audit in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "admin_audit" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app bruteforcesettings in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "bruteforcesettings" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app calendar in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "calendar" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app camerarawpreviews in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "camerarawpreviews" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app carnet in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "carnet" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app checksum in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "checksum" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app cloud_federation_api in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "cloud_federation_api" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app cms_pico in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "cms_pico" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app comments in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "comments" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app dav in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "dav" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app encryption in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "encryption" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app federatedfilesharing in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "federatedfilesharing" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app federation in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "federation" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_antivirus in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_antivirus" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_external in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_external" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_markdown in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_markdown" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_mindmap in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_mindmap" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_pdfviewer in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_pdfviewer" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_rightclick in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_rightclick" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_sharing in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_sharing" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_trashbin in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_trashbin" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_versions in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_versions" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app files_videoplayer in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "files_videoplayer" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app firstrunwizard in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "firstrunwizard" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app forms in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "forms" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app gpxpod in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "gpxpod" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app logreader in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "logreader" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app lookup_server_connector in appstore
2020-03-02T19:17:02+00:00 Checked for update of app "lookup_server_connector" in appstore
2020-03-02T19:17:02+00:00 Checking for update of app mail in appstore
2020-03-02T19:17:02+00:00 Update app mail from appstore
2020-03-02T19:17:13+00:00 Repair step: Purify and migrate collected mail addresses
2020-03-02T19:17:13+00:00 Purify and migrate collected mail addresses
2020-03-02T19:17:13+00:00
2020-03-02T19:17:13+00:00  Starting ...
    0/0 [>-]   0%2020-03-02T19:17:13+00:00
2020-03-02T19:17:13+00:00 Repair step: Make Mail itinerary extractor executable
2020-03-02T19:17:13+00:00 Repair step: Migrate Mail provisioning config from config.php to the database
2020-03-02T19:17:13+00:00 Repair info: No old config found
2020-03-02T19:17:13+00:00 Repair step: Create or update provisioned Mail accounts
2020-03-02T19:17:13+00:00 Repair info: No Mail provisioning config set
2020-03-02T19:17:13+00:00 Checked for update of app "mail" in appstore
2020-03-02T19:17:13+00:00 Checking for update of app maps in appstore
2020-03-02T19:17:13+00:00 Update app maps from appstore
2020-03-02T19:17:19+00:00 Checked for update of app "maps" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app metadata in appstore
2020-03-02T19:17:19+00:00 Checked for update of app "metadata" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app nextcloud_announcements in appstore
2020-03-02T19:17:19+00:00 Checked for update of app "nextcloud_announcements" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app notes in appstore
2020-03-02T19:17:19+00:00 Checked for update of app "notes" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app notifications in appstore
2020-03-02T19:17:19+00:00 Checked for update of app "notifications" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app oauth2 in appstore
2020-03-02T19:17:19+00:00 Checked for update of app "oauth2" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app password_policy in appstore
2020-03-02T19:17:19+00:00 Checked for update of app "password_policy" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app phonetrack in appstore
2020-03-02T19:17:19+00:00 Checked for update of app "phonetrack" in appstore
2020-03-02T19:17:19+00:00 Checking for update of app polls in appstore
2020-03-02T19:17:19+00:00 Update app polls from appstore
2020-03-02T19:17:22+00:00 Checked for update of app "polls" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app privacy in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "privacy" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app provisioning_api in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "provisioning_api" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app recommendations in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "recommendations" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app registration in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "registration" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app richdocuments in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "richdocuments" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app serverinfo in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "serverinfo" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app settings in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "settings" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app sharebymail in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "sharebymail" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app support in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "support" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app survey_client in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "survey_client" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app systemtags in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "systemtags" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app tasks in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "tasks" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app text in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "text" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app theming in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "theming" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app twofactor_backupcodes in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "twofactor_backupcodes" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app twofactor_totp in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "twofactor_totp" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app updatenotification in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "updatenotification" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app viewer in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "viewer" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app workflowengine in appstore
2020-03-02T19:17:22+00:00 Checked for update of app "workflowengine" in appstore
2020-03-02T19:17:22+00:00 Checking for update of app announcementcenter in appstore
2020-03-02T19:17:22+00:00 Update app announcementcenter from appstore
2020-03-02T19:17:24+00:00 Repair step: Add read permissions for existing announcements
2020-03-02T19:17:24+00:00 Add read permissions for existing announcements
2020-03-02T19:17:24+00:00
2020-03-02T19:17:24+00:00  Starting ...
    0/0 [>-]   0%2020-03-02T19:17:24+00:00
2020-03-02T19:17:24+00:00 Checked for update of app "announcementcenter" in appstore
2020-03-02T19:17:24+00:00 Repair step: Add read permissions for existing announcements
2020-03-02T19:17:24+00:00 Add read permissions for existing announcements
2020-03-02T19:17:24+00:00
2020-03-02T19:17:24+00:00  Starting ...
    0/0 [>-]   0%2020-03-02T19:17:24+00:00
2020-03-02T19:17:24+00:00 Checking for update of app data_request in appstore
2020-03-02T19:17:24+00:00 Update app data_request from appstore
2020-03-02T19:17:27+00:00 Checked for update of app "data_request" in appstore
2020-03-02T19:17:27+00:00 Checking for update of app external in appstore
2020-03-02T19:17:27+00:00 Update app external from appstore
2020-03-02T19:17:29+00:00 Repair step: Copy default images to the app data directory
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Checked for update of app "external" in appstore
2020-03-02T19:17:29+00:00 Repair step: Copy default images to the app data directory
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Repair step: Copy default images to the app data directory
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Repair info: Icon %s already exists
2020-03-02T19:17:29+00:00 Checking for update of app files_snapshots in appstore
2020-03-02T19:17:29+00:00 Checked for update of app "files_snapshots" in appstore
2020-03-02T19:17:29+00:00 Checking for update of app fulltextsearch_elasticsearch in appstore
2020-03-02T19:17:29+00:00 Update app fulltextsearch_elasticsearch from appstore
2020-03-02T19:17:32+00:00 Checked for update of app "fulltextsearch_elasticsearch" in appstore
2020-03-02T19:17:32+00:00 Checking for update of app gallery in appstore
2020-03-02T19:17:32+00:00 Checked for update of app "gallery" in appstore
2020-03-02T19:17:32+00:00 Checking for update of app gpxedit in appstore
2020-03-02T19:17:32+00:00 Update app gpxedit from appstore
2020-03-02T19:17:34+00:00 Checked for update of app "gpxedit" in appstore
2020-03-02T19:17:34+00:00 Checking for update of app quota_warning in appstore
2020-03-02T19:17:34+00:00 Update app quota_warning from appstore
2020-03-02T19:17:36+00:00 Checked for update of app "quota_warning" in appstore
2020-03-02T19:17:36+00:00 Repair step: Add background jobs for existing users
2020-03-02T19:17:36+00:00 Add background jobs for existing users
2020-03-02T19:17:36+00:00
2020-03-02T19:17:36+00:00  Starting ...
    0/0 [>-]   0%2020-03-02T19:17:36+00:00
 Starting ...
    1/0 [->]   0%2020-03-02T19:17:36+00:00
 Starting ...
    2/0 [-->]   0%2020-03-02T19:17:36+00:00
 Starting ...
    3/0 [--->]   0%2020-03-02T19:17:36+00:00
2020-03-02T19:17:36+00:00 Checking for update of app ransomware_protection in appstore
2020-03-02T19:17:36+00:00 Update app ransomware_protection from appstore
2020-03-02T19:17:38+00:00 Checked for update of app "ransomware_protection" in appstore
2020-03-02T19:17:38+00:00 Checking for update of app sharerenamer in appstore
2020-03-02T19:17:38+00:00 Checked for update of app "sharerenamer" in appstore
2020-03-02T19:17:38+00:00 Checking for update of app social in appstore
2020-03-02T19:17:38+00:00 Checked for update of app "social" in appstore
2020-03-02T19:17:38+00:00 Checking for update of app socialsharing_diaspora in appstore
2020-03-02T19:17:38+00:00 Update app socialsharing_diaspora from appstore
2020-03-02T19:17:39+00:00 Checked for update of app "socialsharing_diaspora" in appstore
2020-03-02T19:17:39+00:00 Checking for update of app socialsharing_email in appstore
2020-03-02T19:17:39+00:00 Update app socialsharing_email from appstore
2020-03-02T19:17:41+00:00 Checked for update of app "socialsharing_email" in appstore
2020-03-02T19:17:41+00:00 Checking for update of app socialsharing_twitter in appstore
2020-03-02T19:17:41+00:00 Update app socialsharing_twitter from appstore
2020-03-02T19:17:43+00:00 Checked for update of app "socialsharing_twitter" in appstore
2020-03-02T19:17:43+00:00 Checking for update of app spreed in appstore
2020-03-02T19:17:43+00:00 Update app spreed from appstore
2020-03-02T19:17:46+00:00 Repair error: Repair step 'OCA\Talk\Migration\FixNamespaceInDatabaseTables' is unknown
2020-03-02T19:17:46+00:00 Repair info: No repair steps available
2020-03-02T19:17:46+00:00 Repair error: Repair step 'OCA\Talk\Migration\CreateHelpCommand' is unknown
2020-03-02T19:17:46+00:00 Repair error: Repair step 'OCA\Talk\Migration\ClearResourceAccessCache' is unknown
2020-03-02T19:17:46+00:00 Repair info: No repair steps available
2020-03-02T19:17:46+00:00 Checked for update of app "spreed" in appstore
2020-03-02T19:17:46+00:00 Repair error: Repair step 'OCA\Talk\Migration\FixNamespaceInDatabaseTables' is unknown
2020-03-02T19:17:46+00:00 Repair info: No repair steps available
2020-03-02T19:17:46+00:00 Repair error: Repair step 'OCA\Talk\Migration\CreateHelpCommand' is unknown
2020-03-02T19:17:46+00:00 Repair error: Repair step 'OCA\Talk\Migration\ClearResourceAccessCache' is unknown
2020-03-02T19:17:46+00:00 Repair info: No repair steps available
2020-03-02T19:17:46+00:00 Repair error: Repair step 'OCA\Talk\Migration\CreateHelpCommand' is unknown
2020-03-02T19:17:46+00:00 Repair info: No repair steps available
2020-03-02T19:17:47+00:00 Repair step: Repair MySQL collation
2020-03-02T19:17:47+00:00 Repair info: All tables already have the correct collation -> nothing to do
2020-03-02T19:17:47+00:00 Repair step: Repair mime types
2020-03-02T19:17:47+00:00 Repair step: Clean tags and favorites
2020-03-02T19:17:47+00:00 Repair info: 0 tags of deleted users have been removed.
2020-03-02T19:17:47+00:00 Repair info: 0 tags for delete files have been removed.
2020-03-02T19:17:47+00:00 Repair info: 0 tag entries for deleted tags have been removed.
2020-03-02T19:17:47+00:00 Repair info: 0 tags with no entries have been removed.
2020-03-02T19:17:47+00:00 Repair step: Repair invalid shares
2020-03-02T19:17:47+00:00 Repair step: Move .step file of updater to backup location
2020-03-02T19:17:47+00:00 Repair info: .step file exists
2020-03-02T19:17:47+00:00 Repair info: .step-previous-update removed
2020-03-02T19:17:47+00:00 Repair info: .step file moved to .step-previous-update
2020-03-02T19:17:47+00:00 Repair step: Fix potential broken mount points
2020-03-02T19:17:47+00:00 Repair info: No mounts updated
2020-03-02T19:17:47+00:00 Repair step: Add log rotate job
2020-03-02T19:17:47+00:00 Repair step: Clear frontend caches
2020-03-02T19:17:47+00:00 Repair info: Image cache cleared
2020-03-02T19:17:47+00:00 Repair info: SCSS cache cleared
2020-03-02T19:17:47+00:00 Repair info: JS cache cleared
2020-03-02T19:17:47+00:00 Repair step: Clear every generated avatar on major updates
2020-03-02T19:17:47+00:00 Repair step: Add preview background cleanup job
2020-03-02T19:17:47+00:00 Repair step: Queue a one-time job to cleanup old backups of the updater
2020-03-02T19:17:47+00:00 Repair step: Cleanup invalid photocache files for carddav
2020-03-02T19:17:47+00:00 Repair step: Add background job to cleanup login flow v2 tokens
2020-03-02T19:17:47+00:00 Repair step: Remove potentially over exposing share links
2020-03-02T19:17:47+00:00 Repair info: No need to remove link shares.
2020-03-02T19:17:47+00:00 Repair step: Clear access cache of projects
2020-03-02T19:17:47+00:00 Repair step: Switches from deprecated "production" to "stable" update channel
2020-03-02T19:17:47+00:00 Repair step: Sets the enterprise logo
2020-03-02T19:17:47+00:00 Repair info: Repair step already executed
2020-03-02T19:17:47+00:00 Repair step: Reset generated avatar flag
2020-03-02T19:17:47+00:00 Starting code integrity check...
2020-03-02T19:17:59+00:00 Finished code integrity check
2020-03-02T19:17:59+00:00 Update successful
2020-03-02T19:17:59+00:00 Maintenance mode is kept active
2020-03-02T19:17:59+00:00 Reset log level

Keep maintenance mode active? [y/N] y
Maintenance mode kept active
$ sudo -u www-data php occ maintenance:mode --off
Maintenance mode disabled

アプリも最新にしておきます.

$ sudo -u www-data php ./occ app:update --all

セキュリティ&セットアップ警告を確認します.管理権限ユーザでログインして, index.php/settings/admin/overview にアクセスします.

2つの警告が表示されたので対処します.

Security & Setup warnings

1つ目の警告

データベースにいくつかのインデックスがありません。 大きなテーブルにインデックスを追加すると、自動的に追加されないまでに時間がかかる可能性があるためです。 "occ db:add-missing-indices"を実行することによって、インスタンスが実行し続けている間にそれらの欠けているインデックスを手動で追加することができます。 インデックスが追加されると、それらのテーブルへのクエリは通常はるかに速くなります。
テーブル "oc_calendarobjects_props"のインデックス "calendarobject_calid_index"が見つかりません。
テーブル "oc_schedulingobjects"のインデックス "schedulobj_principuri_index"が見つかりません。

案内の通り occ db:add-missing-indices でokでした.
(メッセージの : 部分は になっているのでコピペする場合は注意)

$ sudo -u www-data php ./occ db:add-missing-indices
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Adding calendarobject_calid_index index to the calendarobjects_props table, this can take some time...
calendarobjects_props table updated successfully.
Check indices of the schedulingobjects table.
Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...
schedulingobjects table updated successfully.

2つ目の警告

データベース内のいくつかの列で、big intへの変換が行われていません。 大きなテーブルでカラムタイプを変更すると時間がかかることがあるため、自動的には変更されませんでした。 'occ db:convert-filecache-bigint'を実行することによって、それらの保留中の変更は手動で適用できます。 この操作は、インスタンスがオフラインの間に行う必要があります。 詳細についてはこれに関するドキュメントページを読んでください。
mounts.storage_id
mounts.root_id
mounts.mount_id

こちらも案内どおりでok

$ sudo -u www-data php ./occ db:convert-filecache-bigint
Following columns will be updated:

* mounts.storage_id
* mounts.root_id
* mounts.mount_id

This can take up to hours, depending on the number of files in your instance!
Continue with the conversion (y/n)? [n] y

セキュリティ&セットアップ警告ページを再読込して警告が消えるのを確認します.

OK

OpenSSHで使えるRSA鍵ペアをOpenSSLで生成する

OpenSSH 7.1/7.1p1でRSA鍵長は最低1024bitになりました.

 * Refusing all RSA keys smaller than 1024 bits (the current minimum
   is 768 bits)

1024bitより短い鍵長の鍵を作ろうとすると怒られます.

$ ssh-keygen -t rsa -b 768
Invalid RSA key length: minimum is 1024 bits

以下のMLで古い機器が1024bitに対応していない場合の相談でOpenSSLでOpenSSHで利用できるRSA鍵ペアが作れるのを知りました.

You can use openssl to generate a shorter key:

	$ openssl genprsa -out key.pem 768
	$ ssh-keygen -y -f key.pem > key.pub # optional to get public key

This works with a 768-bit RSA key (client: OpenSSH_7.2p2, OpenSSL
1.0.2g; server: OpenSSH_7.2p2, OpenSSL 1.0.2g) but not a 256-bit RSA
key: I can generate the shorter key but the server requires a minimum of
768-bits.

使うことがあるかわからないけど手元の環境で試してみました.

opensslでRSA 768の秘密鍵の作成
$ openssl genrsa -out id_rsa768 768
Generating RSA private key, 768 bit long modulus (2 primes)
........+++++++
................................+++++++
e is 65537 (0x010001)
パスフレーズありのRSA 768の秘密鍵の作成
$ openssl genrsa -out id_rsa768 -aes256 768
Generating RSA private key, 768 bit long modulus (2 primes)
..+++++++
..........+++++++
e is 65537 (0x010001)
Enter pass phrase for id_rsa768:
Verifying - Enter pass phrase for id_rsa768:

OpenSSLから書き出された鍵ファイルのパーミッションはumaskに関係なく(0000でも)600になっています :)

秘密鍵の確認
$ openssl rsa -text < id_rsa768

秘密鍵が出来たので続いてペアとなる公開鍵を作ります.
MLの例と同じように ssh-keygen を使うと鍵の長さで怒られます.

$ ssh-keygen -y -f id_rsa768 > id_rsa768.pub
Load key "id_rsa768": Invalid key length

公開鍵もOpenSSLで作ります.

OpenSSL公開鍵を作る
$ openssl rsa -pubout < id_rsa768 > id_rsa768.pub
writing RSA key
公開鍵の確認
$ openssl rsa -text -pubin < id_rsa768.pub
出来上がった鍵ペアでログインを試みると鍵長のせいで認証に失敗
$ ssh -v -i ~/.ssh/id_rsa768 localhost
   :
debug1: Trying private key: /home/matoken/.ssh/id_rsa768
Load key "/home/matoken/.ssh/id_rsa768": Invalid key length

てことで使いみちがなさそうですがメモしておきます.
#今ならed25519使いますしね…….

ちなみに1024bitより長い鍵なら普通に使えてssh-keygenでコメントを書き換えたりパスフレーズを書き換えたりでしました.

RSA 4096の鍵
$ openssl genrsa -out id_rsa4096 -aes256 4096
Generating RSA private key, 4096 bit long modulus (2 primes)
................++++
.....................................................................................................++++
e is 65537 (0x010001)
Enter pass phrase for id_rsa4096:
Verifying - Enter pass phrase for id_rsa4096:
$ ssh-keygen -c -C 'OpenSSL generate key' -f ./id_rsa4096
Enter passphrase:
No existing comment
Comment 'OpenSSL generated key' applied
$ ssh-keygen -p -f ./id_rsa4096
Enter old passphrase:
Key has comment 'OpenSSL generated key'
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.
環境
$ dpkg-query -W openssl openssh-client openssh-server
openssh-client  1:8.1p1-2
openssh-server  1:8.1p1-2
openssl 1.1.1d-2
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

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

Google Chrome / Chromium 79でバックグラウンドタブのリソース消費を減らす Tab Freeze を試す

Google Chrome/Chromium の 79 で Tab Freeze という機能が入ったようです.これはバックグラウンドの利用していないタブを停止してリソース消費を抑えるというもののようです.

似たようなもので The Great Suspender という拡張機能があり,タブをつい開きっぱなしにしてしまう私はこれで大分助かっています.(この拡張機能はタブのCPUだけでなくメモリも開放されます.その代わり復帰に時間がかかります.)

今回の Tab Freeze で似たようなことが標準でできるようになっていそうなので試してみました.

この機能は未だ実験的な機能でDisabled になっているので手動で設定変更する必要があります.

設定の前に The Great Suspender は競合しそうなので一旦削除しておきます.(類似のものを入れている場合はやはり消しておいたほうがいいと思う)

設定変更はアドレスバーに chrome://flags/#proactive-tab-freeze と入力してアクセスした項目で設定変更します.

chrome://flags/#proactive-tab-freeze

いくつか選択項目がでてきます.

Tab Freeze Value

Enabled Freeze - Unfreeze 10 seconds every 15 minutes, だと少しするとChromium が落ちてしまいました.
Enabled, Enabled Freeze - No Unfreeze だと落ちないと思ったのですが, Shift + Esc でタスクマネージャを起動すると落ちてしまいました.

てことで手元の環境では未だ不安定で使えないようでした.残念.またバージョンが上がったら試してみようと思います.

この辺の機能はOperaの省電力機能があって気になっているのですが,中国企業の奇虎360(Qihoo)に買収されてから怖いなと…….

環境
$ dpkg-query -W chromium
chromium        79.0.3945.79-1
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

smbgetのパスワード指定

sambaの速度を測るのにsambaをwgetのように使える smbget を使おうとしたのですが以前使えていた気がする -p オプションが無くなっています.

$ bash -c "read -sp \"passwd: \" passwd; smbget smb://smbhost/share/data -U user -p $passwd -O > /dev/null"
passwd: -p: unknown option

usageを見ると確かにありません.

$ smbget --usage
Usage: smbget [-?aneruRODqv] [-?|--help] [--usage] [-w|--workgroup=STRING] [-U|--user=STRING] [-a|--guest] [-n|--nonprompt] [-d|--debuglevel=INT] [-e|--encrypt]
        [-r|--resume] [-u|--update] [-R|--recursive] [-b|--blocksize=INT] [-o|--outputfile=STRING] [-O|--stdout] [-D|--dots] [-q|--quiet] [-v|--verbose]
        [-f|--rcfile=STRING]

-pを無くせばプロンプトが出てきますが毎回入力するのは面倒なのでどうにか出来ないかなとmanを見てみます.

man smbget
       -U, --user=username[%password]
           Username (and password) to use

-U オプションに一緒に書けるようです.デミリタは要らないよう.

$ bash -c "read -sp \"passwd: \" passwd; smbget smb://smbhost/share/data -U user$passwd -O > /dev/null"

デミリタに : を指定しても動きました.

$ bash -c "read -sp \"passwd: \" passwd; smbget smb://smbhost/share/data -U user:$passwd -O > /dev/null"

他にもSMB URLにも書けるようです.

man smbget
SMB URLS
       SMB URL's should be specified in the following format:

           smb://[[[domain;]user[:password@]]server[/share[/path[/file]]]]

ただし,この書き方だとSMB URLが環境変数が展開されてSTDOUTに表示されるのでパスワードを隠したい場合は使えません.

$ bash -c "read -sp \"passwd: \" passwd; smbget smb://user:$passwd@smbhost/share/data -O > /dev/null"
smb://user:password@smbhost/share/data(100.00%) at 130.69MB/s ETA: 00:00:0008
Downloaded 2.17GB in 17 seconds

それを言うと -U の場合もプロセスにパスワードが表示されてしまうのであまりよろしくないですね.てことでとりあえずこんな感じならいいかな?

$ bash -c "read -sp \"passwd: \" passwd; echo $passwd | smbget smb://smbhost/share/data -U user -O > /dev/null"

このときのプロセス

$ ps -ef|grep smbget
mk       12626 14620  0 22:38 pts/6    00:00:00 bash -c read -sp "passwd: " passwd; echo $passwd | smbget smb://smbhost/share/data -U user -O > /dev/null
mk       13263 12626 49 22:39 pts/6    00:00:00 smbget smb://smbhost/share/data -U user -O

あれ?結局最初に戻って…….

余録(キャッシュクリア)

速度を測りたいけど2回目以降はキャッシュされてしまうのでキャッシュをクリアして測る.
以下はlocalhostで試してるので差が出ているが,ネットワーク経由だとネットワークがボトルネックになり差が出なかった.でも一応やっておく.

1回目
smb://smbhost/share/data(100.00%) at 28.12MB/s ETA: 00:00:00434
Downloaded 2.17GB in 79 seconds
2回目
smb://smbhost/share/data(100.00%) at 130.69MB/s ETA: 00:00:0008
Downloaded 2.17GB in 17 seconds
キャッシュをクリア
$ sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
もう一回
smb://smbhost/share/data(100.00%) at 27.43MB/s ETA: 00:00:0044
Downloaded 2.17GB in 81 seconds

/proc/sys/vm/drop_caches についてはKernel Documentsの admin-guide/sysctl/vm.rst.gz あたりを参照のこと.

$ zgrep ^drop_caches -A42 /usr/share/doc/linux-doc-5.3/Documentation/admin-guide/sysctl/vm.rst.gz

環境

環境1
$ dpkg-query -W samba smbclient bash
bash    4.4.18-2ubuntu1.2
samba   2:4.7.6+dfsg~ubuntu-0ubuntu2.14
smbclient       2:4.7.6+dfsg~ubuntu-0ubuntu2.14
$ lsb_release -dr
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
$ uname -rvm
4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64
環境2
$ dpkg-query -W samba smbclient bash
bash    5.0-5
samba   2:4.11.1+dfsg-3
smbclient       2:4.11.1+dfsg-3
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -rvm
5.3.0-3-amd64 #1 SMP Debian 5.3.15-1 (2019-12-07) x86_64

Microsoft Teams の Linux版を少し試す

Microsoft Teams の Linux版パブリックプレビューが利用できるようになっています.
普段Microsoft Teamsは利用していないのですが少し試してみました.

以下のページより入手できます.amd64のDEB, RPMが用意されています.今回はDebian sid amd64で試しました.
(armhs, arm64 や snap, AppImageなんかがあると便利そう)

容量やhashはこんな感じでした.

$ ls -l ~/Downloads/teams_1.2.00.32451_amd64.deb
-rw-r--r-- 1 matoken matoken 64874490 Dec 11 19:16 /home/matoken/Downloads/teams_1.2.00.32451_amd64.deb
$ sha512sum ~/Downloads/teams_1.2.00.32451_amd64.deb
2e921c0ebd2306b6f61f5ecd448206922394a19339e8c14023aa1778444a649bf4730c71362263e53bb833caed05907203d782221429e853d76695695835e407  /home/matoken/Downloads/teams_1.2.00.32451_amd64.deb
$ sha256sum ~/Downloads/teams_1.2.00.32451_amd64.deb
28d8a0e644a4bb9d4ee9295953b97b7fa6558b8a9d1d28363a594f5cde1c05dc  /home/matoken/Downloads/teams_1.2.00.32451_amd64.deb

こんな感じで導入.

$ sudo dpkg -i ~/Downloads/teams_1.2.00.32451_amd64.deb

導入時の容量は233.5MB程.

$ dpkg-query -s teams|egrep 'Size|Version'
Installed-Size: 233488
Version: 1.2.00.32451

teams コマンドで起動します.

環境変数 LC_ALLja_JP.UTF-8 とかにしておくとログイン画面等は日本語になります.しかしログイン後は英語に.
設定で日本語を選んで再起動で日本語になりました.

プロセスはこんな感じ.Electronぽいですね.

$ ps aux|grep -i teams
matoken 2994658 1.0 1.1 2993376 180704 ? Sl 19:29 0:13 /usr/share/teams/teams
matoken 2994660 0.0 0.2 201364 40000 ? S 19:29 0:00 /usr/share/teams/teams --type=zygote --no-sandbox
matoken 2994722 0.0 0.5 769764 94808 ? Sl 19:29 0:01 /usr/share/teams/teams --type=gpu-process --enable-features=SharedArrayBuffer --disable-features=SpareRendererForSitePerProcess --gpu-preferences=KAAAAAAAAACAAABAAQAAAAAAAAAAAGAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAA --service-request-channel-token=15734132888989265996
matoken 2994776 0.0 0.5 1342416 90296 ? Sl 19:29 0:00 /usr/share/teams/teams --type=renderer --autoplay-policy=no-user-gesture-required --enable-features=SharedArrayBuffer --disable-features=SpareRendererForSitePerProcess --service-pipe-token=18244068696510772569 --lang=ja --app-path=/usr/share/teams/resources/app.asar --user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) MicrosoftTeams-Preview/1.2.00.32451 Chrome/69.0.3497.128 Electron/4.2.12 Safari/537.36 --node-integration=false --webview-tag=false --no-sandbox --preload=/usr/share/teams/resources/app.asar/lib/renderer/notifications/preload_notifications.js --disable-remote-module --background-color=#fff --electron-shared-settings=eyJjci5jb21wYW55IjoiRWxlY3Ryb24iLCJjci5kdW1wcyI6IiIsImNyLmVuYWJsZWQiOmZhbHNlLCJjci5wcm9kdWN0IjoiRWxlY3Ryb24iLCJjci5zZXNzaW9uIjoiIiwiY3IudXJsIjoiIiwiY3IudmVyc2lvbiI6InY0LjIuMTIifQ== --num-raster-threads=2 --enable-main-frame-before-activation --service-request-channel-token=18244068696510772569 --renderer-client-id=7 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101 --msteams-process-type=notificationsManager
matoken 2994835 1.3 2.5 2363516 408984 ? Sl 19:29 0:17 /usr/share/teams/teams --type=renderer --autoplay-policy=no-user-gesture-required --enable-features=SharedArrayBuffer --disable-features=SpareRendererForSitePerProcess --service-pipe-token=15065448036180024072 --lang=ja --app-path=/usr/share/teams/resources/app.asar --user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) MicrosoftTeams-Preview/1.2.00.32451 Chrome/69.0.3497.128 Electron/4.2.12 Safari/537.36 --node-integration=false --webview-tag=true --no-sandbox --preload=/usr/share/teams/resources/app.asar/lib/renderer/preload.js --disable-remote-module --background-color=#fff --electron-shared-settings=eyJjci5jb21wYW55IjoiRWxlY3Ryb24iLCJjci5kdW1wcyI6IiIsImNyLmVuYWJsZWQiOmZhbHNlLCJjci5wcm9kdWN0IjoiRWxlY3Ryb24iLCJjci5zZXNzaW9uIjoiIiwiY3IudXJsIjoiIiwiY3IudmVyc2lvbiI6InY0LjIuMTIifQ== --num-raster-threads=2 --enable-main-frame-before-activation --service-request-channel-token=15065448036180024072 --renderer-client-id=9 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101 --msteams-process-type=mainWindow
matoken 2995068 0.2 0.6 3034988 109684 ? Sl 19:29 0:03 /usr/share/teams/teams --type=renderer --autoplay-policy=no-user-gesture-required --enable-features=SharedArrayBuffer --disable-features=SpareRendererForSitePerProcess --service-pipe-token=5738606405228482904 --lang=ja --app-path=/usr/share/teams/resources/app.asar --user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) MicrosoftTeams-Preview/1.2.00.32451 Chrome/69.0.3497.128 Electron/4.2.12 Safari/537.36 --node-integration=false --webview-tag=false --no-sandbox --preload=/usr/share/teams/resources/app.asar/lib/pluginhost/preload.js --disable-remote-module --background-color=#fff --electron-shared-settings=eyJjci5jb21wYW55IjoiRWxlY3Ryb24iLCJjci5kdW1wcyI6IiIsImNyLmVuYWJsZWQiOmZhbHNlLCJjci5wcm9kdWN0IjoiRWxlY3Ryb24iLCJjci5zZXNzaW9uIjoiIiwiY3IudXJsIjoiIiwiY3IudmVyc2lvbiI6InY0LjIuMTIifQ== --num-raster-threads=2 --enable-main-frame-before-activation --service-request-channel-token=5738606405228482904 --renderer-client-id=14 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101 --msteams-process-type=pluginHost

一人だけの新規作成したばかりのMicrosoft Teams for freeでのRAM使用量はこんな感じ.800MB以上食ってるみたいですね.

$ ps alx | grep teams | grep -v grep | awk '{printf ("%d\t%s\n", $8,$13)}'
145004  /usr/share/teams/teams
19160   /usr/share/teams/teams
67576   /usr/share/teams/teams
56808   /usr/share/teams/teams
487572  /usr/share/teams/teams
62344   /usr/share/teams/teams
$ ps alx | grep teams | grep -v grep | awk '{sum+=$8}END{print sum}'
834392

てことでElectronだと結構リソース食うしブラウザ版とそう変わらないのでブラウザ版でいいかな?

パッケージ削除

$ sudo apt purge teams
環境
$ dpkg-query -W teams
teams   1.2.00.32451
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

Nextcloudのデータディレクトリを移動するメモ

Nextcloudのデータディレクトリは既定値ではNextcloudのすぐ下の data ディレクトリになります.しかしここはウェブサーバのドキュメントルート以下になってしまい設定をミスするとデータディレクトリが一般公開されてしまう可能性があり少し怖いです.
そこでNextcloud導入時に設定ファイルの config/config.phpdatadirectory にウェブサーバドキュメントルートの外にNextcloudデータを設定します.

今回デフォルトのウェブサーバドキュメントルート内のまま運用されているNextcloudがあったのでそれをウェブサーバドキュメントルート外に移動してみました.
ディスクを増設してそちらにデータを移すなどの際にも同じ手順でデータ移行できると思います.

今回の例でのパスはこんな感じです.

  • Nextcloud導入ディレクトリ : /var/www/nextcloud
  • 旧Nextcloud データディレクトリ : /var/www/nextcloud/data
  • 新Nextcloud データディレクトリ : /var/data/nextcloud/data
Important
インストール後のデータディレクトリの移動は公式ではサポートされていません.

ファイルのコピー

同一のファイルシステム間であれば mv commandで一瞬ですが,今回はファイルシステムを跨いでいるので時間がかかります.
ダウンタイムを短くしたいのでNextcloud動作状態で一度データをコピーしてその後rsyncで差分のみコピーすることにします.

1度目のコピー

$ sudo cp -a /var/www/nextcloud/data /var/www/nextcloud/

rsyncでデータ同期

1度目のデータコピーに時間がかかったのでrsyncで同期

$ sudo rsync -avc /var/www/nextcloud/data /var/www/nextcloud/

バックグラウンドジョブを停止(恐らくこの手順は不要)

次の手順でメンテナンスモードに移行するので不要だと思うけど念の為バックグラウンドジョブをcrontabで設定しているのを停止(コメントアウト)しておく.(Webcronの場合も止めたほうがいいかも.AJAXの場合は恐らく不要)

$ sudo -u www-data crontab -e

メンテナンスモードに移行

ここからNextcloudは利用できなくなります.

$ sudo -u www-data php ./occ maintenance:mode --on

データ同期

-c オプションも付けたほうがいいけどデータが大きいと時間がかかるので今回はなしであとでチェックすることにする.

$ sudo rsync -av /var/www/nextcloud/data /var/www/nextcloud/

データベース書き換え

Nextcludのデータベース内のファイルディレクトリ情報を書き換えます.書き換え前に念の為データベースのバックアップも取っておきます.

バックアップ
$ sh -c "umask 266 ; mysqldump -uroot -p --opt --all-databases --events | xz > mysqlbackup-`date +\%F_\%T_\%s_$`.sql.xz"
db書き換え
$ mysql -unextcloud -p
mysql> use nextcloud;
mysql> update oc_storages set id='local::/var/data/nextcloud/data/' where id='local::/var/www/nextcloud/data/';
mysql> quit;

設定ファイル書き換え

Nextcloudの設定ファイルの config/config.php の中の datadirectory を新しいパスに書き換えます.

  'datadirectory' => '/var/data/nextcloud/data',

メンテナンスモードをoffにする

$ sudo -u www-data php ./occ maintenance:mode --off

動作確認

Nextcloudにログインしてファイルディレクトリが閲覧できることを確認する.

バックグラウンドジョブを設定

バックグラウンドジョブをcrontabで再設定

$ sudo -u www-data crontab -e

旧データの削除

しばらく運用して問題ないようなら旧データを削除する.

$ sudo rm -rf /var/www/nextcloud/data

生ディスクなんかだと secure-delete とか使うと少し安心.でも確実じゃないし時間かかるので暗号化fsを推奨.

$ sudo nice -20 ionice -c1 -n0 srm -r /var/www/nextcloud/data

環境

$ sudo -u www-data php ./occ -V
Nextcloud 17.0.1
$ dpkg-query -W php7.2-common mysql-server
mysql-server    5.7.28-0ubuntu0.18.04.4
php7.2-common   7.2.24-0ubuntu0.18.04.1
$ lsb_release -dr
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
$ uname -m
x86_64

Nextcloud upgrade時に`Check for expected files The following extra files have been found: .rnd` と言われて失敗する(15.0.7→16.0.6)

Nextcloud 15.0.7からNextcloud 16.0.6へのアップグレードを行おうとしたところ,アップグレード画面で以下のようなメッセージが表示されて先に勧めません.

Nextcloud upgrade failed 20191125 13:11:17 12878

Check for expected files
The following extra files have been found:
.rnd

Nextcloud 以下を確認すると3つの .rnd ファイルが見つかりました.

$ cd /export/data/var/nextcloud-data
$ find ./ -name .rnd -ls
13495506336      0 drwxr-xr-x   3 www-data www-data       38 Jan 31  2018 ./data/matoken/files_encryption/keys/files/tmp/pizero/home/pi/.rnd
15757999341     12 -rw-r--r--   1 www-data www-data     9656 Jan 31  2018 ./data/matoken/files/tmp/pizero/home/pi/.rnd
11866753713      4 -rw-------   1 www-data www-data     1024 Nov 25 13:19 ./.rnd

以下のページを見ると,Nextcloud 直下の .rnd ファイルが悪さをしているようなのでこれを退避します.

$ sudo mv ./.rnd ~/tmp

この後もう一度アップグレードを試みるとうまく行きました.

This behavior continues up to version 15.0.7.

とのことでぎりぎり引っかかったようです😣

環境
$ sudo -u www-data php ./occ -V
Nextcloud 16.0.6
$ dpkg-query -W php7.2-common mysql-server
mysql-server    5.7.28-0ubuntu0.18.04.4
php7.2-common   7.2.24-0ubuntu0.18.04.1
$ lsb_release -dr
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
$ uname -m
x86_64

Raspberry Pi が起動しなくて困る(未解決・microSD不良?)

先日AmazonでmicroSD cardを購入しました.Samsung ドライブレコーダー向け microSDカード32GB 正規代理店保証品 MB-MJ32GA/ECというものです.

これにRaspberry Pi向けのイメージを書き込んで起動しようとすると,RaspberryPiでLEDがピカッピカー.って感じで2回光って消えます.そしてSerialには以下のメッセージが表示され起動しません.

Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x00000c42, r2=0x00000000
Available machine support:

ID (hex)        NAME
ffffffff        Generic DT based system
ffffffff        BCM2835
Please check your kernel config and/or bootloader.

はじめに試したイメージは自作のものだったのでそのせいかと思ったのですが,Raspbian Buster Lite 2019-09-26 でも同様の動きになります.
ボード側をRaspberry Pi Zero/ZeroW/A+と試しましたがどれでも同じ動作です.

でもmicroSDを交換すると起動します.microSDが怪しそうです.
f3で速度や容量を確認してみました.

容量は問題無さそうなのですが,

最大読み出し速度100MB/s、最大書き込み速度30MB/s

とのことですが実際は読み込み20MB/s前後,書き込み速度は10MB/s前後くらいなので遅すぎる感じがします.
ということでmicroSDが怪しいのでとりあえず返品しようかと思います…….