ようへい

2018年6月6日水曜日

Docker でのエラーあれこれ対処法

主に Docker Toolbox での話です。

no such host

エラー
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host.
原因
ホストが引けていません
対処
DNSを追加します
# echo "nameserver 8.8.8.8" >> /etc/resolv.conf
プロキシの設定が必要な環境なら .bash_profile に設定して再読込するか、環境変数に設定する
# export HTTP_PROXY=http://username:password@host:port
# export HTTPS_PROXY=http://username:password@host:port
curl https://registry-1.docker.io/v2/ とかやって、データ返ってくることを確認する
# curl https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}

request canceled while waiting for connection

エラー
Error response from daemon: Get https://hub.docker.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
対処
docker サービスを再起動したら解消された
# docker login
Username: xxxxx
Password:
Error response from daemon: Get https://hub.docker.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
# /etc/init.d/docker restart
# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: xxxxx
Password:
Login Succeeded

cgroups: cannot find cgroup mount destination: unknown

エラー
docker: Error response from daemon: cgroups: cannot find cgroup mount destination: unknown.
ERRO[0001] error waiting for container: context canceled
対処
# mkdir /sys/fs/cgroup/systemd
# mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
参考
docker: Error response from daemon: cgroups: cannot found cgroup mount destination: unknown. · Issue #1301 · boot2docker/boot2docker · GitHub
https://github.com/boot2docker/boot2docker/issues/1301
関連記事

2018年3月20日火曜日

Visual Studio Code Insiders を更新しようとして dll が見つからなくてエラーになる時の対処

Visual Studio Code Insiders (以下 VS Code Insiders) の更新が通知されたので、更新しようとしたら以下のエラーが表示された。
Visual Studio Code Insiders を更新しようとして dll が見つからなくてエラーになる時の対処
Visual Studio Code Insiders を更新しようとして dll が見つからなくてエラーになる時の対処
コンピューターにapi-ms-win-crt-runtime-l1-1-0.dll がないため、プログラムを開始できません。この問題を解決するにはプログラムを再インストールしてみてください。
どうやら以下のパッケージを入れることで解決できる模様。
Download Visual Studio 2015 の Visual C++ 再頒布可能パッケージ from Official Microsoft Download Center
https://www.microsoft.com/ja-jp/download/details.aspx?id=48145 アーキテクチャにあったインストーラをダウンロード。
vc_redist.x**.exe を実行し、インストール。

インストール後、VS Code Insiders の更新を行うと無事更新できるようになりました。
めでたしめでたし。
関連記事

2017年9月22日金曜日

Firefox 用 Google Play 検索エンジン

Google Play の検索エンジンを Firefox に追加しようと思ったらエラーでダウンロードできなかったので自作。
Google Play 検索エンジン
https://play.google.com/opensearch.xml?hl=ja たたくと 404 返ってくる・・・。

ボタンをクリックする事で検索エンジンを追加することが出来ます。
インストールすると以下のように表示されます。
Firefox 向け 検索エンジン
Google Play (play.google.com) にて日本語を対象とした検索を行います。
Google Play (play.google.com) にて有料アプリでの日本語を対象とした検索を行います。
Google Play (play.google.com) にて無料アプリでの日本語を対象とした検索を行います。
関連記事

2017年9月19日火曜日

カッコいいスライドが作れる! reveal-ck 環境構築 (Windows編)

最近になって、reveal-ck という、Markdown でカッコいいスライドが作れるツールを知った。
GitHub - jedcn/reveal-ck: Create slides with markdown
https://github.com/jedcn/reveal-ck reveal-ck は reveal.js のスライドを簡単に作れるようにしたものらしい。

reveal.js のデモ
reveal.js – The HTML Presentation Framework
http://lab.hakim.se/reveal-js/ ということで早速環境を作ってスライドを作ってみようと思う。

準備するもの

Ruby 2.4
以下からダウンロード
RubyInstaller for Windows - Downloads
https://rubyinstaller.org/downloads/

Ruby インストール

Ruby・MSYS
Ruby のインストーラを起動し、Ruby をインストール。
カッコいいスライドが作れる! reveal-ck 環境構築 (Windows編)
インストーラの最後の画面で ridk で MSYS インストールするか みたいなチェックボックスが出てくるのでチェックがついていることを確認して Finish
 _____       _           _____           _        _ _         ___
