etsuxのブログ

自分がハマったことなどを記録しています。

TeraTermからTermuxのsshdに接続できない→TeraTermは諦め、sshコマンドかRLoginを使用する

Termuxにsshdをインストールして、TeraTermで接続しようとしても認証に失敗してしまう。

ssh-keygenで-m PEMのありなしのどちらの鍵ファイルでもダメ。

 

logcatで見ると、以下のエラーが記録されている。

09-25 22:03:19.576 20958 20958 I sshd  : userauth_pubkey: signature algorithm ssh-rsa not in PubkeyAcceptedAlgorithms

 

これってSHA-1廃止がらみ?

~ $ pkg show openssh
Package: openssh
Version: 9.0p1-2
Maintainer: @termux

 

他のSSHクライアントで試したところではPoderosaもエラーとなる。

WindowssshかRLoginなら接続可能。

  • TeraTerm → エラー(認証に失敗しました)
  • C:\Windows\system32\OpenSSH\ssh.exe → 問題なし
  • RLogin → 問題なし
  • Poderosa → エラー(The negotitation of host key verification algorithm is failed)

 

キャプチャボードでの録画は思ったより簡単で確実

 

普通に画像も音声も録画できてる夢を見た。

①AirPlayでミラーリング

②fireTVをキャプチャボードに挿す

③HDDに録画

NAS機能付きルーターにHDDを差し替え

VLCなどでストリーミング再生

iPadのところは一例。何でもよい。

※ミーティング(Zoomとか)の内部音声もちゃんと出てる。

※機器もアプリも無料ではないがコストに見合ってる。(個人の感想)

 

www.amazon.co.jp

Wiki.jsをWindows環境にインストール(MySQL利用)

Wiki.jsをWindows環境にインストールしてみた。

  1. node.jsをインストールする。

    Node.js からパッケージ(推奨版)をダウンロードしてインストールする。

  2. MySQLをインストールする。

    MySQL :: MySQL 5.6 リファレンスマニュアル :: 2.3 Microsoft Windows に MySQL をインストールする を参照しながらインストールする。

  3. Wiki.jsをインストールする。

    Windows | Wiki.js を参照しながらインストールする。PowerShellを使用する。

  4. MySQLへの接続設定を行う。
    インストールディレクトリ直下の「config.yml」を開いてMySQLへの接続設定を行う。データベース、ユーザ、パスワードはデフォルトのままにしてみた。
    db:
      type: mysql
    
      # PostgreSQL / MySQL / MariaDB / MS SQL Server only:
      host: localhost
      port: 3306
      user: wikijs
      pass: wikijsrocks
      db: wiki
      ssl: false
    
  5. MySQLでデータベースとユーザを作成する。
    mysqlコマンドから接続し、「config.yml」の設定内容にしたがってコマンドを実行。
    create database wiki;
    create user wikijs identified by 'wikijsrocks';
    grant all on wiki.* to wikijs;
    
  6. npmで必要なパッケージをインストールする。
    実際には「node server」で起動してみては「Cannot find module」エラーとなったらパッケージをインストールを繰り返した。
    npm install lodash
    npm audit fix
    npm install chalk
    npm install bluebird
    npm install knex
    npm install fs-extra
    npm install semver
    npm install moment
    npm install ms
    npm install jsonwebtoken
    npm install he
    npm install uuid
    npm install body-parser
    npm install express
    npm install apollo-server-express
    npm install graphql
    npm install cors
    npm install graphql-subscriptions
    npm install request
    npm install markdown-it
    
  7. 起動する。
    node server
    
  8. Wiki.jsにアクセスする。
    localhostにデフォルトのポート3000で接続。
    管理者ユーザを登録。
  9. ロケールを日本語に変更する。
    1. ホームページの作成
    2. Markdownを選択
    3. ページ名を変更せずにOK
    4. 右上の歯車ボタンをクリック
    5. ページを離れる(ページは保存されない)
    6. 左サイドバーのLocalesをクリック
    7. 右のペインの一覧で日本語のダウンロードマークをクリック
    8. インストールできたらLocalesから日本語を選択

これで使用できるようになった。

TermuxからMariaDBインストール、ERROR 1698 (28000): Access denied for user 'root'@'localhost'エラー(解決)

Railsに続いて以前書いた記事を参考にMariaDB(MySQL)のインストール。

TermuxでMariaDB(MySQL)をインストール/セットアップ - etsuxのブログ

なんとなく様子が違う。

