Raspbianイメージを任意の広さに拡大する

Raspbian はSD cardに書き込んでRaspberry Piで起動するとraspi-configから簡単にパーティションサイズを拡大できます.しかし,パッケージのアップデートや導入に時間がかかるのでSD cardに書き込む前にこの辺りの処理は済ませておきたいです. chrootとQEMU User Emulatorを使えば出来るのですが,今度はDisk fullに……. ということでraspbianイメージを広げてみます.
※速度の速いストレージだと必要ない処理かもしれませんが,カスタマイズしたイメージを用意するとかにも使えます.
※ここではRaspbian Lite stretch 2017-11-29のイメージを元にしていますが,最終パーティションを広げるのであれば他の各種イメージでもほぼそのまま,途中のパーティションサイズを変更するのも応用でいけます.

今回は広げると行ってもオリジナルのファイルはそのままに,4GBほどのサイズのイメージを作ってそちらにデータをコピーしてそのイメージのサイズを広げることにします.

今回の環境は Debian sid amd64 環境です.Linux環境であればほぼ同じ手順で行けると思います.

4GBイメージを作成

4GBほどの容量のイメージを作成します.もっと大きい容量がいい人はcountを増やしましょう.
<追記>4GBにしてはちょっと大きかったかも.手持ちにカードの容量より少し小さいサイズにすると良いです.</追記>

$ dd if=/dev/zero of=./4gb.img bs=1M count=4000
$ ls -l ./4gb.img
-rw-r--r-- 1 mk mk 4194304000 Jan 19 21:28 ./4gb.img

losetupでデバイスマッピングをする

/dev/loop0に割り当てられた.

$ sudo losetup -f --show ./4gb.img
/dev/loop0

Raspbianイメージの用意とデバイスマッピング

/dev/loop1に割り当てられた.

$ unzip 2017-11-29-raspbian-stretch-lite.zip
$ sudo losetup -f --show ./2017-11-29-raspbian-stretch-lite.img 
/dev/loop1

Raspbianイメージを4GBのイメージにコピー

loop1(Raspbian)のイメージをloop0(4GB)にコピーしている.

$ sudo dd if=/dev/loop1 of=/dev/loop0 bs=1M
1772+0 records in
1772+0 records out
1858076672 bytes (1.9 GB, 1.7 GiB) copied, 161.929 s, 11.5 MB/s

Raspbianイメージを片付ける

$ sudo losetup -d /dev/loop1
$ rm ./2017-11-29-raspbian-stretch-lite.img

コピーしたイメージをfdiskで確認

Raspbianのパーティション情報が見えます.

$ sudo fdisk -l /dev/loop0 
Disk /dev/loop0: 3.9 GiB, 4194304000 bytes, 8192000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x37665771

Device       Boot Start     End Sectors  Size Id Type
/dev/loop0p1       8192   93236   85045 41.5M  c W95 FAT32 (LBA)
/dev/loop0p2      94208 3629055 3534848  1.7G 83 Linux

fdiskでパーテションサイズを変更する

ここはわかりづらいですが,以下のような操作をしています.

  • d コマンドで 2つ目のパーテションを削除
  • n コマンドで 2つ目のパーテションを最大容量で作り直し
    • この時 First sector を削除前のものと合わせること
  • p コマンドで確認
  • w コマンドで書き込み
    • w コマンドで書き込むまではファイルシステムは変更されないので間違ってもやり直しできます.
$ sudo fdisk /dev/loop0

Welcome to fdisk (util-linux 2.30.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-8191999, default 2048): 94208
Last sector, +sectors or +size{K,M,G,T,P} (94208-8191999, default 8191999): 8191999

Created a new partition 2 of type 'Linux' and of size 3.9 GiB.  
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: N

Command (m for help): p

Disk /dev/loop0: 3.9 GiB, 4194304000 bytes, 8192000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x37665771

Device       Boot Start     End Sectors  Size Id Type
/dev/loop0p1       8192   93236   85045 41.5M  c W95 FAT32 (LBA)
/dev/loop0p2      94208 8191999 8097792  3.9G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: 無効な引数です                                                                         

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

