Debian 10 Buster testing をリリース後に apt update するとエラーになる

2019-07-06 に Debian Buster 10 がリリースされました.

Debian 10 Buster testing 環境でリリース後に apt update をするとエラーになってしまいます.

$ sudo apt update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [39.1 kB]
Get:2 http://deb.debian.org/debian buster InRelease [118 kB]
N: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Version' value from '' to '10'
E: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'testing' to 'stable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
Do you want to accept these changes and continue updating from this repository? [y/N]
N: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Version' value from '' to '10.0'
E: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Suite' value from 'testing' to 'stable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
Do you want to accept these changes and continue updating from this repository? [y/N]
Reading package lists... Done
E: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease
E: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead.

--allow-releaseinfo-change を指定してAPT にリリースを情報を確認したことを教えます.

$ sudo apt --allow-releaseinfo-change update

次からはオプション無しで実行してもエラーが出なくなります.

$ sudo apt update
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.

ちなみに stable でなく testing 環境を使い続けたい場合は /etc/apt/sources.list を現在の Debian testing の bullseye に修正すればいいはず.

環境
$ dpkg-query -W apt
apt     1.8.2
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Debian GNU/Linux 10 (buster)
      Architecture: x86-64

physlock で Linux をロックする

Debian で vlock を検索したときに一緒に出てくる physlock というものが気になったので試してみました.