$ pkg install mariadb
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  mariadb
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.2 MB of archives.
After this operation, 179 MB of additional disk space will be used.
Get:1 https://dl.bintray.com/termux/termux-packages-24 stable/main aarch64 mariadb aarch64 1:10.4.6-2 [17.2 MB]
Fetched 17.2 MB in 5s (3328 kB/s)
Selecting previously unselected package mariadb.
(Reading database ... 12072 files and directories currently installed.)
Preparing to unpack .../mariadb_1%3a10.4.6-2_aarch64.deb ...
Unpacking mariadb (1:10.4.6-2) ...
Setting up mariadb (1:10.4.6-2) ...
Initializing mysql data directory...
Installing MariaDB/MySQL system tables in '/data/data/com.termux/files/usr/var/lib/mysql' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is u0_a104@localhost, it has no password either, but
you need to be the system 'u0_a104' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/data/data/com.termux/files/usr' ; /data/data/com.termux/files/usr/bin/mysqld_safe --datadir='/data/data/com.termux/files/usr/var/lib/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/data/data/com.termux/files/usr/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

 

このまま続けて、初期化、rootログインをしてみる。

$ mysql_install_db
mysql.user table already exists!
Run mysql_upgrade, not mysql_install_db
$ mysql -u root
ERROR 1698 (28000): Access denied for user 'root'@'localhost

 

初期化ができないのは、インストール中に初期化されているため(青いところ)。

rootでログインできないのはsudoが必要なため(紫のところ)。

さらにOSのログインユーザが作成済(緑のところ)。

ERROR 1698はMariaDBUnix_Socketが採用されたことによるもの。

MariaDB 10.4.1〜のユーザー認証がカオスな話(Unix_Socket) | GIZMELER

 

mysql_install_dbはインストール時に終わっているので不要。

sudoによるrootログインでなくてもOSにログインしているu0_a104ユーザが追加されているので、OSユーザでログインすればいいだけ。OSユーザでログインするときは、-uオプションは不要。Rails用のユーザを作っておいた。

$ mysql
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [(none)]> select user();
+-------------------+
| user()            |
+-------------------+
| u0_a104@localhost |
+-------------------+
1 row in set (0.001 sec)
MariaDB [mysql]> create user 'rails-user'@'localhost' identified by 'rails-passwd';
Query OK, 0 rows affected (0.007 sec)

MariaDB [mysql]> grant all on *.* to 'rails-user'@'localhost';
Query OK, 0 rows affected (0.006 sec)

MariaDB [mysql]> \q
Bye

 

TermuxからRailsインストール、そしてnokogiriとsasscでエラー(解決)

TermuxでのRailsインストールの手順をまとめてみた。

試行錯誤でやっていたので、まっさらな状態でできるかがあやしいが、以下でインストールできると思う。本当は一発でrails newしたかったが無理そう。なお、MySQLを使用しない場合は「-d mysql」を外す。SQLiteを使わなければpkgから「sqlite libsqlite」を外す。

pkg update
pkg install ruby clang make pkg-config libxslt sqlite libsqlite zlib libiconv libxml2 git wget nodejs yarn python2 binutils
gem install nokogiri -- --use-system-libraries
gem install sassc -- --disable-march-tune-native
gem install rails
wget https://github.com/termux/termux-packages/files/2912002/fix-ruby-bigdecimal.sh.txt
bash fix-ruby-bigdecimal.sh.txt
gem install spring
gem install tzinfo-data
rails new ./HogeHoge -d mysql
# Gemfileの問題で必ず「TZInfo::DataSourceNotFound: tzinfo-data is not present.」で停止。
cd HogeHoge
vi Gemfile
# Gemfileの「gem 'tzinfo-data'」の後ろのplatformsを削除。行削除ではダメ。
bundle update
cd ..
yes n | rails new ./HogeHoge -d mysql

Gemini PDAを初期化して、以前書いた記事を参考にまたもやTermuxからRailsをインストール。

Rooted AndroidにTermuxを入れてRailsをインストール - etsuxのブログ

nokogiriのエラー

そしてnokogiriでエラー。単品でgemしてみてももちろんエラー。

$ gem install nokogiri
Building native extensions. This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

    current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.8/ext/nokogiri