fdiskに慣れていない場合はgparted等でGUIで操作したほうが直感的で解りやすいかもしれません(未検証) -> gksudo gparted /dev/loop0
20180121_07:01:45-6347

kpartxでパーティションをマッピングする

上で使ったlosetupでも出来るのですが,オフセットを自分で計算して指定する必要がある

losetupを使う場合はfdiskのpコマンドの対象パーティーションの Start * Sector sizeをlosetupの-oに指定します.今回の例だと2つ目のパーティーションは 94208 * 512 になります.(未検証)

$ losetup -f –show -o `expr 94208 \* 512` /dev/loop0

ので今回はそのあたりを自動で行ってくれるkpartxを利用します.大抵は標準では入っていないので以下のエントリを参考に導入してから実行してください.

1つ目のパーティションが /dev/mapper/loop0p1 2つ目のパーティションが /dev/mapper/loop0p2 として設定されました.

$ sudo kpartx -av /dev/loop0
add map loop0p1 (253:4): 0 85045 linear 7:0 8192
add map loop0p2 (253:5): 0 8129 linear 7:0 63

ファイルシステムの修正

ファイルシステムが壊れているのでfsckで修正します.しかし,cleanと言われてしまうので,

$ sudo fsck -n /dev/mapper/loop0p2
fsck from util-linux 2.30.2
e2fsck 1.43.8 (1-Jan-2018)
rootfs: clean, 39394/110656 files, 256435/441856 blocks

一回resize2fsを叩いて怒られてから

$ sudo resize2fs /dev/mapper/loop0p2
resize2fs 1.43.8 (1-Jan-2018)
Please run 'e2fsck -f /dev/mapper/loop0p2' first.

fsckを実行し直します.

$ sudo e2fsck -f /dev/mapper/loop0p2
e2fsck 1.43.8 (1-Jan-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
rootfs: 39394/110656 files (0.1% non-contiguous), 256435/441856 blocks

パーティーションリサイズ

fsckが通ったら今度こそリサイズです.これで最大サイズに変更されます.

$ sudo resize2fs /dev/mapper/loop0p2
resize2fs 1.43.8 (1-Jan-2018)
Resizing the filesystem on /dev/mapper/loop0p2 to 1012224 (4k) blocks.

mountしてみる

広くなっているのがわかります :)

$ sudo mount -o ro /dev/mapper/loop0p2 /mnt
$ df /mnt
ファイルシス        1K-ブロック   使用  使用可 使用% マウント位置                                                              
/dev/mapper/loop0p2     3954560 966004 2769736   26% /mnt

後片付け

アンマウントしてloopデバイスも解除します.

$ sudo umount /mnt
$ sudo kpartx -d /dev/mapper/loop0p?
$ sudo losetup -d /dev/loop0 

QEMU User EmulatorでArm以外でapt upgradeする

この辺はまた別のエントリで書くつもりですがこんな感じでupgradeしたりしています.

$ sudo mount /dev/mapper/loop0p2 /mnt
$ sudo mount /dev/mapper/loop0p1 /mnt/boot
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /dev/pts /mnt/dev/pts
$ sudo mount --bind /proc /mnt/proc
$ sudo cp -p /usr/bin/qemu-arm-static /mnt/usr/bin/
$ sudo chroot /mnt /bin/bash
# apt update && apt upgrade -y

このイメージはオリジナルのRaspbianイメージと同じようにSD cardに書き込んで利用できます.

ExifTool で任意の geotag 埋め込み

DSC_0241

撮影した写真への位置情報の書き込みにいつもは GPSロガーで記録したGPSログを使い,gpscorrelateコマンドを利用しています.

以下のスライドは2008年のものですが現在もそのままの手順で埋め込んでいます.

建物内などに入ったときなどGPSログが取れないので埋め込みも出来ていませんでした.でも今回建物内で撮影したのが分かっている写真にその場所の位置情報を埋め込みたいと思いました.