$ apt-cache search vlock
physlock - lightweight Linux console locking tool
vlock - Virtual Console locking program
$ apt show physlock
Package: physlock
Version: 13-1
Priority: optional
Section: utils
Maintainer: Michael Prokop <mika@debian.org>
Installed-Size: 42.0 kB
Depends: libc6 (>= 2.14), libpam0g (>= 0.99.7.1), libsystemd0
Homepage: https://github.com/muennich/physlock
Download-Size: 11.6 kB
APT-Manual-Installed: yes
APT-Sources: http://ftp.jp.debian.org/debian sid/main amd64 Packages
Description: lightweight Linux console locking tool
 physlock is an alternative to vlock, it is equivalent to
 `vlock -an'. It is written because vlock blocks some Linux
 kernel mechanisms like hibernate and suspend and can therefore
 only be used with some limitations. physlock is designed to be
 more lightweight and it does not have a plugin interface.

N: There is 1 additional record. Please use the '-a' switch to see it

vlock だとコンソール全部ロックは出来るけど仮想コンソール全部ロックとかは出来ないのですが,physlock はX の端末で起動してもX も使えなくなるし,console への移動も出来ないです.
-s で sysrq の無効化も出来て,-m でkernel message の抑制も出来ます.(何らかの理由でphyslock を解除できないって場合はsshdが起動していればリモートログインは出来るのでkillすればok)

$ physlock -s -m -p "lock!"

今はX では xscreensaver を使ってるけどこれはスクリーンセーバー起動中でもコンソールに移動して利用できちゃうのでphyslock に切り替えるのも良いかもしれません.

気になるのはスクリーンセーバーでは電源管理して一定以上の時間が経つと画面をスリープするなどをやっているのですが,physlock ではそういった機能がありません.

physlock 起動後にスクリーンセーバーを起動するのも試してみましたがうまく行きませんでした.

60秒後にスクリーンセーバーを起動するようにしておいてphyslockを起動(NG)
$ sleep 60 && xscreensaver-command -activate &
$ physlock
60秒後に画面をスタンバイするようにしておいてphyslockを起動(NG)
$ sleep 60 && xset dpms force standby &
$ physlock

physlock のGitHub を覗くとphyslock 実行前後に任意のコマンドを実行できるというPR がありました.これを使えばどうだろうと試してみました.

環境を整えてsourceを入手してPR のpatch を当ててbuild
$ sudo apt-get build-dep physlock
$ git clone https://github.com/muennich/physlock
$ cd physlock
$ wget https://github.com/muennich/physlock/pull/79.patch
$ patch -p1 < ./79.patch
$ make
$ sudo chown root.root ./physlock
$ sudo chmod u+s ./physlock
$ ./physlock -h
usage: physlock [-dhLlmsbanv] [-p MSG]
-b, -a, -n のオプションが増えている
$ git diff README.md
diff --git a/README.md b/README.md
index bc25ca3..563e734 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,9 @@ The following command-line arguments are supported:
     -l       only lock console switching
     -L       only enable console switching
     -m       mute kernel messages on console while physlock is running
+    -b CMD   execute CMD before the password prompt
+    -a CMD   execute CMD after successfully authenticating
+    -n       don't actually authenticate: just execute commands
     -p MSG   Display MSG before the password prompt
     -s       disable sysrq key while physlock is running
     -v       print version information and exit

しかしこれもうまく行きませんでした.画面は書き換えできなくなってるみたいです.

physlock の前にスクリーンセーバーを起動(NG)
$ ./physlock -b 'xscreensaver-command -demo 8'
physlock の前に画面をスリープ(NG)
$ ./physlock -b 'xset dpms force standby'

近いところでコンピュータ自体をサスペンドはOKでした.持ち運びPCなんかではいい感じかもしれません.

physlock の前にサスペンド
$ ./physlock -b 'systemctl suspend'
-b オプションのないパッケージ版でも同じようなことは可能
$ systemctl suspend && physlock

画面のスリープだけでもできれば嬉しいんですがこの辺はトレードオフになるのかな?

<ADD 2019-07-10>
Ubuntu 18.04 LTS ARM64 環境でpackage から導入した physlock では physlock: /dev/console: VT_GETSTATE: Inappropriate ioctl for device というエラーで動きませんでした.

$ physlock
physlock: /dev/console: VT_GETSTATE: Inappropriate ioctl for device
$ dpkg-query -W physlock
physlock        11-1
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Ubuntu 18.04.2 LTS
      Architecture: arm64

以下のバグのようです.

commit 4f131cc2c8c05279886464d3093dd56b1331e98d で修正されている(release だと12)ようなので,source から導入してみると動作しました.

$ sudo apt-get build-dep physlock
$ sudo apt install lib
$ git clone https://github.com/muennich/physlock
$ cd physlock
$ make
$ sudo make install
$ /usr/local/bin/physlock -v
physlock v13

</ADD>

環境
$ git log -1
commit d4091fe3396f6c63e42ea165797062f6032779eb (HEAD -> master, tag: v13, origin/master, origin/HEAD)
Author: Bert Münnich <ber.t@posteo.de>
Date:   Mon Jan 28 19:46:20 2019 +0100

    Stable version 13
$ dpkg-query -W physlock xscreensaver xorg x11-xserver-utils git git-hub
git     1:2.20.1-2
git-hub 1.0.1-1
physlock        13-1
x11-xserver-utils       7.7+8
xorg    1:7.7+19
xscreensaver    5.42+dfsg1-1
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Ubuntu Eoan Ermine (development branch)
  Architecture: x86-64

ThinkPad T430s の BIOS を USB メモリ経由でアップデートする

以前ジャンクで入手したThinkPad T430s ですが,外部キーボードを使ったり,壊れたX220 の部品を使ったりで現在メインマシンとして利用しています.
今NVIDIA Optimus が利用できないかと試していますが,うまく行っていません.BIOS Update で治ったという事例を見つけたのでUpdate しました.Update イメージはCD に書き込んでそこから起動しないといけませんが,USBメモリでもうまく行ったのでメモを残しておきます.

※失敗するとマシンが動かなくなる可能性があります.

まずはBIOS のversion を確認します.date が2012年とかなので古そう.

現在のBIOS version 確認
$ sudo dmidecode -t bios|grep -E "Version:|Release Date:"
		Version: G7ET60WW (2.02 )
		Release Date: 09/11/2012
$ sudo lshw | grep "\-firmware" -A10|grep -E "version|date"
		  version: G7ET60WW (2.02 )
		  date: 09/11/2012

Lenovo のページでBIOSを確認すると, 26 Jun 2019 の Version 2.75 というものが最新のようです.
Windows用の実行ファイルと,起動CD用のisoファイル,それとそれぞれのリリースレターが用意されています.Linux マシンなのでisoファイルの方を入手します.

ダウンロードしたら,チェックサムを確認します.

webpage より

Checksum Tips

MD5:aa9846fb15114ef18770cc0812188418

SHA1:ace55c1a1fa87f3ca5140ef67d565ff9f863020a

SHA-256:623dc5d0442b3b0e105186901dc403c911717d4f7998223593b93e66afdbcd93

sha256sum で確認
$ sha256sum ~/Downloads/g7uj28us.iso
623dc5d0442b3b0e105186901dc403c911717d4f7998223593b93e66afdbcd93  /home/matoken/Downloads/g7uj28us.iso
isoinfo で少し中を覗く
$ isoinfo -d  -i ./g7uj28us.iso
CD-ROM is in ISO 9660 format
System id:
Volume id: G7ETB5US
Volume set id:
Publisher id:
Data preparer id:
Application id: NERO BURNING ROM
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 16566
El Torito VD version 1 found, boot catalog is in sector 20
Joliet with UCS level 3 found
NO Rock Ridge present
Eltorito validation header:
    Hid 1
    Arch 0 (x86)
    ID 'NERO BURNING ROM'
    Key 55 AA
    Eltorito defaultboot header:
        Bootid 88 (bootable)
        Boot media 4 (Hard Disk Emulation)
        Load segment 7C0
        Sys type 6
        Nsect 1
        Bootoff 1B 27
$ isoinfo -l  -i ./g7uj28us.iso

Directory listing of /
d---------   0    0    0            2048 Jun 13 2019 [     21 02]  .
d---------   0    0    0            2048 Jun 13 2019 [     21 02]  ..

この iso ファイルを CD に書き込んで起動すればいいはずですが,メディアが手元にありません.

iso ファイルによってはUSBメモリに書き込むだけで起動USBメディアになるものもあるので試してみましたが起動できませんでした.

どうにかならないかなーと探すと以下の記事を見つけました.

geteltorito というPerl Script でイメージを変換した後,USBメモリに書き込むことで ThinkPad の BIOS Update ができるようです.
この記事中ではScript 開発者のページから入手していますが,Debian では genisoimage pkg に含まれているのでこれを使いました.

geteltorito の含まれている genisoimage pkg の導入
$ apt-file search geteltorito
genisoimage: /usr/bin/geteltorito
genisoimage: /usr/share/doc/genisoimage/README.geteltorito
genisoimage: /usr/share/man/man1/geteltorito.1.gz
$ sudo apt install genisoimage
usage
$ geteltorito

/usr/bin/geteltorito [-hv] [-o outputfilename] cd-image
Script will try to extract an El Torito image from a
bootable CD (or cd-image) given by <cd-image> and write
the data extracted to STDOUT or to a file.
   -h:        This help.
   -v:        Print version of script and exit.
   -o <file>: Write extracted data to file <file> instead of STDOUT.
USBメモリを接続してデバイスをdmesg やfdisk で確認して,wipefs でパーティション情報をクリアしておく
$ sudo dmesg -He|tail
$ sudo fdisk -l /dev/sdb
$ sudo wipefs -a /dev/sdb
geteltorito でイメージ変換しながら USBメモリへの書き込み
$ geteltorito ./g7uj28us.iso | sudo dd of=/dev/sdb bs=1M oflag=dsync status=progress
Booting catalog starts at sector: 20
Manufacturer of CD: NERO BURNING ROM
Image architecture: x86
Boot media type is: harddisk
El Torito image starts at sector 27 and has 65536 sector(s) of 512 Bytes
[sudo] password for matoken:
33218560 bytes (33 MB, 32 MiB) copied, 10 s, 3.2 MB/sImage has been written to stdout ....

9+178 records in
9+178 records out
33554432 bytes (34 MB, 32 MiB) copied, 10.3254 s, 3.2 MB/s

Debian pkg に含まれているScript のversion とsite で配布されているversion は0.5 と0.6 と少し違ったので念の為両方で変換を掛けて比較してみましたが結果は同じでした.

念の為siteで配布されているものでも変換してイメージを比較してみると同じものだった
$ wget http://userpages.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/geteltorito/geteltorito
$ chmod u+x ./geteltorito
$ ./geteltorito -v
Version: 0.6
$ ./geteltorito -o ./g7uj28us.img ./g7uj28us.iso
$ geteltorito -o ./g7uj28us.img-pkg ./g7uj28us.iso
$ diff -s ./g7uj28us.img ./g7uj28us.img-pkg
Files ./g7uj28us.img and ./g7uj28us.img-pkg are identical

ということで,書き込んだUSBメモリで起動してBIOS update はうまく行きました.

Version が上がっているのを確認
$ sudo dmidecode -t bios|grep -E "Version:|Release Date:"
        Version: G7ETB5WW (2.75 )
        Release Date: 06/10/2019

忘れがちだけど結構脆弱性の修正やmicrocode のアップデートも入っていたのでちゃんと当てないといけないですね…….

環境
$ dpkg-query -W genisoimage coreutils util-linux dmidecode lshw
coreutils       8.30-3
dmidecode       3.2-1
genisoimage     9:1.1.11-3+b2
lshw    02.18.85-0.2
util-linux      2.33.1-0.1
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Debian GNU/Linux 10 (buster)
      Architecture: x86-64

vlock コマンドで tmux をロックする

現在ターミナルマルチプレクサは Byobu 経由で GNU screen と tmux を環境により併用しています.GNU screen では画面ロックの設定をしていたのですがtmux は設定していなかったので今回 console lock コマンドの vlock を設定してみました.

導入
$ sudo apt install vlock
help
$ vlock -h
vlock: locks virtual consoles, saving your current session.
Usage: vlock [options] [plugins...]
	   Where [options] are any of:
-c or --current: lock only this virtual console, allowing user to
	   switch to other virtual consoles.
-a or --all: lock all virtual consoles by preventing other users
	   from switching virtual consoles.
-n or --new: allocate a new virtual console before locking,
	   implies --all.
-s or --disable-sysrq: disable SysRq while consoles are locked to
	   prevent killing vlock with SAK
-t <seconds> or --timeout <seconds>: run screen saver plugins
	   after the given amount of time.
-v or --version: Print the version number of vlock and exit.
-h or --help: Print this help message and exit.
カレントコンソールをlock してみる.何かキーを押した後ユーザのパスワードを入力することで復帰できる.
$ vlock -c
This TTY is now locked.

Please press [ENTER] to unlock.
matoken's Password:
全てのコンソールをロックする.ロック状態で Alt + n で他のコンソールに移動しても全てロックされている.
$ vlock -a
The entire console display is now completely locked.
You will not be able to switch to another virtual console.

Please press [ENTER] to unlock.
matoken's Password:
$ tty
/dev/tty1
仮想コンソール(Xの端末, ターミナルマルチプレクサ, script等)では全てのロックは失敗する
$ vlock -a
vlock: this terminal is not a virtual console
$ tty
/dev/pts/9
tmux に設定してみる(byobu 経由の場合)
$ cat ~/.byobu/.tmux.conf
# Enable locking(I need vlock -> sudo apt install vlock)
set -g lock-command vlock
set -g lock-after-time 0
bind l lock-session

.tmux.conf に設定した状態で tmux を起動して Ctrl+b l と押すと vlock でロックされます.セッション単位でロックされます.

ちなみに X では xscreensaver-command -activate を設定しています.例えば以下は awesome wm で Mod4 + l に設定してあります.

    -- lock screen
    awful.key({ "Mod1"  }, "l", function () awful.util.spawn( "xscreensaver-command -activate",false) end),
環境1
$ dpkg-query -W byobu screen tmux vlock
byobu   5.129-1
screen  4.6.2-3
tmux    2.8-3
vlock   2.2.2-8
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Debian GNU/Linux 10 (buster)
      Architecture: x86-64

crontab の実行タイミングをわかりやすく表示してくれる cronv を試す

ちょっと試したら少し嵌ったのでメモがてら.

build
$ go get github.com/takumakanari/cronv/cronv
$ go build -o ./cronv github.com/takumakanari/cronv/cronv
Usage
$ ./cronv -h
Usage:
  Cronv v0.4.1 [OPTIONS]

Application Options:
  -o, --output=    path to .html file to output (default: ./crontab.html)
  -d, --duration=  duration to visualize in N{suffix} style. e.g.) 1d(day)/1h(hour)/1m(minute) (default: 6h)
      --from-date= start date in the format '2006/01/02' to visualize (default: 2019/05/25)
      --from-time= start time in the format '15:04' to visualize (default: 02:50)
  -t, --title=     title/label of output (default: Cron Tasks)
  -w, --width=     Table width of output (default: 100)

Help Options:
  -h, --help       Show this help message
実行
$ crontab -l | ./cronv

2019-06-01 ADD: 以下のtab が含まれているときにエラーとなる問題は修正されました😖

しかし,missing field(s) とか syntax error in year field: とかのエラーになってしまう.

$ printf "* * * * *\tcommand\n"
* * * * *       command
$ printf "* * * * *\tcommand\n" | ./cronv
panic: Failed to analyze cron '* * * * *        command': syntax error in year field: 'command'

goroutine 1 [running]:
panic
        ../../../src/libgo/go/runtime/panic.go:554
main.main
        /home/mk/go/src/github.com/takumakanari/cronv/cronv/main.go:33

タブ区切りをやめてスペース区切りにするとエラーが出ない

$ printf "* * * * * command\n" | ./cronv
[Cron Tasks] 1 tasks.
[Cron Tasks] './crontab.html' generated.

ということでとりあえずタブをスペースに変換することにした.

$ crontab -l | tr -s '\t' ' ' | ./cronv
[Cron Tasks] 8 tasks.
[Cron Tasks] './crontab.html' generated.

作成された crontab.html を w3m で……ほとんど表示されない.

20190525 03 36 35 001

もう少しリッチな JavaScript の動くウェブブラウザで開くとOK.
これからの6時間分の様子が見える.

20190525 03 00 01 001

-d, --duration option で表示する時間間隔が指定できる.
開始日時は,--fron-date, --from-time option で指定できる.
以下の例では 2019-05-25 00:00:00 から1日分の表示になる.

$ crontab -l | tr -s '\t' ' ' | ./cronv -d 1d --from-date=2019/05/25 --from-time=00:00

20190525 02 58 37 001

ちなみに1ヶ月も試したが,ウェブブラウザで表示するのにとても時間が掛かった.

環境
$ dpkg-query -W cron gccgo-go
cron    3.0pl1-128.1ubuntu1
gccgo-go        2:1.10~4ubuntu1
$ lsb_release -d
Description:    Ubuntu 18.04.2 LTS
$ uname -m
x86_64

Android で Wi-Fi 経由の adb を有効にして backup

Android 端末側でUSB デバッグを有効にしてUSB接続する.
デバイスが認識されているか確認.

$ adb devices
List of devices attached
PM1LHMA861102833        device

no permissions と言われた場合

$ adb devices
List of devices attached
PM1LHMA861102833        no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]

は以下のようにして udev のルルーを追加する.VID/PID(以下の例では2e18, c032)部分はdmesgやlsusbで確認して自分の端末のIDに書き換える.

$ echo '# Essential PH-1
> SUBSYSTEM=="usb", ATTR{idVendor}=="2e17", ATTR{idProduct}=="c032", MODE="0666", GROUP="adbandy"' | sudo tee /etc/udev/rules.d/51-android.rules
# Essential PH-1
SUBSYSTEM=="usb", ATTR{idVendor}=="2e17", ATTR{idProduct}=="c032", MODE="0666", GROUP="adbandy"

その後USB を接続し直して確認し直す.

HostPC の adb コマンドで tcpip コマンドで接続できるようにして,connect コマンドで Android 端末の ip を指定して接続します.
5555 はポート番号で 5555 が規定値.既定値から変更した場合は,connect コマンドの ip の後ろにポート番号の指定が必要になります.

$ adb tcpip 5555
$ adb connect 192.168.1.200
connected to 192.168.1.200:5555

この状態でusb 接続を解除して devides コマンドに居ます :)
後は普通に使えます.

$ adb devices
List of devices attached
192.168.1.200:5555      device
$ adb logcat|head -1
--------- beginning of crash
^C

そして本命のバックアップ.

$ time adb backup -f ./PH-1.ab -all
Now unlock your device and confirm the backup operation...

real   26m2.104s
user    0m0.171s
sys     0m5.725s

用事が終わったら切断しておいたほうが安心ですね.

$ adb disconnect 192.168.1.200
disconnected 192.168.1.200
$ adb devices
List of devices attached
環境(Android)
mata:/ $ getprop ro.bootimage.build.fingerprint
essential/mata/mata:9/PQ1A.190105.058/496:user/release-keys
mata:/ $ getprop ro.build.version.security_patch
2019-05-05
mata:/ $ getprop ro.product.cpu.abilist
arm64-v8a,armeabi-v7a,armeabi
環境(HostPC)
$ dpkg-query -W adb
adb     1:8.1.0+r23-5
$ lsb_release -dr
Description:    Debian GNU/Linux 10 (buster)
Release:        10
$ uname -m
x86_64

ドイツの格安VPS(Contabo VPS 300) を借りてセットアップ済サーバのOSを入れ替える

追記)Contabo のアフェリエイトリンクを貼っておきます.Contabo のサービスを申し込む場合は以下のバナーから申し込んでくれると嬉しいです.


今利用しているさくらのVPSのdiskがいっぱいになってしまいました.現在100GBですが,鹿児島市の航空写真のH30版を入手したのでもう50GBは欲しい.できればもう100GB.

オブジェクトストレージだとそこそこ安そうだけどさくらは申込み停止中.

新規お申し込み停止のお知らせ
100GiB以下 540円

ConoHaは受付中みたい.

容量は100GB単位で追加でき、月額450円/100GBでご利用いただけます。

Amazon S3 はどうだろうと計算すると今の転送量だと4000円/月以上しそう(◞‸◟)

海外だとどうだろうと VPS 比較サイトの VPS Comp を見ると,ドイツの Contabo VPS 300 というストレージ 300GB のサービスが 3.99€/月と格安です.日本円で500円位でしょうか.

安いのでちょっと不安ですが契約してみました.セットアップ料金として別途 4.99€が必要でした.このフィーは申込期間が1ヶ月の場合で,3ヶ月,6ヶ月と伸びるごとに安くなって12ヶ月で無料になります.

20190509 23 05 06 1787

契約には別途ライセンスの写真を送る必要がありました.日本語の住基ネットカードの表面のみの写真を送りましたが受け付けてもらえました.

するとすぐにアクセスのための情報がやってきました.アクセス手段はssh と VNC です.
申込時に指定したディストリビューションでセットアップ済ですが,自分で用意したイメージでセットアップしたり暗号化FSなども利用したいです.

さくらのVPS では自分で用意した ISO イメージでセットアップできました.

しかし,Contabo ではこの方法は使えないようです.
Webのコントロールパネルを見ると,Rescue system から SystemRescueCD, Debian Live, CroneZilla が使えるようです.

20190510 09 05 38 16982

今回は,ディスクに空き領域を作成してそこに起動イメージとセットアップCD イメージを置いてセットアップ済イメージのGRUB からそれを起動してセットアップすることにしました.
(はじめ / の領域に置いて初期化しなければ行けるのではと試しましたがパーティションの設定で d-i に怒られたので別パーティションに)

ということでまずはWebコンソールから Debian Live で起動して,VNC で接続して Install 済のイメージをいじって500MB ほどの空きパーティションを作成しました. / が1GB ほどあったのでこれをおおまかに半分に分割しました.ext4 でフォーマットもして mount します.
(案外VNCももたつかず操作できた)

20190510 15 05 09 16332
20190510 15 05 01 16995

mount した領域に vmlinux, initrd, Debian Install CD を入れます.
今回はこの辺をダウンロードしました.

http://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-cd/debian-testing-amd64-netinst.iso
http://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-cd/SHA512SUMS
http://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-cd/SHA512SUMS.sign
http://http.us.debian.org/debian/dists/buster/main/installer-amd64/20190410/images/hd-media/vmlinuz
http://http.us.debian.org/debian/dists/buster/main/installer-amd64/20190410/images/hd-media/initrd.gz

再起動してプリインストールイメージの GRUB で c を押して GRUB の command-line に入ります.
そしてこんな感じでさっきダウンロードしたイメージで起動します.

grub>  imsmod part_msdos
grub>  insmod ext2
grub>  set root='hd0,msdos2'
grub>  linux /vmlinux
grub>  initrd /initrd.gz
grub>  boot

うまく起動すれば後はいつもの d-i なのでよしなに…….セットアップが終わったらもったいないのでパーティションを操作してセットアップに使った領域をくっつけておきます.

リモートのサーバで暗号化FS を使うといちいちコンソールのVNC を立ち上げないといけなくて面倒という場合には Debian の場合 dropbear-initramfs を導入するとinitramfs で dropbrar(sshd) を利用できるようになり,ssh 経由でロック解除できます.自動化することも可能.

dropbear-initramfs pkg を導入して,/usr/share/doc/dropbear-initramfs/README.initramfs を見ると良いです.

$ sudo apt install dropbear-initramfs
$ sudo install -m 600 /dev/null /etc/dropbear-initramfs/authorized_keys
$ cat ~/.ssh/id_cdsa_remote.pub | sudo tee -a /etc/dropbear-initramfs/authorized_keys
$ sudo update-initramfs -u -k all

UnixBench 測ってみました.500円にしては案外性能いいような.#自宅サーバ(HP ProLiant MicroServer)は 400前後なのに……

Benchmark Run: Sun May 12 2019 22:42:16 - 23:10:29
2 CPUs in system; running 2 parallel copies of tests

Dhrystone 2 using register variables       56736299.4 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     9687.1 MWIPS (9.2 s, 7 samples)
Execl Throughput                               5257.7 lps   (29.7 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        859332.6 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          245855.2 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2105320.9 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1607890.0 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 342078.2 lps   (10.0 s, 7 samples)
Process Creation                              11453.5 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   9834.5 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1400.3 lpm   (60.1 s, 2 samples)
System Call Overhead                        1160557.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   56736299.4   4861.7
Double-Precision Whetstone                       55.0       9687.1   1761.3
Execl Throughput                                 43.0       5257.7   1222.7
File Copy 1024 bufsize 2000 maxblocks          3960.0     859332.6   2170.0
File Copy 256 bufsize 500 maxblocks            1655.0     245855.2   1485.5
File Copy 4096 bufsize 8000 maxblocks          5800.0    2105320.9   3629.9
Pipe Throughput                               12440.0    1607890.0   1292.5
Pipe-based Context Switching                   4000.0     342078.2    855.2
Process Creation                                126.0      11453.5    909.0
Shell Scripts (1 concurrent)                     42.4       9834.5   2319.5
Shell Scripts (8 concurrent)                      6.0       1400.3   2333.9
System Call Overhead                          15000.0    1160557.8    773.7
                                                                   ========
System Benchmarks Index Score                                        1682.8

回線速度も測ってみましたが流石に遅いですね.

近所
$ speedtest-cli --list|head -6|tail -5|cut -d\) -f1|xargs -I{} -n1 speedtest-cli --server {} |egrep '^Hosted|^Download:|Upload:'
Hosted by noris network AG (Nuremberg) [6.35 km]: 15.333 ms
Download: 98.64 Mbit/s
Upload: 4.02 Mbit/s
Hosted by 10G-Server.com (Nuremberg) [7.56 km]: 9.801 ms
Download: 98.59 Mbit/s
Upload: 4.04 Mbit/s
Hosted by Contabo GmbH (Nuremberg) [7.56 km]: 0.764 ms
Download: 99.14 Mbit/s
Upload: 4.04 Mbit/s
Hosted by Maltechx.de (Nuremberg) [7.56 km]: 8.903 ms
Download: 98.27 Mbit/s
Upload: 4.04 Mbit/s
Hosted by TempleServers (Nuremberg) [7.56 km]: 11.996 ms
Download: 98.20 Mbit/s
Upload: 4.08 Mbit/s
東京
$ speedtest-cli --list|grep -i tokyo|cut -d\) -f1|xargs -I{} -n1 speedtest-cli --server {} |egrep '^Hosted|^Download:|Upload:'
Hosted by OPEN Project (via 20G SINET) (Tokyo) [9281.34 km]: 259.654 ms
Download: 57.46 Mbit/s
Upload: 3.67 Mbit/s
Hosted by GLBB Japan (Tokyo) [9281.34 km]: 314.77 ms
Download: 40.50 Mbit/s
Upload: 3.72 Mbit/s
Hosted by i3D.net (Tokyo) [9281.34 km]: 811.767 ms
Download: 48.99 Mbit/s
Upload: 3.71 Mbit/s
Hosted by GIAM PING VIETPN.COM (Tokyo) [9281.34 km]: 309.393 ms
Download: 45.06 Mbit/s
Upload: 3.62 Mbit/s
Hosted by Rakuten Mobile , Inc (Tokyo) [9281.34 km]: 236.677 ms
Download: 61.32 Mbit/s
Upload: 2.45 Mbit/s
Hosted by Love4Taylor (Tokyo) [9281.34 km]: 263.325 ms
Download: 59.33 Mbit/s
Upload: 3.68 Mbit/s

暫く運用して問題無さそうなら国内のサーバを1つ閉じてこちらと役割分担する感じにしようと思います.

nanoを消したDebianでエディタの警告が出るのを修正

vim使うのでnanoを消しているのですが警告が出ています.

$ sudo crontab -e
/usr/bin/sensible-editor: 25: /usr/bin/sensible-editor: /bin/nano: not found
/usr/bin/sensible-editor: 28: /usr/bin/sensible-editor: nano: not found
/usr/bin/sensible-editor: 31: /usr/bin/sensible-editor: nano-tiny: not found
crontab: installing new crontab

fallback?でvimに切り替わるので実害はないのですが気持ち悪い.
警告を出している sensible-editor を確認.

$ man sensible-editor|more
SENSIBLE-EDITOR(1)                                         General Commands Manual                                         SENSIBLE-EDITOR(1)

NAME
       sensible-editor, sensible-pager, sensible-browser - sensible editing, paging, and web browsing

SYNOPSIS
       sensible-editor [OPTIONS...]
       sensible-pager [OPTIONS...]
       sensible-browser url

DESCRIPTION
       sensible-editor,  sensible-pager and sensible-browser make sensible decisions on which editor, pager, and web browser to call, respec‐
       tively.  Programs in Debian can use these scripts as their default editor, pager, or web browser or emulate their behavior.

SEE ALSO
       Documentation of the EDITOR, VISUAL and PAGER variables in environ(7) and select-editor(1) for changing a user's default editor

STANDARD
       Documentation of behavior of sensible-utils under a debian system is available under section 11.4 of debian-policy  usually  installed
       under /usr/share/doc/debian-policy (you might need to install debian-policy)

Debian                                                           14 Nov 2010                                               SENSIBLE-EDITOR(1)

select-editor を実行するとインストール済のエディタを選択できる.

$ sudo select-editor

Select an editor.  To change later, run 'select-editor'.
  1. /usr/bin/vim.gtk3
  2. /usr/bin/vim.nox
  3. /usr/bin/vim.basic
  4. /usr/bin/mcedit
  5. /usr/bin/vim.tiny
  6. /usr/bin/vscodium

Choose 1-6 [1]: 2

警告が出なくなりました :)

$ sudo crontab -e
crontab: installing new crontab

環境

$ dpkg-query -W sensible-utils cron vim
cron    3.0pl1-133
sensible-utils  0.0.12
vim     2:8.1.0875-2
$ lsb_release -dr
Description:    Debian GNU/Linux 10 (buster)
Release:        10
$ uname -m
x86_64

色々なプログラムで proxy を使えるようにする proxychains-ng を試す

proxychains-ng というものを見かけたので試してみます.ネットワーク関連の関数をフックして,SOCKS 4a, 5, HTTP proxy を利用できるようにします.
torsocks的な感じ.

とりあえずこんな感じで動きました

$ git clone https://github.com/rofl0r/proxychains-ng
$ cd proxychains-ng
$ ./configure && make

src/proxychains.confにtorの設定が書いてあるのでとりあえずそれで動かします.(tor daemon が動いている前提)
1回目はtimeoutに,2回目は成功.

$ ./proxychains4 -f src/proxychains.conf curl ifconfig.me/ip
  :
[proxychains] Strict chain  ...  127.0.0.1:9050  ...  ifconfig.me:80 <--socket error or timeout!
curl: (7) Couldn't connect to server
$ ./proxychains4 -f src/proxychains.conf curl ifconfig.me/ip
  :
[proxychains] Strict chain  ...  127.0.0.1:9050  ...  ifconfig.me:80  ...  OK
158.69.192.239

torsocksでは起動しないfirefox も起動した.

$ ./proxychains4 -f src/proxychains.conf firefox

Debian package にも proxychains4 という名前であった.こっちのほうが楽ですね.

$ apt show proxychains4
Package: proxychains4
Version: 4.13-4
Priority: optional
Section: net
Source: proxychains-ng
Maintainer: Boyuan Yang <byang@debian.org>
Installed-Size: 45.1 kB
Provides: proxychains, proxychains-ng
Depends: libproxychains4 (= 4.13-4), libc6 (>= 2.4)
Breaks: proxychains (<< 3.1-8)
Replaces: proxychains
Homepage: https://github.com/rofl0r/proxychains-ng
Download-Size: 14.1 kB
APT-Sources: http://ftp.jp.debian.org/debian sid/main amd64 Packages
Description: redirect connections through socks/http proxies (proxychains-ng)
 Proxychains is a UNIX program, that hooks network-related libc functions
 in dynamically linked programs via a preloaded DLL (dlsym(), LD_PRELOAD)
 and redirects the connections through SOCKS4a/5 or HTTP proxies.
 It supports TCP only (no UDP/ICMP etc).
 .
 This project, proxychains-ng, is the continuation of the unmaintained
 proxychains project (known as proxychains package in Debian).
$ sudo apt install proxychains4
$ $ proxychains4 curl ifconfig.me/ip
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] Strict chain  ...  127.0.0.1:9050  ...  ifconfig.me:80  ...  OK
94.230.208.147

環境

$ lsb_release -dr
Description:    Debian GNU/Linux 10 (buster)
Release:        10
$ uname -m
x86_64

apt upgrade で ping(inetutils-ping) が壊れていると言われて失敗する

Debian sid amd64 環境で,apt upgrade するとこんなエラーで失敗しました.

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree     
Reading state information... Done    
Calculating upgrade... Done          
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.         
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 inetutils-ping : Conflicts: ping
E: Broken packages 

ping コマンドはあるし実行も出来る.reinstall してみましたがエラーは解消されず.

$ sudo apt install --reinstall inetutils-ping                                                                     
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  python-newt
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 57 not upgraded.
Need to get 0 B/226 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 472864 files and directories currently installed.)
Preparing to unpack .../inetutils-ping_2%3a1.9.4-7_amd64.deb ...
Unpacking inetutils-ping (2:1.9.4-7) over (2:1.9.4-7) ...
Setting up inetutils-ping (2:1.9.4-7) ...
Processing triggers for man-db (2.8.5-2) ...

一時的に削除してみました.

$ sudo apt remove inetutils-ping
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  python-newt
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  inetutils-ping
0 upgraded, 0 newly installed, 1 to remove and 57 not upgraded.
After this operation, 358 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 472864 files and directories currently installed.)
Removing inetutils-ping (2:1.9.4-7) ...
Processing triggers for man-db (2.8.5-2) ...

削除した後 apt upgrade を試すと通りました.

$ sudo apt upgrade

その後 ping を install し直したあと upgrade を試すとエラーは出なくなりました.

$ sudo apt install inetutils-ping
$ sudo apt upgrade>/dev/null 2>&1;echo $?
0

原因がよくわからないですね…….

環境

$ dpkg-query -W apt inetutils-ping
apt     1.8.0
inetutils-ping  2:1.9.4-7
$ lsb_release -dr
Description:    Debian GNU/Linux 10 (buster)
Release:        10
$ uname -m
x86_64