/data/data/com.termux/files/usr/bin/ruby -I /data/data/com.termux/files/usr/lib/ruby/2.6.0 -r ./siteconf20200215-5692-1lambql.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.10
with the following patches applied:
        - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
        - 0002-Remove-script-macro-support.patch
        - 0003-Update-entities-to-remove-handling-of-ssi.patch
        - 0004-libxml2.la-is-in-top_builddir.patch
        - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.10.tar.gz into tmp/aarch64-linux-android/ports/libxml2/2.9.10... ERROR, review '/data/data/com.termux/files/usr/lib/ruby/gems/2.6.0/gems/
nokogiri-1.10.8/ext/nokogiri/tmp/aarch64-linux-android/ports/libxml2/2.9.10/extract.log' to see what happened. Last lines are:
========================================================================
tar: libxml2-2.9.10/test/relaxng/ambig_name-class2.rng: Cannot hard link to ‘libxml2-2.9.10/test/relaxng/ambig_name-class.xml’: Permission denied
tar: libxml2-2.9.10/test/relaxng/ambig_name-class.rng: Cannot hard link to ‘libxml2-2.9.10/test/relaxng/tutorA.rng’: Permission denied
tar: Exiting with failure status due to previous errors
========================================================================
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

いろいろなサイトでいろいろなことが載っていて、いろいろ試してもダメだった。

nokogiriのエラーの解決方法

仕方なく、鋸のサイトを見てみると...あ~載っている。

Installing Nokogiri - Nokogiri

TermUX
Although TermUX isn't fully supported right now, some people have reported success getting Nokogiri installed on it by running these commands:

これに従ってコマンドを打つ。

$ pkg install ruby clang make pkg-config libxslt
:
clang is already the newest version (9.0.1).
make is already the newest version (4.3-1).
ruby is already the newest version (2.6.5).
The following additional packages will be installed:
  glib
The following NEW packages will be installed:
  glib libxslt pkg-config
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1348 kB of archives.
After this operation, 8208 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
:
$ gem install nokogiri -- --use-system-libraries
Building native extensions with: '--use-system-libraries'
This could take a while...
Successfully installed nokogiri-1.10.8
Parsing documentation for nokogiri-1.10.8
Installing ri documentation for nokogiri-1.10.8
Done installing documentation for nokogiri after 89 seconds
1 gem installed

本家を見に行かず、すみません。

sasscのエラー

次はsasscのエラー。ARMのclangでは'-march=native'がサポートされていない?

ちなみに実際には「rails new」で作成しようとした際にエラーとなった。

$ gem install sassc
Building native extensions. This could take a while...
ERROR:  Error installing sassc:
        ERROR: Failed to build gem native extension.

    current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
/data/data/com.termux/files/usr/bin/ruby -I /data/data/com.termux/files/usr/lib/ruby/2.6.0 -r ./siteconf20200215-11591-1ve0vft.rb extconf.rb
creating Makefile

current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR=" clean

current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
clang-9: error: the clang compiler does not support '-march=native'
make: *** [Makefile:237: ast.o] Error 1

make failed, exit code 2

extconf.rbの中身を見ると、march-tune-nativeをfalseにすれば出力されないことがわかる。

# Set to false when building binary gems
if enable_config('march-tune-native', true)
  $CFLAGS << ' -march=native -mtune=native'
  $CXXFLAGS << ' -march=native -mtune=native'
end

sasscのエラーの解決方法

「--disable-march-tune-native」をつけてgemしてみたところ正常終了。

$ gem install sassc -- --disable-march-tune-native
Building native extensions with: '--disable-march-tune-native'
This could take a while...
Successfully installed sassc-2.2.1
Parsing documentation for sassc-2.2.1
Installing ri documentation for sassc-2.2.1
Done installing documentation for sassc after 70 seconds
1 gem installed

別のエラーで、stripコマンドがないと言われることがある。その場合はbinutilsパッケージをインストールする。

make: strip: No such file or directory 

railsをインストール

$ gem install rails
:
Done installing documentation for crass, loofah, rails-html-sanitizer, rails-dom-testing, builder, erubi, actionview, actionpack, activemodel, activerecord, globalid, activejob, mini_mime, mail, actionmailer, nio4r, websocket-extensions, websocket-driver, actioncable, mimemagic, marcel, activestorage, actionmailbox, actiontext, thor, method_source, railties, sprockets, sprockets-rails, rails after 660 seconds
30 gems installed

rails newしてみる

順に解決を試みていく。