gpscorrelateコマンドのマニュアルを見た感じそれらしいオプションは見当たりませんでした.ダミーのGPSログを書くとかもちょっと考えたのですが,exiv2コマンドで座標指定でいけるのではとmanを見ると行けそうです.

       exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \
              -M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpg
              Sets  the  latitude to 4 degrees, 15 minutes and 33 seconds north. The Exif standard stipulates that the GPS‐
              Latitude tag consists of three Rational numbers for the degrees, minutes and seconds of the latitude and GPS‐
              LatitudeRef contains either 'N' or 'S' for north or south latitude respectively.

しかし座標の度分秒変換が必要でちょっとめんどうです.
ExifToolを見ると変換なしで行けそうなのでこれで試してみました.(-geotag optionでgpscorrelateと同じこともできそう)

       -geotag TRKFILE
            Geotag images from the specified GPS track log file.  Using the -geotag option is equivalent to writing a value
            to the "Geotag" tag.  After the -geotag option has been specified, the value of the "Geotime" tag is written to
            define a date/time for the position interpolation.  If "Geotime" is not specified, the value is copied from
            "DateTimeOriginal#" (the "#" is added to copy the unformatted value, avoiding potential conflicts with the -d
            option).  For example, the following two commands are equivalent:

                exiftool -geotag trk.log image.jpg
                exiftool -geotag trk.log "-Geotime<DateTimeOriginal#" image.jpg

            When the "Geotime" value is converted to UTC, the local system timezone is assumed unless the date/time value
            contains a timezone.  Writing "Geotime" causes the following tags to be written (provided they can be
            calculated from the track log, and they are supported by the destination metadata format):  GPSLatitude,
            GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, GPSAltitude, GPSAltitudeRef, GPSDateStamp, GPSTimeStamp,
            GPSDateTime, GPSTrack, GPSTrackRef, GPSSpeed, GPSSpeedRef, GPSImgDirection, GPSImgDirectionRef, GPSPitch and
            GPSRoll.  By default, tags are created in EXIF, and updated in XMP only if they already exist.  However,
            "EXIF:Geotime" or "XMP:Geotime" may be specified to write only EXIF or XMP tags respectively.  Note that
            GPSPitch and GPSRoll are non-standard, and require user-defined tags in order to be written.

すでに埋め込み済みのジオタグを参考にして,

$ exiftool -v IMGP5011.JPG|grep GPS
  | 12) GPSInfo (SubDirectory) -->
  | + [GPS directory with 11 entries]
  | | 0)  GPSVersionID = 2 0 0 0
  | | Warning = Tag ID 0x0000 out of sequence in GPS
  | | 1)  GPSVersionID = 2 3 0 0
  | | 2)  GPSLatitudeRef = N
  | | 3)  GPSLatitude = 31 19 18.23 (31/1 19/1 1823/100)
  | | 4)  GPSLongitudeRef = E
  | | 5)  GPSLongitude = 130 53 57.6 (130/1 53/1 5760/100)
  | | 6)  GPSAltitudeRef = 0
  | | 7)  GPSAltitude = 7.8833 (78833/10000)
  | | 8)  GPSTimeStamp = 7 10 37 (7/1 10/1 37/1)
  | | 9)  GPSMapDatum = WGS-84
  | | 10) GPSDateStamp = 2018:01:13

こんな感じかな?

  • GPSLongitudeRef=E -> 東経, 西経
  • GPSLongitude=130.86455555555557 -> 経度
  • GPSLatitudeRef=N -> 北緯, 南緯
  • GPSLatitude=31.386555555555553 -> 緯度
  • GPSAltitude=41.47 -> 海抜標高

実際にExifToolで埋め込んでみました.

$ exiftool -GPSLongitudeRef=E -GPSLongitude=130.86455555555557 -GPSLatitudeRef=N -GPSLatitude=31.386555555555553 -GPSAltitude=41.47 IMGP5021.JPG

座標系がないとまずいかなと思いましたがJOSMやGpsPruneにこの写真を読み込んでみると想定していた座標にプロットされました :)

20180117_00:01:45-2690020180116_05:01:42-30322