|  __ \     | |         |_   _|         | |      | | |       |__ \
| |__) |   _| |__  _   _  | |  _ __  ___| |_ __ _| | | ___ _ __ ) |
|  _  / | | | '_ \| | | | | | | '_ \/ __| __/ _` | | |/ _ \ '__/ /
| | \ \ |_| | |_) | |_| |_| |_| | | \__ \ || (_| | | |  __/ | / /_
|_|  \_\__,_|_.__/ \__, |_____|_| |_|___/\__\__,_|_|_|\___|_||____|
                    __/ |           _
                   |___/          _|_ _  __   | | o __  _| _     _
                                   | (_) |    |^| | | |(_|(_)\^/_>

   1 - MSYS2 base installation
   2 - MSYS2 system update
   3 - MSYS2 and MINGW development toolchain

Which components shall be installed? If unsure press ENTER [1,2,3]
と表示されるので、1 → 2 → 3 の順で実行
うっかり画面を閉じてしまったりした場合は
> C:\Ruby24-x64\bin\ridk install
のような感じで ridk を起動すれば良い。
Ruby 環境設定
gem のドキュメントをインストールしたくない場合は以下のファイルを作成。
(私は今まで必要になったことはないです)

%USERPROFILE%\.gemrc
install: --no-document
update: --no-document
MSYS 環境設定
MSYS で Ruby に PATH を通すため以下を設定

C:\msys64\home\<ユーザ名>\.bash_profile
PATH="/c/Ruby24-x64/bin:${PATH}"

reveal-ck インストール

MSYS を実行し、一応 .bash_profile 再読み込み。
$ source ~/.bash_profile
reveal-ck インストール
$ gem install reveal-ck
依存関係を解決しながらズラズラとインストールされます。

試す

さっそく reveal-ck を試します
インストールディレクトリで slides.md を作成
## Hello World!
:smile:

***

### vertical 1

---

### vertical 2

***

### horizontal 1

---

### horizontal 2
以下のコマンドで generate してスライドのデータを作成します
$ reveal-ck generate
以下のコマンドで、slides.md の変更を監視し、ライブリロード(リアルタイムでブラウザで表示)させることができます。
$ reveal-ck serve
面倒なので以下のようなバッチを作っておくと楽
set PATH=C:\Ruby24-x64\bin;%PATH%
reveal-ck generate
set PATH=C:\Ruby24-x64\bin;%PATH%
"%PROGRAMFILES(X86)%\Google\Chrome\Application\chrome.exe" http://localhost:10000
reveal-ck serve

トラブル

reveal-ck serve でエラーが表示される
こんなエラー
[ reveal-ck ] Getting Ready to Reload Browsers.
[ reveal-ck ] Getting Ready to Rebuild Slides.
  Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
[ reveal-ck ] Starting Webserver.
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
[   reload  ] Run 'gem install win32console' to use color on Windows
[   reload  ] Could not load 'guard/livereload' or find class Guard::Livereload
[   reload  ] Error is: cannot load such file -- 2.4/rubyeventmachine
[   reload  ] C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
> [#] C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
見た感じ、いくつか gem が足りてなさそう。
wdm と eventmachine を入れる
$ gem install wdm eventmachine
再実行
[ reveal-ck ] Starting Webserver.
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
[   reload  ] Run 'gem install win32console' to use color on Windows
[   reload  ] Could not load 'guard/livereload' or find class Guard::Livereload
[   reload  ] Error is: cannot load such file -- 2.4/rubyeventmachine
[   reload  ] C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
> [#] C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
またエラー
win32console が足りないらしい。
Could not load 'guard/livereload' or find class Guard::Livereload は eventmachine が 1.0.9.1 より新しいバージョンを使用すると発生するらしい。
$ gem install win32console
$ gem install eventmachine --version 1.0.9.1
$ gem uninstall eventmachine

Select gem to uninstall:
 1. eventmachine-1.0.9.1
 2. eventmachine-1.2.5-x64-mingw32
 3. All versions
> 2
Successfully uninstalled eventmachine-1.2.5-x64-mingw32
無事エラーが出なくなりました。
Gemfile つくるなら
source "https://rubygems.org"

gem 'wdm'
gem 'eventmachine', '1.0.9.1'
gem 'reveal-ck'
gem 'win32console'
みたいなの作って bundle install してもいい
スライドが1ページしか作られない
slides.md の改行コードが CRLF だとスライドが正常に作られません
LF で保存しなおすと、ちゃんと生成されるはず
関連記事

2014年6月24日火曜日

Nexus 7(2012) を KOT49H(4.4.2) から KTU84L(4.4.3) にアップデートした時のroot再取得メモ

Nexus 7(2012) を KOT49H(4.4.2) から KTU84L(4.4.3) にアップデートした時のroot再取得メモ
Nexus 7 (2012)をKOT49H から KTU84L にした際に rooted から unroot な環境になってしまったので、メモ。

再びrootを取る準備

まずは、OEM Unlockが済んでいること。まぁ、もともとrootが取れていた環境なら問題ないはず。
あとは、以下のファイルを準備。
SuperSU
http://forum.xda-developers.com/showthread.php?t=1538053f
TWRP
TWRP 2 - Nexus 7 page
いずれも最新版をダウンロードする。 SuperSUはダウンロード後、Nexusの内部ストレージにコピーしておく。
TWRPは、C:\TEMPなどに置く。
以下の手順では、C:\TEMPに置いたことを想定して進める。

root取得作業

  1. 電源が切れた状態で、電源ボタンとボリュームダウンボタンを押しながら起動し、bootloaderモードにする。
  2. bootloaderモードの状態でPCと接続
  3. カスタムリカバリ導入
    > fastboot flash recovery C:\TEMP\openrecovery-twrp-2.7.1.1-grouper.img
    sending 'recovery' (8502 KB)...
    OKAY [  1.020s]
    writing 'recovery'...
    OKAY [  0.613s]
    finished. total time: 1.633s
  4. リブートし、bootloaderモードへ
    > fastboot reboot-bootloader
    rebooting into bootloader...
    OKAY [  0.020s]
    finished. total time: 0.020s
  5. Recovery modeを選択しTWRPを起動
  6. TWRPでinstallを選択し、SuperSUのインストール
  7. Reboot SystemでNexus 7をリブート
  8. Titanium Backupなどが起動することを確認
以上

まぁ、コレまでと一緒の手順ですね。
2012年モデル、USBアダプタがガバガバになってきた・・・。Nexus タブレットの2014年版リリースされたら買い換えよう。
関連記事