$ rails new ./HogeHoge -d mysql
:
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
:
clang-9: error: the clang compiler does not support '-march=native' → (1)解決
:
run  bundle exec spring binstub --all
bundler: command not found: spring → (2)解決
LoadError: dlopen failed: cannot locate symbol "rmpd_util_str_to_d" referenced by "/data/data/com.termux/files/usr/lib/ruby/2.6.0/aarch64-linux-android/bigdecim
al/util.so"... - /data/data/com.termux/files/usr/lib/ruby/2.6.0/aarch64-linux-android/bigdecimal/util.so → (3)解決
rails  webpacker:install
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/ → (4)解決
rails aborted!
TZInfo::DataSourceNotFound: tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install → (5)解決
/data/data/com.termux/files/home/rails/HogeHoge/config/environment.rb:5:in `
' :
  • (1)は上記に対処を記載済。
  • (2)はGemfileの「group :development」のみに「gem 'spring'」があるから?system側に入れてしまえばエラーにはならないけど。
    $ gem install spring
    Successfully installed spring-2.1.0
    Parsing documentation for spring-2.1.0
    Installing ri documentation for spring-2.1.0
    Done installing documentation for spring after 2 seconds
    1 gem installed
    $ cd HogeHoge/
    $ bundle exec spring binstub --all
    * bin/rake: Spring inserted
    * bin/rails: Spring inserted
    
  • (3)は以前の記事で書いていた。

    rails db:migrateのエラー(rmpd_util_str_to_dとlibexslt.so) - etsuxのブログ

  • (4)はnodejsとその依存のyarnの不足。
    pkg install nodejs yarn
  • (5)はGemfileの'tzinfo-data'のplatformsを削除。
    # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
    gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
    
    ちなみに、platformは"aarch64-linux-android"だけど、platformsには指定できない。
    $ ruby -e "p RUBY_PLATFORM"
    "aarch64-linux-android"
    

rails webpacker:installのエラーは未調査

rails webpacker:installでエラーが出ているけど、python2がないことが原因。

[4/4] Building fresh packages...
[-/2] ? waiting...
error /data/data/com.termux/files/home/rails/HogeHoge/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: /data/data/com.termux/files/home/rails/HogeHoge/node_modules/node-sass
Output:
Building: /data/data/com.termux/files/usr/bin/node /data/data/com.termux/files/home/rails/HogeHoge/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --lib
sass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
:
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2

python2をインストールしたが、以下のシンボル未解決が大量に出力されている。実行にも時間がかかるし。webpackerってプロジェクトごとにinstallされるものなの?

/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: Release/obj.target/src/sass.a(base64vlq.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `
_ZN4Sass9Base64VLQ10CHARACTERSE' which may bind externally can not be used when making a shared object; recompile with -fPIC
Release/obj.target/src/sass.a(base64vlq.o): in function `Sass::Base64VLQ::base64_encode(int) const':
base64vlq.cpp:(.text+0xa8): dangerous relocation: unsupported relocation
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [binding.target.mk:152: Release/obj.target/binding.node] Error 1
make: Leaving directory '/data/data/com.termux/files/home/rails/HogeHoge/node_modules/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2

 

macOS Catalinaのフルサイズダウンロードができた

以下の記事でCatalinaはミニインストーラしかダウンロードできないと書いたが、さっきやってみたらフルサイズでダウンロードできた。

macOS CatalinaのISOイメージを作成する - etsuxのブログ

前回と違うのは、MojaveではなくCatalinaでダウンロードしたことと、10.15.2が出たことくらいかな?単にダウンロードできるようになっただけだと思うけど。

念のため、ダウンロードの手順は以下のとおり。

  1. AppStoreでCatalinaを検索。
    f:id:etsux:20200105214842p:plain
  2. [入手]ボタンを押す。→[ダウンロード]ボタンを押す。
    f:id:etsux:20200105215029p:plain
  3. サイズは8.18GBなのでフルサイズ。
    f:id:etsux:20200105215148p:plain
  4. ダウンロードが終わったら、インストーラを終了する。
    f:id:etsux:20200105215305p:plain

ダウンロードしたインストーラは「/Application/Install macOS Catalina.app」にあるので、いつもどおり以下のコマンドでISOイメージが作成できる。

hdiutil create -o /tmp/catalina -size 8G -layout SPUD -fs HFS+J -type SPARSE
hdiutil attach /tmp/catalina.sparseimage -noverify -mountpoint /Volumes/installer
sudo /Applications/Install\ macOS\ Catalina/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/installer
hdiutil detach /Volumes/Install\ macOS\ Catalina/
hdiutil convert /tmp/catalina.sparseimage -format UDTO -o /tmp/catalina.iso
mv /tmp/catalina.iso.cdr catalina.iso
rm /tmp/catalina.sparseimage