exiftoolは既定値ではIMGP5021.JPG_originalのようにオリジナルファイルのバックアップが作成されるので  問題なかったらこれは消しておきましょう.

$ rm *_original

DNAとかをbashでくるくる表示

動画を見ると楽しそうだし真似してみようと.scriptを入手.中を見ると .fa というファイルが必要なよう.

$ wget http://biosyntax.org/drawHelix.sh
#!/bin/bash
#
# drawHelix.sh <input.fa>
#
# Reads a fasta input file and stream a B-Form DNA
# helix with the sequence to STDOUT
#
##    __     __   __           ___
###  |__) | /  \ /__` \ / |\ |  |   /\  \_/
#### |__) | \__/ .__/  |  | \|  |  /~~\ / \

*.fa は FASTA というソフトウェアの形式らしい.FASTA はシーケンスアライメントを行うソフトウェアらしい.
ソフトウェア自体もヴァージニア大学のsiteから入手できるようだけどWikipediaにページに例があったので今回はそれを使ってみる.

$ echo '>gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus]
LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
EWIWGGFSVDKATLNRFFAFHFILPFTMVALAGVHLTFLHETGSNNPLGLTSDSDKIPFHPYYTIKDFLG
LLILILLLLLLALLSPDMLGDPDNHMPADPLNTPLHIKPEWYFLFAYAILRSVPNKLGGVLALFLSIVIL
GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
IENY' > test.fa
$ bash drawHelix.sh test.fa

そしてこんな感じに.

macOSの場合は要patchだそう

bash製横スクロールシューティングゲームのpiu-piuで遊んでみる

matsuuさんのpostで知ったのですが,bash製横スクロールシューティングゲームのpiu-piuというものがあるそうです.

うおおおおってことで遊んでみました.

遊ぶにはgit cloneしたり,

$ git clone https://github.com/vaniacer/piu-piu-SH && cd piu-piu-SH

実態は1つのscriptなのでそれだけDLしたりして

$ wget https://raw.githubusercontent.com/vaniacer/piu-piu-SH/master/piu-piu

実行すればokです.

$ bash ./piu-piu

手元のTilixでは ambiguous-wide charWide だと崩れたので Nallow に変更しました.
Gnome-Terminalの日本語訳だと多分「曖昧幅の文字」の部分を「半角」でokじゃないかと(未確認)

20171230_16:12:49-24830

遊び方はWASDで移動,pでshotです.ライフが0になったらゲームオーバー.弾薬ははじめ100あります.敵を倒したときに弾薬やライフ回復アイテム,パワーアップアイテムを入手できるのでそれで回復しましょう(はじめアイテム類を敵の破片かと思って避けて弾薬が付きてた).100体の敵を倒すとボスも出現(今のとここのボスに負けたところまでしか勧めていない)とはじめ思っていたより凝っている感じ.

co-opモードというネットワーク経由での協力/対戦プレイモードもあるようです.とりあえず1台のマシンで2つの端末を開きlocalhostや127.0.0.1で試したところ接続できない感じ?

20171230_21:12:35-26211
20171230_21:12:54-26490
20171230_21:12:14-28842

ただ,手元の環境(Core2Duo)では操作すると1桁とか0fpsになりあまりゲームにならず遊ぶのは辛い感じ解像度?(行x桁)も落としてみたりしたんですが,ある程度以下まで下げると崩れて遊べなくなってしまいます.遅いだけならどうにかありそうですが,キー入力がバッファに溜まってしまいまともに操作できないのでちょっとつらいです.
いつもならこの手のものはasciinemaで録画しておくんですが今回は快適な環境で動かすまで見送りです.

ちなみに以前こんなのでも遊びました.awk製のターン制3Dシューテングです.こちらは確かRaspberry Piでもさくさく動いたと思います.

RaspberryPi向けのサービス公開サービスPiTunnelを試そうとした

PiTunnelをちょっと試そうとする.
Raspberry Pi向けのngrok的なもののよう.家庭内のLAN内のRaspberry Piのサービスを外部に公開しようと思うとルーターのポートを開けたりDDNS設定したりとちょっと面倒.これをお手軽に公開できるようになるサービス.

PiTunnelでアカウント登録をすると,Device管理画面に遷移するのでここでAdd Devides ボタンでinstall scriptのコマンドが表示される.

こんな感じだけど XXXXXXXX 部分はtokenのようなので注意.

curl https://pitunnel.com/install/XXXXXXXX | sudo python

とりあえずダウンロードして中見てから実行.

$ wget https://pitunnel.com/install/XXXXXXXXXX
$ lv XXXXXXXXXX
$ sudo python XXXXXXXXXX
   :
Configuring Startup   
Register the device   
OK
Starting PiTunnel


## All done!! ##
Please visit www.pitunnel.com to access your device!

www.pitunnel.comにアクセスしてねって見に行くと,

STATUS: Due to unprecedented high demand, we're currently having connection issues. Please sit tight and we'll have this resolved within the next 24 hours.

とかなっている.今使えなくなっているようです.

とりあえず少し叩いてみます.

$ pitunnel -h
usage: pitunnel [-h] [--port PORT] [--host HOST] [--name NAME] [--token TOKEN]
                [--http] [--register] [--type TYPE] [--private]
                [--http-auth HTTP_AUTH] [--quiet]

optional arguments:
  -h, --help            show this help message and exit
  --port PORT           Port Number
  --host HOST           Hostname or IP Address (default: localhost)
  --name NAME           Display name, for reference and subdomain creation.
  --token TOKEN         Optinal user tunnel token. Not required if installed
                        from website.
  --http                Indicates that a tunnel is for a HTTP service. Will
                        create http links on tunnels list and subdomains for
                        named tunnels.
  --register            Register a new device. Only needs to be called on
                        first use by install script.
  --type TYPE           Used to identify system tunnels like device_monitor.
  --private             Specifies that the tunnel wont except external
                        connections. It can only receive connections from
                        localhost. E.g. for device_monitor.
  --http-auth HTTP_AUTH
                        Add HTTP authorization to external access for this
                        tunnel: 'user:pass'
  --quiet               Quite Mode. Doesn't output messages to standard out.
$ pitunnel --register
OK
$ pitunnel --port 22
Trying to connect to pitunnel.com
Trying to connect to pitunnel.com
Trying to connect to pitunnel.com
Trying to connect to pitunnel.com
Trying to connect to pitunnel.com
^CTraceback (most recent call last):
  File "tunnelling/python/tunnel_client.py", line 139, in <module>
KeyboardInterrupt
[9305] Failed to execute script tunnel_client

て感じでやっぱ動かないようですね.1,2日待ちましょう.

今のところRaspbian最新用だけど,Ubuntu 16.04 TLS aarch64にも入った.
まだPiTunnelは使えてませんが,無料で1ポートだけだとバイナリ一個でokだしngrokの方がいいかなて感じがします.
でも少なくとも機能の多さはこっちが上そう.

VivaldiにVimiumを入れてキーボード操作

最近Linux ARM版のVivaldiをarm64環境に入れていい感じです.

しかし,ポインティングデバイスが使いづらい端末なのでちょっと面倒.これまではAwesome wmにqutebrowserの組み合わせが主でした.この組み合わせはタイル型WM+キーボード操作に特化したウェブブラウザでマウスなどのポインティングデバイスをほとんど使わずキーボードのみで操作できていい感じでした.

Vivaldiにqutebrowserのような操作を実現できそうなVimiumを入れて試してみることに.

導入は アプリ(vivaldi://apps) にアクセスしてVimiumを検索して導入するだけ.
操作は以下のようなショートカットを使います.

Selection_012

リンクの指定もこの通りキーボードだけでOK

Selection_013

いい感じそうです :)

Linux ARM版Vivaldiを入れてみた

20171207_01:12:04-24154

Operaの共同創設者でCEOだったJon Stephenson von Tetzchnerによって設立されたVivaldi Technologiesによって開発されているウェブブラウザがあります.
これまでx86/x64プラットホームのWindows/macOS/Linux版が提供されていましたが,2017/12/05にLinux ARM版(armhf)がリリースされました.

Raspberry PiのRaspbianがメインのようですが,他のARM環境でも試したら普通に動きました :)

といってもやはりRAM512MBのようなマシンでは辛いですね.RAM2GBのマシンだと今のところいい感じそうです.Midoriやqutebrowserでうまく表示できないMastodonやgmail/Google+なども問題なく表示できますし,Chromeの拡張機能も使えます.

Linux ARM版Vivaldiの入手と確認

deb pkgダウンロード

$ wget https://downloads.vivaldi.com/stable/vivaldi-stable_1.13.1008.34-1_armhf.deb

hash

hashとか見当たらないけど手元ではこんな感じだった

$ md5sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
7515f51385a9a264ad5bb7612438aeda  vivaldi-stable_1.13.1008.34-1_armhf.deb
$ sha1sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
6b103d205f6aa7a5f3b394ba8d32dc9ca87bf0cd  vivaldi-stable_1.13.1008.34-1_armhf.deb
$ sha256sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
e7af5d021bf0c2968fcf0271e8f741552e34bcf2d032318eb8ea95356067297d  vivaldi-stable_1.13.1008.34-1_armhf.deb
$ sha512sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
f47f2d26e8045af9ba680129feca765cf3f9dc7ea76930071e9688ef50aa78a482b40ba5747fb4470d30520177bda371ec79e5a210a93dcf2e49251425001c6d  vivaldi-stable_1.13.1008.34-1_armhf.deb

パッケージ情報確認

$ dpkg-deb -I ./vivaldi-stable_1.13.1008.34-1_armhf.deb
 新形式 debian パッケージ、バージョン 2.0。
 サイズ 45154158 バイト: コントロールアーカイブ = 9840 バイト。
    1269 バイト、   16 行      control              
   15872 バイト、  442 行   *  postinst             #!/bin/sh
   12544 バイト、  324 行   *  postrm               #!/bin/sh
    1220 バイト、   42 行   *  prerm                #!/bin/sh
 Package: vivaldi-stable
 Version: 1.13.1008.34-1
 Architecture: armhf
 Maintainer: Vivaldi Package Composer <packager@vivaldi.com>
 Installed-Size: 131921
 Pre-Depends: dpkg (>= 1.14.0)
 Depends: gconf-service, libasound2 (>= 1.0.16), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.16), libcairo2 (>= 1.6.0), libcups2 (>= 1.4.0), libdbus-1-3 (>= 1.2.14), libexpat1 (>= 2.0.1), libfontconfig1 (>= 2.8.0), libgcc1 (>= 1:4.4.0), libgconf-2-4 (>= 3.2.5), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.28.0), libgtk-3-0 (>= 3.9.10), libnspr4 (>= 2:4.9-2~), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0), libx11-6 (>= 2:1.4.99.1), libx11-xcb1, libxcb1 (>= 1.6), libxcomposite1 (>= 1:0.3-1), libxcursor1 (>> 1.1.2), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxi6 (>= 2:1.2.99.4), libxrandr2 (>= 2:1.2.99.3), libxrender1, libxss1, libxtst6, ca-certificates, fonts-liberation, libnss3 (>= 3.26), xdg-utils (>= 1.0.2), wget
 Recommends: adobe-flashplugin, chromium-codecs-ffmpeg-extra
 Conflicts: vivaldi-beta, vivaldi-preview
 Replaces: vivaldi-beta, vivaldi-preview
 Provides: www-browser
 Section: web
 Priority: optional
 Homepage: https://vivaldi.com
 Description: A new browser for our friends
  Vivaldi browser is made with power users in mind by people who love the Web.

導入

とりあえずDebian jessie armhf/Ubuntu 16.04 LTS aarch64で動いている.

Debian/Ubuntu等

$ sudo dpkg -i ./vivaldi-stable_1.13.1008.34-1_armhf.deb

以下のように依存パッケージが足りない場合は,

dpkg: 依存関係の問題により vivaldi-stable:armhf の設定ができません:
 vivaldi-stable:armhf は以下に依存 (depends) します: libnss3 (>= 3.26)...しかし:
  パッケージ libnss3:armhf はまだインストールされていません。

dpkg: パッケージ vivaldi-stable:armhf の処理中にエラーが発生しました (--install):
 依存関係の問題 - 設定を見送ります

こんな感じで足りないpkgが入るはず.その後見送られていたvivaldi-stableの設定の続きも実行される.

$ sudo apt install -f

64bit ARM環境

バージョン情報_009

aarch64でも試した.
既にadd archtecture armhfして色々入れていた環境に入れてクリーンな環境で検証していないけど多分こんな感じ.

$ sudo dpkg --add-architecture armhf
$ sudo apt update
$ sudo dpkg -i ./vivaldi-stable_1.13.1008.34-1_armhf.deb
$ sudo apt install -f

—-追記—-
クリーンなDragonBoard 410cにDebian stretch aarch64(lonaro)を入れた環境でも確認したがこの手順でokだった :)
—-追記終わり—-

.debが使えない環境

deb以外の環境ではこんな感じで適当な場所に展開して動かせた.

$ mkdir -p ~/opt/vivaldi
$ ar p vivaldi-stable_1.13.1008.34-1_armhf.deb data.tar.xz | tar xJ -C ~/opt/vivaldi
$ rm vivaldi-stable_1.13.1008.34-1_armhf.deb
$ ~/opt/vivaldi/opt/vivaldi/vivaldi

Slackwareだと以下のsctiptが使えそう(未確認)

問題

sandbox

もし,こんなエラーが出たら

$ ~/opt/vivaldi/opt/vivaldi/vivaldi
[13021:13021:1205/215600.516642:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/matoken/opt/vivaldi/opt/vivaldi/vivaldi-sandbox is owned by root and has mode 4755.
Aborted[This script will find the latest Vivaldi binary package, download it and repackage it into Slackware format.](https://gist.github.com/ruario/dcbba70da900dac68fcc883542ff7ace "This script will find the latest Vivaldi binary package, download it and repackage it into Slackware format.")

こんな感じでオーナーとパーミッションを設定したらok.

$ chmod 4755 ~/opt/vivaldi/opt/vivaldi/vivaldi-sandbox
$ sudo chown root.root ~/opt/vivaldi/opt/vivaldi/vivaldi-sandbox

若しくは --no-sandbox option

$ ~/opt/vivaldi/opt/vivaldi/vivaldi --no-sandbox

日本語豆腐問題

20171206_06:12:20-506920171206_07:12:16-6600

とりあえず適当な日本語フォント(今回はVLゴシック)を入れて,Vivaldiを再起動で直った.(Dejavuが入っていたので指定してみたけど直らなかった)

$ sudo apt install fonts-vlgothic

関連

clipitが動かなくなっていた

clipit

暫く前からDebian sid amd64環境のclipit(クリップボード・マネージャ)が動かなくなっていました.
端末で実行するとこんな感じ

$ clipit

(clipit:23553): GLib-ERROR **: ../../../../glib/gmem.c:100: failed to allocate 18446744071610537348 bytes
Trace/breakpoint trap

sidだしなんか一時的におかしくなってるのかなととりあえず放置してたんですが暫く経っても直らない.バグレポ見るとこんな感じでそれらしいバグは見当たりません.

Querying Debian BTS for reports on clipit (source)...
7 bug reports found:

Bugs with severity important
  1) #679488  abuses xdg/autostart to get started and cannot be disabled
Bugs with severity normal
  2) #721007  clipit: Wakes up too many times per second and prevents deep sleep of cpu
  3) #771200  clipit: cannot edit 'actions'
  4) #819496  clipit clipboard history is *world* readable
Bugs with severity minor
  5) #658533  clipit: static item ordering
Bugs with severity wishlist
  6) #658532  clipit: manage history items in list view
  7) #875903  clipit: please choose a sensible default in "live" mode?

自分の環境がおかしいのか?ととりあえず設定ファイルを探すとこれのよう.

  • ~/.config/clipit/clipitrc

試しにこのファイルを退避してclipitを実行すると普通に起動しました.
てことで設定ファイルあ壊れていたようです(◞‸◟)

暫く前にinodeあふれさせてしまったのでそのときに壊れたのかもです.

Python Boot CampテキストをUbuntu 16.04 LTSで試す

#kagolug 2017.10で告知のあった「Python Boot Camp in 鹿児島」で使う「Python Boot Campテキスト」を見るとLinuxはUbuntu 17.04 serverがターゲットになっている

1. Pythonをはじめる前に — Python Boot Camp Text 2016.04.28 ドキュメント

1.3.3. Linux (Ubuntu Server) での場合
ここではLinuxとしてUbuntu 17.04にPython3.6をインストールする方法を説明します。

LTSのDesktop使いたい人も居るだろうなとUbuntu 16.04 LTS arm64で一通り確認してみた

「1.3.3. Linux (Ubuntu Server) での場合」のPython導入は以下のように3.5に変更

$ sudo apt update && sudo apt upgrade -y
$ sudo apt -y install python3.5 python3.5-dev python3.5-venv
$ python3.5 -V
Python 3.5.2

「5.1.2. ファイルへの書き込み」でファイルの確認前にflushしないとファイルが空

>>> f.flush()

「5.1.5. 追記モードでの書き込み」でファイルの確認前にflushしないとファイルが更新されない

>>> f.flush()

後は問題無さそう

Debianの場合もstable(stretch)では同じだと思う.Python 3.6はtesting(Buster)以降になるみたい(未確認)

このチュートリアルはBeautifulSoupまでやるので例えばcalibrでニュースサイトをスクレイピングしてKindleに自動転送といったようなレシピも書けるようになりますね :)

鹿児島Linux勉強会 2017.10に参加

鹿児島らぐ鹿児島Linux勉強会 2017.10に参加してきました.

日時

2017-10-14(土) 14:00-17:00(準備撤収時間を含む)

会場

モノづくりスペース TUKUDDO
http://tukuddo.com/

例によって自転車でポタポタと桜島フェリー経由で移動.

火山灰や雨が心配でしたが,往路はどちらも問題なく快適でした.
フェリーでメールチェックをするとパケットが250MBを切ったとのメールが.確認すると残り54MB!想定外の減り方です.
確認するとIFTTTの写真連携がmobileで有効になっていたのが原因でした…….

フェリーで渡った後はイルカ眺めてはなまるうどんでかけうんどん食べて中町自転車等駐輪場に駐輪.ジュンク堂書店に寄って,ACアダプタを忘れたのでダイソーアオヤマで
200円のAC-USB変換を購入(会場の電源タップについていたのでいらなかった)
ダイソーアオヤマでは先月売っていた500円のLipoモバイルバッテリーは売り切れていて,300円の1860入りモバイルバッテリーは在庫豊富でした.
丸善とアニメイトも行きたかったけど時間がなくて断念.会場のTUKUDDOへ.

TUKUDDOでは電源アダプタとプロジェクタの用意.ここはプロジェクタにChromeCastが繋がっているので発表者が変わるたびにケーブルを繋ぎ直したりしなくていいので便利
です :)

参加者は途中参加者を含めて6人.内新規の方が1名いらっしゃいました.

発表内容は,

その他相談として,

などがありました.

自分の発表もう少し伸ばした方が良かったかもと思いつつ脱線しながら時間潰せました.
次回の日程の希望日は特に出ず,早く決めて欲しいという意見が.
とりあえずASNARO-2(イプシロン)打ち上げが延期になったので11/11(Sat)かなーとか言いつつ解散でした.

自分は自転車を回収して県立図書館で本を2冊借りて(キャリアつけ忘れたので少なめに)ニシムタに寄って垂水フェリー経由で帰宅しました.
垂水から雨と風が強くてちょっと難儀しました.雨風は自転車には辛いですね.

次回の情報などはSiteやMLで確認してください.

Vulsの特集あり