Ubuntu – matoken's blog https://matoken.org/blog Is there no plan B? Wed, 13 Apr 2022 22:33:05 +0000 ja hourly 1 https://wordpress.org/?v=6.9.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg Ubuntu – matoken's blog https://matoken.org/blog 32 32 Ubuntu 21.10 -> 22.04のアップグレードに失敗 https://matoken.org/blog/2022/04/14/ubuntu-21-10-22-04-upgrade-failed/ https://matoken.org/blog/2022/04/14/ubuntu-21-10-22-04-upgrade-failed/#respond Wed, 13 Apr 2022 22:29:33 +0000 http://matoken.org/blog/?p=3600

Ubuntu 21.10 amd64 から 22.04(development branch) へのアップグレード時に以下のようなエラーで失敗してしまいました.

unable to open '/usr/share/themes/Yaru/gnome-shell/calendar-today-light.svg.dpkg-new': No such file or directory

Preparing to unpack .../yaru-theme-gnome-shell_22.04.3.1_all.deb ...
Unpacking yaru-theme-gnome-shell (22.04.3.1) over (21.10.2) ...
dpkg: error processing archive /var/cache/apt/archives/yaru-theme-gnome-shell_22.04.3.1_all.deb (--unpack):
 unable to open '/usr/share/themes/Yaru/gnome-shell/calendar-today-light.svg.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
       Errors were encountered while processing:
 /var/cache/apt/archives/yaru-theme-gnome-shell_22.04.3.1_all.deb
.../yaru-theme-gnome-shell_22.04.3.1_all.deb を転換する準備をしています ...
yaru-theme-gnome-shell (22.04.3.1) で (21.10.2 に) 上書き展開しています ...
dpkg: アーカイブ /var/cache/apt/archives/yaru-theme-gnome-shell_22.04.3.1_all.deb の処理中にエラーが発生しました (--install):
 '/usr/share/themes/Yaru/gnome-shell/calendar-today-light.svg.dpkg-new' をオープンできません: そのようなファイルやディレクトリはありません
処理中にエラーが発生しました:
/var/cache/apt/archives/yaru-theme-gnome-shell_22.04.3.1_all.deb

エラーメッセージで検索すると以下のBugが見つかりました.

とりあえず添付された.debをダウンロードしてdpkgで導入すれば良さそうです.

$ wget https://bugs.launchpad.net/ubuntu/+source/yaru-theme/+bug/1968405/+attachment/5580229/+files/yaru-theme-gnome-shell_22.04.3.1+git2ff06a41_all.deb
$ sudo dpkg -i ./yaru-theme-gnome-shell_22.04.3.1+git2ff06a41_all.deb
$ sudo apt --fix-broken install
  :
$ sudo apt dist-upgrade
  :

若しくは少し待ってリポジトリに反映されるのを待ちましょう.

環境
$ lsb_release -dr
Description:    Ubuntu 21.10
Release:        21.10
$ arch
x86_64
]]>
https://matoken.org/blog/2022/04/14/ubuntu-21-10-22-04-upgrade-failed/feed/ 0
rmadison でパッケージのバージョンを確認 https://matoken.org/blog/2022/03/03/check-the-package-version-with-rmadison/ https://matoken.org/blog/2022/03/03/check-the-package-version-with-rmadison/#respond Thu, 03 Mar 2022 14:10:32 +0000 http://matoken.org/blog/?p=3504

Twitterで rmadison というコマンドを教えてもらいました.

rmadison はリモートのデータベースにアクセスしてパッケージのバージョン情報を表示してくれるコマンドで,Debianでは devscripts パッケージに含まれています.

$ rmadison --help
Usage: rmadison [OPTION] PACKAGE[...]
Display information about PACKAGE(s).

  -a, --architecture=ARCH    only show info for ARCH(s)
  -b, --binary-type=TYPE     only show info for binary TYPE
  -c, --component=COMPONENT  only show info for COMPONENT(s)
  -g, --greaterorequal       show buildd 'dep-wait pkg >= {highest version}' info
  -G, --greaterthan          show buildd 'dep-wait pkg >> {highest version}' info
  -h, --help                 show this help and exit
  -r, --regex                treat PACKAGE as a regex [not supported everywhere]
  -s, --suite=SUITE          only show info for this suite
  -S, --source-and-binary    show info for the binary children of source pkgs
  -t, --time                 show projectb snapshot date
  -u, --url=URL              use URL instead of debian

  --noconf, --no-conf        don't read devscripts configuration files

ARCH, COMPONENT and SUITE can be comma (or space) separated lists, e.g.
    --architecture=m68k,i386

Aliases for URLs:
        debian  https://api.ftp-master.debian.org/madison
        new     https://api.ftp-master.debian.org/madison?s=new
        qa      https://qa.debian.org/madison.php
        ubuntu  https://people.canonical.com/~ubuntu-archive/madison.cgi
        udd     https://qa.debian.org/cgi-bin/madison.cgi

例えば OpenSSH を指定するとこんな感じでtesting以降に 8.9p1 が来ているのが分かります.

a$ rmadison openssh
openssh    | 1:6.7p1-5+deb8u4   | oldoldoldstable        | source
openssh    | 1:7.4p1-10+deb9u7  | oldoldstable           | source
openssh    | 1:7.4p1-10+deb9u7  | oldoldstable-debug     | source
openssh    | 1:7.9p1-10+deb10u2 | oldstable              | source
openssh    | 1:7.9p1-10+deb10u2 | oldstable-debug        | source
openssh    | 1:8.4p1-2~bpo10+1  | buster-backports       | source
openssh    | 1:8.4p1-2~bpo10+1  | buster-backports-debug | source
openssh    | 1:8.4p1-5          | stable                 | source
openssh    | 1:8.8p1-1          | testing                | source
openssh    | 1:8.9p1-3          | unstable               | source
openssh    | 1:8.9p1-3          | unstable-debug         | source

urlを指定することでUbuntuの情報も

$ rmadison -u https://people.canonical.com/~ubuntu-archive/madison.cgi openssh
 openssh | 1:6.6p1-2ubuntu1    | trusty          | source
 openssh | 1:6.6p1-2ubuntu2.13 | trusty-security | source
 openssh | 1:6.6p1-2ubuntu2.13 | trusty-updates  | source
 openssh | 1:7.2p2-4           | xenial          | source
 openssh | 1:7.2p2-4ubuntu2.8  | xenial-security | source
 openssh | 1:7.2p2-4ubuntu2.10 | xenial-updates  | source
 openssh | 1:7.6p1-4           | bionic          | source
 openssh | 1:7.6p1-4ubuntu0.5  | bionic-security | source
 openssh | 1:7.6p1-4ubuntu0.6  | bionic-proposed | source
 openssh | 1:7.6p1-4ubuntu0.6  | bionic-updates  | source
 openssh | 1:8.2p1-4           | focal           | source
 openssh | 1:8.2p1-4ubuntu0.2  | focal-security  | source
 openssh | 1:8.2p1-4ubuntu0.4  | focal-updates   | source
 openssh | 1:8.4p1-6ubuntu2    | impish          | source
 openssh | 1:8.4p1-6ubuntu2.1  | impish-updates  | source
 openssh | 1:8.8p1-1           | jammy           | source
 openssh | 1:8.9p1-3           | jammy-proposed  | source

リモートの情報を取得しに行くので回線がないと使えません.

$ https_proxy='dummy' rmadison openssh
curl: (5) Could not resolve proxy: dummy

こういった情報はこれまで https://packages.debian.org/ にアクセスして確認していたので便利になりました :)

$ w3m -dump https://packages.debian.org/openssh-server | grep ^Package\ openssh-server$ -A24
Package openssh-server

  • stretch (oldoldstable) (net): secure shell (SSH) server, for secure access
    from remote machines
    1:7.4p1-10+deb9u7: amd64 arm64 armel armhf i386 mips mips64el mipsel
    ppc64el s390x
  • buster (oldstable) (net): secure shell (SSH) server, for secure access from
    remote machines
    1:7.9p1-10+deb10u2: amd64 arm64 armel armhf i386 mips mips64el mipsel
    ppc64el s390x
  • buster-backports (net): secure shell (SSH) server, for secure access from
    remote machines
    1:8.4p1-2~bpo10+1: amd64 arm64 armel armhf i386 mips mips64el mipsel
    ppc64el s390x
  • bullseye (stable) (net): secure shell (SSH) server, for secure access from
    remote machines
    1:8.4p1-5: amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x
  • bookworm (testing) (net): secure shell (SSH) server, for secure access from
    remote machines
    1:8.8p1-1: amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x
  • sid (unstable) (net): secure shell (SSH) server, for secure access from
    remote machines
    1:8.9p1-3: alpha amd64 arm64 armel armhf hppa i386 ia64 m68k mips64el
    mipsel ppc64 ppc64el riscv64 s390x sh4 sparc64 x32
環境
dison --version
rmadison 0.4 (devscripts 2.22.1)
(C) 2006-2010 Christoph Berg <myon@debian.org>
(C) 2010 Uli Martens <uli@youam.net>
$ dpkg-query -W devscripts
devscripts      2.22.1
$ lsb_release -dr
Description:    Debian GNU/Linux bookworm/sid
Release:        unstable
$ arch
x86_64
]]>
https://matoken.org/blog/2022/03/03/check-the-package-version-with-rmadison/feed/ 0
Ubuntu 19.10 Eoan Ermine リリース https://matoken.org/blog/2019/10/18/ubuntu-19-10-eoan-ermine-release/ https://matoken.org/blog/2019/10/18/ubuntu-19-10-eoan-ermine-release/#respond Thu, 17 Oct 2019 20:45:31 +0000 http://matoken.org/blog/?p=2575

Ermine lines by Gustavo Brenner

予定通り Ubuntu 19.10 Eoan Ermine がリリースされました.

個人的なトピックはi386 archtectureがサポートされなくなった,インストーラでのZFS root対応,Raspberry Pi 4対応辺り,環境があればWPA3対応,NVIDIA driverのインストーラー同梱も便利そうです.

問題点で気になるところはログイン画面でシャットダウン,再起動が出来ないところや Raspberry Pi 3 A+ が起動できなくなっているあたりでしょうか.どちらもバグ扱いになっているので近いうちに修正されるでしょう.

19.10は通常リリースでサポート期間も9ヶ月しか無いですし大体の人はLTSな18.04か20.04を待ったほうがいいでしょうが,新しい機能を試してみたい人は楽しめるのではないでしょうか.

ubuntu 19.10 neofetch

]]>
https://matoken.org/blog/2019/10/18/ubuntu-19-10-eoan-ermine-release/feed/ 0
Ubuntu 19.10 (Eoan Ermine)のインストーラにZFSの選択肢が https://matoken.org/blog/2019/10/13/ubuntu-19-10-eaon-ermine-installer-has-zfs-option/ https://matoken.org/blog/2019/10/13/ubuntu-19-10-eaon-ermine-installer-has-zfs-option/#respond Sat, 12 Oct 2019 17:32:41 +0000 http://matoken.org/blog/?p=2560

Ubuntu 19.10のインストーラでZFSを選択できるようになったと見かけて試してみました.

現在BETAのインストーラ( Ubuntu 19.10 (Eoan Ermine) Beta )には未だ入っていなくて,dailyのみのようです.
今回は daily-live 20191011 を利用しました.

イメージを入手して確認
$ wget -c http://cdimage.ubuntu.com/ubuntu/daily-live/20191011/SHA256SUMS \
          http://cdimage.ubuntu.com/ubuntu/daily-live/20191011/SHA256SUMS.gpg \
          http://cdimage.ubuntu.com/ubuntu/daily-live/20191011/eoan-desktop-amd64.iso
$ sha256sum -c SHA256SUMS
eoan-desktop-amd64.iso: OK
$ gpgv --keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg ./SHA256SUMS.gpg ./SHA256SUMS
gpgv: Signature made Fri 11 Oct 2019 04:48:37 PM JST
gpgv:                using DSA key 46181433FBB75451
gpgv: Can't check signature: No public key
gpgv: Signature made Fri 11 Oct 2019 04:48:37 PM JST
gpgv:                using RSA key D94AA3F0EFE21092
gpgv: Good signature from "Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>"

インストーラを起動して画面を進めていくと,「インストールの種類」でZFSの選択がありました.
eaon zfs Screenshot ubuntu19.04 2019 10 13 00:55:43

EXPERIMENTAL: Erase disk and use ZFS
Warning: This will delete all your files on all operating systems, This is experimental and ma cause data loss. Do not use on production systems.

仮想マシンのテスト環境なのでZFSを選んで進めます.

eaon zfs 20191013 01:10:48 17155

確認画面のメッセージが ext4 になっていますがそのまま進めるとZFSになったのでメッセージの書き換えがまだされていないのでしょう.

よく見たら vda1 のことでここは /boot/grub に割り当てられていました.

$ mount |grep vda1
/dev/vda1 on /boot/grub type ext4 (rw,relatime,errors=remount-ro)

add)
解りにくからってことでバグとして上がっていました.20.04で修正されそう.

  • Bug #1847719 “zfs “Write to change disks” message prints that an…” : Bugs : ubiquity package : Ubuntu
  • インストールが終了してインストーラからの再起動でフリーズしたようで1時間ほど前っても進まなかったので強制再起動しましたが無事起動しました.

    eaon zfs 20191013 01:10:30 12924

    ファイルシステムもZFSになっています :)
    eaon zfs Screenshot ubuntu19.04 2019 10 13 01:35:03

    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu Eoan Ermine (development branch)
    Release:        19.10
    Codename:       eoan
    $ sudo fdisk -l /dev/vda
    Disk /dev/vda: 15 GiB, 16106127360 bytes, 31457280 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: 0xc32b4703
    
    Device     Boot   Start      End  Sectors Size Id Type
    /dev/vda1  *       2048   104447   102400  50M 83 Linux
    /dev/vda2        104448 31457279 31352832  15G  5 Extended
    /dev/vda5        106496  4300799  4194304   2G a5 FreeBSD
    /dev/vda6       4302848 31457279 27154432  13G a5 FreeBSD
    $ zfs list
    NAME                                               USED  AVAIL     REFER  MOUNTPOINT
    bpool                                             65.6M  1.69G      176K  /boot
    bpool/BOOT                                        64.9M  1.69G      176K  none
    bpool/BOOT/ubuntu_qblb6g                          64.7M  1.69G     64.7M  /boot
    rpool                                             3.31G  8.80G       96K  /
    rpool/ROOT                                        2.57G  8.80G       96K  none
    rpool/ROOT/ubuntu_qblb6g                          2.57G  8.80G     2.09G  /
    rpool/ROOT/ubuntu_qblb6g/srv                        96K  8.80G       96K  /srv
    rpool/ROOT/ubuntu_qblb6g/usr                       200K  8.80G       96K  /usr
    rpool/ROOT/ubuntu_qblb6g/usr/local                 104K  8.80G      104K  /usr/local
    rpool/ROOT/ubuntu_qblb6g/var                       486M  8.80G       96K  /var
    rpool/ROOT/ubuntu_qblb6g/var/games                  96K  8.80G       96K  /var/games
    rpool/ROOT/ubuntu_qblb6g/var/lib                   484M  8.80G      378M  /var/lib
    rpool/ROOT/ubuntu_qblb6g/var/lib/AccountServices    96K  8.80G       96K  /var/lib/AccountServices
    rpool/ROOT/ubuntu_qblb6g/var/lib/NetworkManager    136K  8.80G      136K  /var/lib/NetworkManager
    rpool/ROOT/ubuntu_qblb6g/var/lib/apt              75.8M  8.80G     75.8M  /var/lib/apt
    rpool/ROOT/ubuntu_qblb6g/var/lib/dpkg             29.9M  8.80G     29.9M  /var/lib/dpkg
    rpool/ROOT/ubuntu_qblb6g/var/log                  2.07M  8.80G     2.07M  /var/log
    rpool/ROOT/ubuntu_qblb6g/var/mail                   96K  8.80G       96K  /var/mail
    rpool/ROOT/ubuntu_qblb6g/var/snap                  112K  8.80G      112K  /var/snap
    rpool/ROOT/ubuntu_qblb6g/var/spool                 112K  8.80G      112K  /var/spool
    rpool/ROOT/ubuntu_qblb6g/var/www                    96K  8.80G       96K  /var/www
    rpool/USERDATA                                    2.93M  8.80G       96K  /
    rpool/USERDATA/matoken_vyi27f                     2.72M  8.80G     2.72M  /home/matoken
    rpool/USERDATA/root_vyi27f                         112K  8.80G      112K  /root
    rpool/swap                                         758M  9.54G       92K  -
    $ dpkg -l|grep -i zfs
    ii  libzfs2linux                               0.8.1-1ubuntu13                      amd64        OpenZFS filesystem library for Linux
    ii  libzpool2linux                             0.8.1-1ubuntu13                      amd64        OpenZFS pool library for Linux
    ii  zfs-initramfs                              0.8.1-1ubuntu13                      amd64        OpenZFS root filesystem capabilities for Linux - initramfs
    ii  zfs-zed                                    0.8.1-1ubuntu13                      amd64        OpenZFS Event Daemon
    ii  zfsutils-linux                             0.8.1-1ubuntu13                      amd64        command-line tools to manage OpenZFS filesystems

    実機のeaon環境が1つあるのでこれをインストールし直してZFSを試すのもいいかもしれません.でもその環境はRAMが少ないので辛いかな?

    ]]>
    https://matoken.org/blog/2019/10/13/ubuntu-19-10-eaon-ermine-installer-has-zfs-option/feed/ 0
    Ubuntu 19.10 の initramfs-tools から dm-crypt 領域が見つからずエラーとなる https://matoken.org/blog/2019/08/06/the-dm-crypt-area-is-not-found-from-ubuntu-19-10-initramfs-tools-and-an-error-occurs/ https://matoken.org/blog/2019/08/06/the-dm-crypt-area-is-not-found-from-ubuntu-19-10-initramfs-tools-and-an-error-occurs/#respond Mon, 05 Aug 2019 16:16:09 +0000 http://matoken.org/blog/?p=2456

    Ubuntu 19.10 amd64 環境でapt upgrade でエラーになります.
    新しいKernel が降りてきてinitramfs のところでdm-crypy 領域が見つからない感じのようです.

    initramfs-tools (0.133ubuntu9) のトリガを処理しています ...
    update-initramfs: Generating /boot/initrd.img-5.2.0-8-generic
    cryptsetup: ERROR: Couldn't resolve device
      /dev/disk/by-uuid/805938be-2c29-4a53-9ed2-36fb233d76ea
    cryptsetup: ERROR: Couldn't resolve device
      UUID=31145c5b-93fc-4fe0-9e46-3a68bfcadeae
    W: initramfs-tools configuration sets RESUME=UUID=31145c5b-93fc-4fe0-9e46-3a68bfcadeae
    W: but no matching swap device is available.
    処理中にエラーが発生しました:

    エラーメッセージで検索すると以下のページを発見.

    The problem is that cryptsetup is not supported in the /etc/initramfs-tools/initramfs.conf configuration anymore.

    The new location for loading dm-crypt during boot is /etc/cryptsetup-initramfs/conf-hook

    CRYPTSETUP=y

    you’ll see it in the conf-hook file commented out, just set it as above and it will work again.

    If you build a system with encryption, I believe this gets changed at some point, but the live builds are systems that are not built like this, and there isn’t a lot to go on to direct you to make this change.

    When you set that and re-make your iso image, you’ll be able to do encrypted persistence again. Worked for me on latest Kali January 2019. :-)

    なるほど,この環境はいつも development branch にしているのでこの問題に当たったようですね.

    /etc/cryptsetup-initramfs/conf-hookCRYPTSETUP=y と編集して,

    $ sudo vi /etc/cryptsetup-initramfs/conf-hook
    $ sudo git diff HEAD /etc/cryptsetup-initramfs/conf-hook
    diff --git a/cryptsetup-initramfs/conf-hook b/cryptsetup-initramfs/conf-hook
    index 8a6a474..fdd7920 100644
    --- a/cryptsetup-initramfs/conf-hook
    +++ b/cryptsetup-initramfs/conf-hook
    @@ -15,7 +15,7 @@
     # cryptsetup initramfs integration.
     #
    
    -#CRYPTSETUP=
    +CRYPTSETUP=y
    
     #
     # KEYFILE_PATTERN: ...

    apt でfix-broken を掛けると正常にinitramfs が通り,再起動して新しいkernal で起動しました :)

    $ sudo apt install -f
    環境
    $ dpkg-query -W cryptsetup* initramfs-tools*
    cryptsetup      2:2.1.0-5ubuntu2
    cryptsetup-bin  2:2.1.0-5ubuntu2
    cryptsetup-initramfs    2:2.1.0-5ubuntu2
    cryptsetup-run  2:2.1.0-5ubuntu2
    initramfs-tools 0.133ubuntu9
    initramfs-tools-bin     0.133ubuntu9
    initramfs-tools-core    0.133ubuntu9
    $ lsb_release -dr
    Description:    Ubuntu Eoan Ermine (development branch)
    Release:        19.10
    $ uname -m
    x86_64

    ]]>
    https://matoken.org/blog/2019/08/06/the-dm-crypt-area-is-not-found-from-ubuntu-19-10-initramfs-tools-and-an-error-occurs/feed/ 0
    Ubuntu Server インストーラの Github, Launchpad からの ssh公開鍵インポート機能 https://matoken.org/blog/2019/03/31/ssh-public-key-import-function-from-ubuntu-server-installer-github-launchpad/ https://matoken.org/blog/2019/03/31/ssh-public-key-import-function-from-ubuntu-server-installer-github-launchpad/#comments Sun, 31 Mar 2019 03:36:06 +0000 http://matoken.org/blog/?p=2354

    github.com/settings/keys からSSH Keyとして突っ込んどくと便利だし、今のUbuntu Serverはセットアップでそれを使う項目すらあるので

    なるほど便利そう
    試してみようと Ubuntu Server 18.04.2 LTS
    (ubuntu-18.04.2-live-server-amd64.iso) のインストーラで試してみました.

    OpenSSH を導入するようにすると,SSH鍵をインポートするオプションで Github / Launchpad が選べます.
    Screenshot ubuntu18 04 2019 03 30 13 02 56

    こんな感じでインポートされました.
    Screenshot ubuntu18 04 2019 03 30 13 05 37

    インストールが終了して ssh login するとインポートされた鍵で login 出来ました.

    インポートされた公開鍵を確認するとコメント部分が少し書き換わっています.

    $ cat ~/.ssh/authorized_keys
    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPgwY9aZPxN/YoBBzd7TOcCk7EuGO0E9PuUjCHPtTuHP matoken@github/16598604 # ssh-import-id gh:matoken
    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEoKnbjj7cVafcAJbYHqUEua1x/81uzoK0LnjgqmR6H8 matoken@github/33364582 # ssh-import-id gh:matoken

    sshd_config を見ると編集ではなく末尾に追記してるのでちょっと雑い感.

    $ grep PasswordAuthentication /etc/ssh/sshd_config
    #PasswordAuthentication yes
    # PasswordAuthentication.  Depending on your PAM configuration,
    # PAM authentication, then enable this but set PasswordAuthentication
    PasswordAuthentication no
    $ tail -1 /etc/ssh/sshd_config
    PasswordAuthentication no

    ちなみに,Github から鍵を入手するのはこんな感じで行けるようです.
    (<USERNAME>部分を該当ユーザ名に修正)

    Launchpad はこんな感じ.

    ちなみにLaunchpad は未だED25519形式には未対応なようです.
    20190330 13 03 12 27418

    Bitbucket の鍵も同様に https://api.bitbucket.org/2.0/users/<USERNAME>/ssh-keys で入手できそうと思ったのですが,未認証では駄目みたいです.

    $ curl -s https://api.bitbucket.org/2.0/users/matoken/ssh-keys|jq
    {
      "type": "error",
      "error": {
        "message": "This API is only accessible with the following authentication types: session, password, apppassword"
      }
    }
    環境
    $ lsb_release -d
    Description:	Ubuntu 18.04.2 LTS
    $ uname -m
    x86_64

    ]]>
    https://matoken.org/blog/2019/03/31/ssh-public-key-import-function-from-ubuntu-server-installer-github-launchpad/feed/ 1
    Debian, Ubuntu で 上流のパッケージを借りてくる https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/ https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/#comments Tue, 23 Oct 2018 14:10:12 +0000 http://matoken.org/blog/?p=2190

    以前以下のような記事を書きました.

    今でもこのblogの中ではアクセスが多く,最近もトラックバックをもらいました.

    この当時は arm64 の mozcパッケージがなくて自分でbuild したという話なのですが,現在はDebian では buster(testing), Ubuntu ではartful(17.10) 以降でパッケージが存在します.
    なのでこの野良パッケージを使うよりも公式の上流パッケージを借りるほうが大抵の場合いいと思います.
    ということで手順を書いておきます.

    パッケージファイルだけが必要な場合はパッケージのページからダウンロード可能です.

    野良パッケージは近日中に削除します.

    Debian stretch arm64 に Debian buster arm64 の mozc を借りてくる

    Debian stretch arm64 では mozc-data しかない
    $ apt-cache search mozc
    mozc-data - Mozc input method - data files

    buster(testing) のmozc を借りてくることにする.

    /etc/apt/preferences で buster の優先度を下げる

    /etc/apt/preferences
    Package: *
    Pin: release n=buster
    Pin-Priority: 100
    /etc/apt/sources.list に buster(testing)追加 設定
    deb http://deb.debian.org/debian buster main

    sources.list の編集には apt edit-sources を使うと文法チェックをしてくれるのでおすすめ

    パッケージ情報の更新
    $ sudo apt update
    mozcパッケージの確認
    $ apt-cache search mozc
    mozc-data - Mozc input method - data files
    fcitx-dbus-status - Addon for Fcitx to set/get/monitor IM statuses via D-Bus
    emacs-mozc - Mozc for Emacs
    emacs-mozc-bin - Helper module for emacs-mozc
    fcitx-mozc - Mozc engine for fcitx - Client of the Mozc input method
    ibus-mozc - Mozc engine for IBus - Client of the Mozc input method
    mozc-server - Server of the Mozc input method
    mozc-utils-gui - GUI utilities of the Mozc input method
    uim-mozc - Mozc engine for uim - Client of the Mozc input method
    パッケージの導入
    $ apt install fcitx-mozc -t buster

    後は通常の apt update && apt upgrade で stretch で導入したパッケージは stretch で,buster で導入したパッケージはbuster で更新されるはず.

    Ubuntu 16.04 LTS xenial arm64 に Ubuntu 18.04 LTS bionic arm64 の mozc を借りてくる

    Debianの手順と同じでもokだと思うけど念の為以下の手順を真似してみる.

    mozc は Ubuntu 17.10 artful から対応しているが,もうサポートされないのでUbuntu 18.04 bionic を使う.

    標準のリリースを xenial に設定

    /etc/apt/apt.conf.d/01ubuntu
    APT::Default-Release "xenial";

    mozc をpinningする

    /etc/apt/preferences
    Package: *mozc*
    Pin: release n=xenial
    Pin-Priority: -10
    
    Package: *mozc*
    Pin: release n=bionic
    Pin-Priority: 900

    /etc/apt/sources.list に buster(testing) を 追加 設定

    /etc/apt/sources.list
    deb http://ports.ubuntu.com/ bionic main universe

    ※sources.list の編集には apt edit-sources を使うと文法チェックをしてくれるのでおすすめ
    ※mirrorにより arm64 が置かれていないので注意

    パッケージ情報の更新
    $ sudo apt update
    検索結果にmozcが出てくる
    $ apt-cache search mozc
    mozc-data - Mozc input method - data files
    ibus-mozc - Mozc engine for IBus - Client of the Mozc input method
    mozc-server - Server of the Mozc input method
    mozc-utils-gui - GUI utilities of the Mozc input method
    emacs-mozc - Mozc for Emacs
    emacs-mozc-bin - Helper module for emacs-mozc
    fcitx-mozc - Mozc engine for fcitx - Client of the Mozc input method
    uim-mozc - Mozc engine for uim - Client of the Mozc input method
    パッケージの導入
    $ sudo apt install fcitx-mozc -t bionic
    ]]>
    https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/feed/ 2
    パスワードジェネレーターコマンド apg のオプションメモ https://matoken.org/blog/2017/08/01/apg-command-option/ https://matoken.org/blog/2017/08/01/apg-command-option/#respond Mon, 31 Jul 2017 20:57:12 +0000 http://matoken.org/blog/?p=1628

    新しいマシンの設定するときに調べ直したメモ.

    よく使うオプション

    • -a パスワードアルゴリズムの指定

      • 0 発音可能

      • 1 ランダム

    • -n パスワード生成数

    • -m パスワード最低文字長

    • -x パスワード最大文字長

    • -M 文字の種類を指定

      • S 必ず記号を利用

      • s 記号を利用

      • N 必ず数字を利用

      • n 数字を利用

      • C 必ず英大文字を利用

      • c 英大文字を利用

      • L 必ず英小文字を利用

      • l 英小文字を利用

    • -E 指定した文字を利用しない(複数指定可能)

    記号のみ

    $ apg -Ms -a1
    #/^>,\../
    \^./\{~<
    %(_/_%_]]`
    =..,;[$('
    "$$$"<!]~
    -%\?`_++<<
    $ apg -MS -a1
    ,/.>[@;%@`
    @,$(_/*_.
    ``'"}=*%#
    [#|,'@?"-
    ,?];"]]&?@
    [)'$@>'{/}

    数字のみ

    $ apg -Mn -a1
    14683511
    97138910
    5192942105
    3010244799
    381484337
    493808346
    $ apg -MN -a1
    5426157541
    03163967
    98161665
    369810970
    38523677
    249810992

    英大文字のみ

    $ apg -Mc -a1
    GBUDJODXIH
    RMEUJNHKQM
    OJHCTVJR
    HPWKCOLD
    ZAPCGYWCNA
    WIOKVXDTZW
    $ apg -MC -a1
    KOQOVOSAJB
    IWWQSBTL
    IPUFNTGP
    GMKFKXIJKT
    OWVNYNFL
    QLVOAUEMSU

    英子文字のみ

    $ apg -Ml -a1
    uviqxdrc
    tukfvlona
    mzmwjjhe
    jtssfdla
    qmzjxlet
    rzzxjvnyr
    $ apg -ML -a1
    wivxbkdpe
    xnvdepbhro
    wclwdrofjk
    dorabarzdc
    zedblcjp
    ibwmgwwrv

    記号数字英大文字小文字を必ず含む

    $ apg -MSNCL
    8dromKaix"
    in2OfKain;
    {on1Woan
    Peow9Ot_
    |owpIpVap9
    7OnryubAp`

    パスワード長最低11文字

    $ apg -MSNCL -m11
    DiOfnu1Miv>
    @okshEcWew0
    cosh1olbIm^
    forkow0Oll^
    'Obpiugtut1
    ItEdd`dros0

    パスワード文字長11〜16文字

    apg -MSNCL -m11 -x16
    bywax|biggIp3
    yik7henvecJavUj"
    8lawhasBokPyft^
    yijTysFeg5oj%
    8quactArnyobpec?
    abGaj9etsyic)

    覚え方も併記

    $ apg -MSNCL -m11 -l
    rawd9<FriWa romeo-alfa-whiskey-delta-NINE-LESS_THAN-Foxtrot-romeo-india-Whiskey-alfa
    `shnoandOg1 GRAVE-sierra-hotel-november-oscar-alfa-november-delta-Oscar-golf-ONE
    Rudwem9Gon! Romeo-uniform-delta-whiskey-echo-mike-NINE-Golf-oscar-november-EXCLAMATION_POINT
    8OjsewJerj, EIGHT-Oscar-juliett-sierra-echo-whiskey-Juliett-echo-romeo-juliett-COMMA
    mayng1WiUb^ mike-alfa-yankee-november-golf-ONE-Whiskey-india-Uniform-bravo-CIRCUMFLEX
    Dams9Odcan- Delta-alfa-mike-sierra-NINE-Oscar-delta-charlie-alfa-november-HYPHEN

    パスワードの生成数を20に

    $ apg -MSNCL -m11 -l -n20
    3OcMu7twad` THREE-Oscar-charlie-Mike-uniform-SEVEN-tango-whiskey-alfa-delta-GRAVE
    Fed8Twygub; Foxtrot-echo-delta-EIGHT-Tango-whiskey-yankee-golf-uniform-bravo-SEMICOLON
    Re^SwibTim9 Romeo-echo-CIRCUMFLEX-Sierra-whiskey-india-bravo-Tango-india-mike-NINE
    ~trirv2Dosh TILDE-tango-romeo-india-romeo-victor-TWO-Delta-oscar-sierra-hotel
    Rot%slocOv1 Romeo-oscar-tango-PERCENT_SIGN-sierra-lima-oscar-charlie-Oscar-victor-ONE
    5Knu.BijKue FIVE-Kilo-november-uniform-PERIOD-Bravo-india-juliett-Kilo-uniform-echo
    !olf6Fobviv EXCLAMATION_POINT-oscar-lima-foxtrot-SIX-Foxtrot-oscar-bravo-victor-india-victor
    _HemJefGej4 UNDERSCORE-Hotel-echo-mike-Juliett-echo-foxtrot-Golf-echo-juliett-FOUR
    8drydOdlec| EIGHT-delta-romeo-yankee-delta-Oscar-delta-lima-echo-charlie-VERTICAL_BAR
    mud2FridOn= mike-uniform-delta-TWO-Foxtrot-romeo-india-delta-Oscar-november-EQUAL_SIGN
    ic:GrubFek6 india-charlie-COLON-Golf-romeo-uniform-bravo-Foxtrot-echo-kilo-SIX
    playb(Blos4 papa-lima-alfa-yankee-bravo-LEFT_PARENTHESIS-Bravo-lima-oscar-sierra-FOUR
    KajCedd<od8 Kilo-alfa-juliett-Charlie-echo-delta-delta-LESS_THAN-oscar-delta-EIGHT
    Num>ObAind4 November-uniform-mike-GREATER_THAN-Oscar-bravo-Alfa-india-november-delta-FOUR
    0Quoorc=gro ZERO-Quebec-uniform-oscar-oscar-romeo-charlie-EQUAL_SIGN-golf-romeo-oscar
    Ocweecs_El4 Oscar-charlie-whiskey-echo-echo-charlie-sierra-UNDERSCORE-Echo-lima-FOUR
    Jirk,Kneip7 Juliett-india-romeo-kilo-COMMA-Kilo-november-echo-india-papa-SEVEN
    Marb?Bluch1 Mike-alfa-romeo-bravo-QUESTION_MARK-Bravo-lima-uniform-charlie-hotel-ONE
    gabGon:Jep9 golf-alfa-bravo-Golf-oscar-november-COLON-Juliett-echo-papa-NINE
    #utvabVert2 CROSSHATCH-uniform-tango-victor-alfa-bravo-Victor-echo-romeo-tango-TWO

    指定した文字を含めない

    $ apg -MSNCL -m11 -E1l!
    Mobad3ubUj,
    Ji3vin@Oraj
    rap&OnIarb4
    banip4UvAd(
    Deugh[ixEn8
    mojAw{osev5

    aliasに設定

    aliasに設定しておくと便利.

    以下はbashに設定した例
    $ echo 'alias apg="apg -MSNCL -m11"' | tee -a ~/.bashrc
    alias apg="apg -MSNCL -m11"
    設定反映(もしくはログインし直し)
    $ source ~/.bashrc
    $ alias | grep apg
    alias apg='apg -MSNCL -m11'
    動作確認
    $ apg
    EcsAr)Gruk9
    Toym7Blyft%
    phiet'ijEg4
    wimDu[Neeb4
    niUds/Odav2
    notCeit!oc6
    オプションを追加することも出来る
    $ apg -l
    6Drowm`twup SIX-Delta-romeo-oscar-whiskey-mike-GRAVE-tango-whiskey-uniform-papa
    twar1mu^Mel tango-whiskey-alfa-romeo-ONE-mike-uniform-CIRCUMFLEX-Mike-echo-lima
    Upumwik?Oc4 Uniform-papa-uniform-mike-whiskey-india-kilo-QUESTION_MARK-Oscar-charlie-FOUR
    cyx4Odcaff) charlie-yankee-x_ray-FOUR-Oscar-delta-charlie-alfa-foxtrot-foxtrot-RIGHT_PARENTHESIS
    6drebIt/quo SIX-delta-romeo-echo-bravo-India-tango-SLASH-quebec-uniform-oscar
    5Ofdiatilg' FIVE-Oscar-foxtrot-delta-india-alfa-tango-india-lima-golf-APOSTROPHE
    一時的にaliasを無効に
    $ \apg
    stintun0Oc? (stint-un-ZERO-Oc-QUESTION_MARK)
    FlewUcyibr&Op0 (Flew-Uc-yibr-AMPERSAND-Op-ZERO)
    Ont3okDeadGeg~ (Ont-THREE-ok-Dead-Geg-TILDE)
    reginkAl#twew5 (reg-ink-Al-CROSSHATCH-twew-FIVE)
    "4KnapavAvTil (QUOTATION_MARK-FOUR-Knap-av-Av-Til)
    Frol9Swec\ (Frol-NINE-Swec-BACKSLASH)

    環境

    $ apg -v
    APG (Automated Password Generator)
    version 2.2.3 (PRNG: X9.17/SHA-1)
    Copyright (c) 1999, 2000, 2001, 2002, 2003 Adel I. Mirzazhanov
    $ apt show apg
    Package: apg
    Version: 2.2.3.dfsg.1-4
    Priority: optional
    Section: admin
    Origin: Ubuntu
    Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
    Original-Maintainer: Marc Haber <mh+debian-packages@zugschlus.de>
    Bugs: https://bugs.launchpad.net/ubuntu/+filebug
    Installed-Size: 137 kB
    Depends: libc6 (>= 2.14)
    Homepage: http://www.adel.nursat.kz/apg/
    Task: ubuntu-desktop, ubuntu-usb, edubuntu-desktop, edubuntu-usb, ubuntu-gnome-desktop, ubuntu-touch, ubuntukylin-desktop, ubun
    tu-budgie-desktop
    Supported: 9m
    Download-Size: 50.2 kB
    APT-Manual-Installed: no
    APT-Sources: http://jp.archive.ubuntu.com/ubuntu artful/main amd64 Packages
    Description: 自動パスワード生成器 - スタンドアロン版
     APG (Automated Password Generator) is the tool set for random password generation. It generates some random words of required
    type and prints them to standard output. This binary package contains only the standalone version of apg. Advantages:
      * Built-in ANSI X9.17 RNG (Random Number Generator)(CAST/SHA1)
      * Built-in password quality checking system (now it has support for Bloom
        filter for faster access)
      * Two Password Generation Algorithms:
         1. Pronounceable Password Generation Algorithm (according to NIST
            FIPS 181)
         2. Random Character Password Generation Algorithm with 35
            configurable modes of operation
      * Configurable password length parameters
      * Configurable amount of generated passwords
      * Ability to initialize RNG with user string
      * Support for /dev/random
      * Ability to crypt() generated passwords and print them as additional output.
      * Special parameters to use APG in script
      * Ability to log password generation requests for network version
      * Ability to control APG service access using tcpd
      * Ability to use password generation service from any type of box (Mac,
        WinXX, etc.) that connected to network
      * Ability to enforce remote users to use only allowed type of password
        generation
      The client/server version of apg has been deliberately omitted.
     .
     Please note that there are security flaws in pronounceable password
     generation schemes (see Ganesan / Davis "A New Attack on Random
     Pronounceable Password Generators", in "Proceedings of the 17th National
     Computer Security Conference (NCSC), Oct. 11-14, 1994 (Volume 1)",
     http://csrc.nist.gov/publications/history/nissc/ 1994-17th-NCSC-
     proceedings-vol-1.pdf, pages 203-216)
     .
     apg has not seen upstream attention since 2003, upstream is not answering
     e-mail, and the upstream web page does not look like it is in good working
     order. The Debian maintainer plans to discontinue apg maintenance as soon
     as an actually maintained software with a compariable feature set becomes
     available.
    
    $ neofetch
                .-/+oossssoo+/-.              mk@x200
            `:+ssssssssssssssssss+:`          -------
          -+ssssssssssssssssssyyssss+-        Model: 74574PJ ThinkPad X200
        .ossssssssssssssssssdMMMNysssso.      OS: Ubuntu Artful Aardvark (development branch) x86_64
       /ssssssssssshdmmNNmmyNMMMMhssssss/     Kernel: 4.11.0-10-generic
      +ssssssssshmydMMMMMMMNddddyssssssss+    Uptime: 2 days, 18 hours, 10 minutes
     /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/   Packages: 4274
    .ssssssssdMMMNhsssssssssshNMMMdssssssss.  Shell: bash 4.4.12
    +sssshhhyNMMNyssssssssssssyNMMMysssssss+  Resolution: 1280x800
    ossyNMMMNyMMhsssssssssssssshmmmhssssssso  WM: awesome
    ossyNMMMNyMMhsssssssssssssshmmmhssssssso  Theme: Ambiance [GTK3]
    +sssshhhyNMMNyssssssssssssyNMMMysssssss+  Icons: Ubuntu-mono-dark [GTK3]
    .ssssssssdMMMNhsssssssssshNMMMdssssssss.  Terminal: tilix
     /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/   CPU: Intel 2 Duo P8400 (2) @ 2.267GHz
      +sssssssssdmydMMMMMMMMddddyssssssss+    GPU: Intel® GM45 Express Chipset
       /ssssssssssshdmNNNNmyNMMMMhssssss/     GPU: Intel® GM45 Express Chipset
        .ossssssssssssssssssdMMMNysssso.      Memory: 7083MiB / 7878MiB
          -+sssssssssssssssssyyyssss+-
            `:+ssssssssssssssssss+:`
                .-/+oossssoo+/-.

    ]]>
    https://matoken.org/blog/2017/08/01/apg-command-option/feed/ 0
    PlumaでAsciiDocのsyntax highlightを https://matoken.org/blog/2017/07/16/asciidoc-syntax-highlight-on-pluma/ https://matoken.org/blog/2017/07/16/asciidoc-syntax-highlight-on-pluma/#respond Sat, 15 Jul 2017 18:09:13 +0000 http://matoken.org/blog/?p=1622

    ちょっと探したらこういうものがあった

    $ git clone https://github.com/edusantana/asciidoc-highlight
    $ cd ./asciidoc-highlight/gedit
    $ ./install.sh
    $ ls -lA ~/.local/share/gtksourceview-2.0/language-specs/asciidoc.lang
    lrwxrwxrwx 1 mk mk 26  7月 16 02:40 /home/mk/.local/share/gtksourceview-2.0/language-specs/asciidoc.lang -> /home/mk/src/asciid
    oc.lang
    $ ls -lA ~/.local/share/gtksourceview-3.0/language-specs/asciidoc.lang
    lrwxrwxrwx 1 mk mk 26  7月 16 02:40 /home/mk/.local/share/gtksourceview-3.0/language-specs/asciidoc.lang -> /home/mk/src/asciidoc.lang

    シンボリックリンクが作られていた.scriptもこれだけ.

    $ cat ./asciidoc-highlight/gedit/install.sh
    #!/bin/sh
    SRC=$PWD
    mkdir -p ~/.local/share/gtksourceview-3.0/language-specs/
    cd ~/.local/share/gtksourceview-3.0/language-specs/
    ln -s $SRC/asciidoc.lang
    mkdir -p ~/.local/share/gtksourceview-2.0/language-specs/
    cd ~/.local/share/gtksourceview-2.0/language-specs/
    ln -s $SRC/asciidoc.lang

    一旦消してfileをcpしておいた.

    $ rm ~/.local/share/gtksourceview-2.0/language-specs/asciidoc.lang ~/.local/share/gtksourceview-3.0/language-specs/asciidoc.lang
    $ cp asciidoc-highlight/gedit/asciidoc.lang ~/.local/share/gtksourceview-3.0/language-specs/
    $ ln -s ~/.local/share/gtksourceview-3.0/language-specs/asciidoc.lang ~/.local/share/gtksourceview-2.0/language-specs/
    $ ls -lA ~/.local/share/gtksourceview-2.0/language-specs/asciidoc.lang                                                 lrwxrwxrwx 1 mk mk 68  7月 16 02:43 /home/mk/.local/share/gtksourceview-2.0/language-specs/asciidoc.lang -> /home/mk/.local/share/gtksourceview-3.0/language-specs/asciidoc.lang
    $ ls -lA ~/.local/share/gtksourceview-3.0/language-specs/asciidoc.lang                                                 -rw-rw-r-- 1 mk mk 18731  7月 16 02:43 /home/mk/.local/share/gtksourceview-3.0/language-specs/asciidoc.lang

    この後Plumaを起動すると,[表示]→[強調表示モード]→[マークアップ]→[AsciiDoc]が出てくる.
    *.adocをopenすると自動的にsyntax highlightが有効になる.新規ファイルの場合*.adocとして保存しても効かない.要手動設定.

    環境

    $ dpkg-query -W pluma
    pluma   1.18.2-0ubuntu1
    $ neofetch
                .-/+oossssoo+/-.              mk@x200
            `:+ssssssssssssssssss+:`          -------
          -+ssssssssssssssssssyyssss+-        Model: 74574PJ ThinkPad X200
        .ossssssssssssssssssdMMMNysssso.      OS: Ubuntu Artful Aardvark (development branch) x86_64
       /ssssssssssshdmmNNmmyNMMMMhssssss/     Kernel: 4.11.0-10-generic
      +ssssssssshmydMMMMMMMNddddyssssssss+    Uptime: 3 days, 1 hour, 19 minutes
     /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/   Packages: 4211
    .ssssssssdMMMNhsssssssssshNMMMdssssssss.  Shell: bash 4.4.12
    +sssshhhyNMMNyssssssssssssyNMMMysssssss+  Resolution: 1280x800
    ossyNMMMNyMMhsssssssssssssshmmmhssssssso  WM: awesome
    ossyNMMMNyMMhsssssssssssssshmmmhssssssso  Theme: Ambiance [GTK3]
    +sssshhhyNMMNyssssssssssssyNMMMysssssss+  Icons: Ubuntu-mono-dark [GTK3]
    .ssssssssdMMMNhsssssssssshNMMMdssssssss.  CPU: Intel 2 Duo P8400 (2) @ 2.267GHz
     /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/   GPU: Intel® GM45 Express Chipset
      +sssssssssdmydMMMMMMMMddddyssssssss+    GPU: Intel® GM45 Express Chipset
       /ssssssssssshdmNNNNmyNMMMMhssssss/     Memory: 7239MiB / 7878MiB
        .ossssssssssssssssssdMMMNysssso.
          -+sssssssssssssssssyyyssss+-
            `:+ssssssssssssssssss+:`
                .-/+oossssoo+/-.
    ]]>
    https://matoken.org/blog/2017/07/16/asciidoc-syntax-highlight-on-pluma/feed/ 0
    Ubuntu 16.04 aarch64環境でmozc pkgが無いのでsource pkgからbuild https://matoken.org/blog/2017/06/02/ubuntu-16-04-since-there-is-no-mozc-pkg-in-the-aarch64-environment-build-from-source-pkg-to-build/ https://matoken.org/blog/2017/06/02/ubuntu-16-04-since-there-is-no-mozc-pkg-in-the-aarch64-environment-build-from-source-pkg-to-build/#comments Thu, 01 Jun 2017 22:10:45 +0000 http://matoken.org/blog/?p=1611 EDIT: 現在は次の記事の手順のほうが良いと思います -> Debian, Ubuntu で 上流のパッケージを借りてくる – matoken’s meme

     

    最近Ubuntu 16.04 aarch64のi3 wmにモニタとキーボードを繋いでデスクトップ利用を試しています.しかし,日本語入力のためのmozcのバイナリパッケージが見当たりません.確認すると,xenialからartfulではi386/amd64/armhfのみの対応.

    Debianではarmelも対応していますが,arm64はやっぱりありません.

    armhf/armelで動いているならarm64もあまり悩まずソースパッケージからbuildできるのではと試してみました.

    #dpkg –add-archtecture armhfしてMultiarchにしてarmhfのMozcを使うという手でも行けそうな気はする.(未確認)

    環境構築

    必要なパッケージの導入と,ソースパッケージの入手を行います.

    $ sudo apt update
    $ sudo apt upgrade
    $ sudo apt install build-essential devscripts
    $ sudo apt build-dep fcitx-mozc
    $ apt source fcitx-mozc
    
    • apt build-depは指定したパッケージをbuildするのに必要なパッケージを導入できます.
    • apt sourceは指定したパッケージのソースパッケージを導入して展開してくれます.

    ※もしソースパッケージが見つからない場合はsource.listにdeb-srcの行があるか確認してみてください.無ければapt edit-sourcesコマンドで/etc/apt/source.listファイルを編集してdeb-srcを有効にしてください.以下のページが参考になると思います.

    Archtectureにarm64を追加してバイナリパッケージ作成

    次にソースディレクトリに降りて,debian/controlファイルを開き,必要なパッケージのArchtectureにarm64を登録します.mozc-dataはallなのでそのままにしておきます.(はじめarm64をaarch64にしてうまく行かなかったですorz)

    $ cd mozc-2.17.2116.102+gitfd0f5b34+dfsg
    $ cp debian/control debian/control.org
    $ vi debian/control
    $ diff -u debian/control.org debian/control
    --- debian/control.org  2017-05-30 17:06:44.000000000 +0000  
    +++ debian/control      2017-05-30 17:07:19.000000000 +0000  
    @@ -28,7 +28,7 @@                                            
      This open-source project originates from Google Japanese Input.
                                  mozc-data                               
     Package: ibus-mozc                                          
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, mozc-data,     
            ibus (>= 1.2), mozc-server (= ${binary:Version}), tegaki-zinnia-japanese
     Recommends: mozc-utils-gui (= ${binary:Version})            dpkg-buildpackage
    @@ -45,7 +45,7 @@                                            
      This open-source project originates from Google Japanese Input.
                                    mozc-data                             
     Package: fcitx-mozc                                         
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, fcitx-bin, fcitx-data, fcitx-modules,
            mozc-server (= ${binary:Version}), mozc-data, tegaki-zinnia-japanese
     Recommends: fcitx, mozc-utils-gui (= ${binary:Version})     
    @@ -64,7 +64,7 @@                                            
      fcitx-mozc provides client part of the Mozc input method.  
    
     Package: emacs-mozc                                         
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, emacs | emacs23 | emacs24, emacs-mozc-bin (= ${binary:Version})
     Conflicts: emacsen-common (<< 2.0.0)                        
     Description: Mozc for Emacs                                 
    @@ -76,7 +76,7 @@                                            
      This open-source project originates from Google Japanese Input.
    
     Package: emacs-mozc-bin                                     
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, mozc-server (= ${binary:Version})
     Description: Helper module for emacs-mozc                   
      Mozc is a Japanese Input Method Editor (IME) designed for multi-platform
    @@ -87,7 +87,7 @@                                            
      This open-source project originates from Google Japanese Input.
    
     Package: mozc-server                                        
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}                 
     Multi-Arch: foreign                                         
     Description: Server of the Mozc input method                
    @@ -99,7 +99,7 @@                                            
      This open-source project originates from Google Japanese Input.
    
     Package: mozc-utils-gui                                     
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, mozc-data      
     Recommends: mozc-server (= ${binary:Version})               
     Suggests: ibus-qt
    

    次にdpkg-buildpackageコマンドでパッケージを作成します.手元のマシンではちょうど1時間ほどで終了しました.(あとで-j4とかすると30分ほどに)

    $ dpkg-buildpackage -us -uc
    $ ls ../*.debmozc-data
    ../emacs-mozc-bin_2.17.211archtecture6.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb  ../ibus-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb    ../mozc-utils-gui_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb
    ../emacs-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb      ../mozc-data_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_all.deb
    ../fcitx-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb      ../mozc-server_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb
    

    出来上がったパッケージの導入

    今回はfcitxを使っていたので,fcitx-mozcを導入しました.導入した後にログインしなおして,fcitx-config-gtkを起動するとMozcが登録されて利用できるようになりました. :)

    $ sudo apt-get install ../mozc-server_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb ../mozc-data_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_all.deb ../fcitx-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb ../mozc-utils-gui_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb 
    

    重かったり不具合が出るようならskkあたりにしようかと思っていましたが,現在このパッケージを1週間ほど利用して特に問題なく使えています.

    あまり推奨しませんが,私の作ったパッケージをしばらく以下においておきます.必要な方は試してみてください.(上の手順に + dhc -i + dpkg-buildpackage -j4したもの)

    ところでこれはどうすればいいのかな.Debianでも動作確認してバグレポでok?そしてUbuntuはSync mozc from Debian unstableを待つ感じ?

    ]]>
    https://matoken.org/blog/2017/06/02/ubuntu-16-04-since-there-is-no-mozc-pkg-in-the-aarch64-environment-build-from-source-pkg-to-build/feed/ 2
    Ubuntu 16.04 xenialのlightdmのログイン画面でユーザー名を表示しないようにする https://matoken.org/blog/2017/05/26/hide-lightdm-userlist-with-ubuntu-16-04-xenial/ https://matoken.org/blog/2017/05/26/hide-lightdm-userlist-with-ubuntu-16-04-xenial/#respond Thu, 25 May 2017 21:53:41 +0000 http://matoken.org/blog/?p=1607
    $ sudo cat << __EOF__ > /usr/share/lightdm/lightdm.conf.d/10_my.conf
    [SeatDefaults]
    # Hiding the user list.
    greeter-hide-users=true
    __EOF__
    $ cat /usr/share/lightdm/lightdm.conf.d/10_my.conf 
    [SeatDefaults]
    # Hiding the user list.
    greeter-hide-users=true
    $ sudo service lightdm restart
    
    ]]>
    https://matoken.org/blog/2017/05/26/hide-lightdm-userlist-with-ubuntu-16-04-xenial/feed/ 0
    Ubuntu17.04環境にJapanese Teamのパッケージレポジトリを追加 https://matoken.org/blog/2017/05/19/add-ubuntu17-04%e7%92%b0%e5%a2%83%e3%81%abjapanese-team%e3%81%ae%e3%83%91%e3%83%83%e3%82%b1%e3%83%bc%e3%82%b8%e3%83%ac%e3%83%9d%e3%82%b8%e3%83%88%e3%83%aa%e3%82%92%e8%bf%bd%e5%8a%a0/ https://matoken.org/blog/2017/05/19/add-ubuntu17-04%e7%92%b0%e5%a2%83%e3%81%abjapanese-team%e3%81%ae%e3%83%91%e3%83%83%e3%82%b1%e3%83%bc%e3%82%b8%e3%83%ac%e3%83%9d%e3%82%b8%e3%83%88%e3%83%aa%e3%82%92%e8%bf%bd%e5%8a%a0/#respond Fri, 19 May 2017 13:34:05 +0000 http://matoken.org/blog/?p=1605 5/3にUbuntu 17.04 日本語 Remixがリリースされました.

    デスクトップ利用しているUbuntu 17.04環境が1つあるのでUbuntu Japanese Teamのパッケージレポジトリを追加してみました.

    $ wget https://www.ubuntulinux.jp/ubuntu-ja-archive-keyring.gpg
    $ gpg ./ubuntu-ja-archive-keyring.gpg
    pub   dsa1024 2005-05-24 [SC]
          3B593C7BE6DB6A89FB7CBFFD058A05E90C4ECFEC
    uid           Ubuntu-ja Archive Automatic Signing Key <archive@ubuntulinux.jp>
    sub   elg2048 2005-05-24 [E]
    $ sudo apt-key add ./ubuntu-ja-archive-keyring.gpg
    OK
    $ wget https://www.ubuntulinux.jp/ubuntu-jp-ppa-keyring.gpg
    $ gpg ./ubuntu-jp-ppa-keyring.gpg 
    pub   rsa1024 2009-04-05 [SC]
          59676CBCF5DFD8C1CEFE375B68B5F60DCDC1D865
    uid           Launchpad PPA for Ubuntu Japanese Team
    $ sudo apt-key add ./ubuntu-jp-ppa-keyring.gpg 
    OK
    $ rm ./ubuntu-jp-ppa-keyring.gpg 
    $ wget https://www.ubuntulinux.jp/sources.list.d/zesty.list
    $ cat zesty.list 
    ## Ubuntu Japanese LoCo Team's repository for Ubuntu 17.04
    ## Please report any bugs to https://bugs.launchpad.net/ubuntu-jp-improvement
    deb http://archive.ubuntulinux.jp/ubuntu zesty main
    deb-src http://archive.ubuntulinux.jp/ubuntu zesty main
    deb http://archive.ubuntulinux.jp/ubuntu-ja-non-free zesty multiverse
    deb-src http://archive.ubuntulinux.jp/ubuntu-ja-non-free zesty multiverse
    $ sudo mv ./zesty.list /etc/apt/sources.list.d/ubuntu-ja.list
    $ sudo apt update
    $ sudo apt upgrade
    $ sudo apt install ubuntu-defaults-ja
    $ apt show ubuntu-defaults-ja
    Package: ubuntu-defaults-ja
    Version: 17.04-0ubuntu1~ja3
    Priority: optional
    Section: metapackages
    Maintainer: Jun Kobayashi <jkbys@ubuntu.com>
    Installed-Size: 22.5 kB
    Provides: ubuntu-default-settings
    Depends: dconf-gsettings-backend | gsettings-backend, language-pack-ja, language-pack-gnome-ja, libreoffice-l10n-ja, libreoffice-help-ja, firefox-locale-ja, thunderbird-locale-ja, fonts-noto-cjk, fonts-takao-pgothic, fonts-takao-gothic, fonts-takao-mincho, poppler-data, cmap-adobe-japan1, fcitx, fcitx-mozc, fcitx-libs-qt5, fcitx-frontend-all, fcitx-frontend-gtk2, fcitx-frontend-gtk3, fcitx-frontend-qt4, fcitx-ui-classic, fcitx-config-gtk, mozc-utils-gui
    Conflicts: im-setup-helper, ubuntu-default-settings
    Replaces: im-setup-helper
    Download-Size: 4,446 B
    APT-Manual-Installed: yes
    APT-Sources: http://archive.ubuntulinux.jp/ubuntu zesty/main amd64 Packages
    Description: Default settings for Japanese/Japan
     This package contains customized default settings for the Japanese Ubuntu
     Remix.
    
    ]]>
    https://matoken.org/blog/2017/05/19/add-ubuntu17-04%e7%92%b0%e5%a2%83%e3%81%abjapanese-team%e3%81%ae%e3%83%91%e3%83%83%e3%82%b1%e3%83%bc%e3%82%b8%e3%83%ac%e3%83%9d%e3%82%b8%e3%83%88%e3%83%aa%e3%82%92%e8%bf%bd%e5%8a%a0/feed/ 0
    ディスクイメージのデバイスマップが簡単に作れるkpartxを試す https://matoken.org/blog/2017/04/12/try-kpartx-which-makes-it-easy-to-create-device-map-of-disk-image/ https://matoken.org/blog/2017/04/12/try-kpartx-which-makes-it-easy-to-create-device-map-of-disk-image/#comments Tue, 11 Apr 2017 21:46:23 +0000 http://matoken.org/blog/?p=1599 以下のページでkpartxというディスクのデバイスマップを作るコマンドがあるのを知りました

    そこでまず、kpartxを使って各パーティションのデバイスマップを作ります。
    $ sudo /sbin/kpartx -av /opt/atde3-20100309.img
    add map loop2p1 : 0 497952 linear /dev/loop2 63
    add map loop2p2 : 0 33045705 linear /dev/loop2 498015
    $ ls /dev/mapper/
    control loop2p1 loop2p2
    これでディスクイメージの各物理パーティションに対応したデバイスマップができました。fdiskで見えていたパーティションはそれぞれ、/dev/mapper/loop2p1 /dev/mapper/loop2p2 として参照できるようになっています。

    これまでは以下のページのようにfdiskコマンドでパーティション情報を確認してmount時にoffsetを指定していました.

    kpartxを使うとこの作業が簡単になりそうなので試してみました.

    Debian sid amd64ではそのままkpartxパッケージだったのでこれを導入します.(Ubuntu 17.04 amd64でも同様でした.)

    $ sudo apt install kpartx
    

    丁度Raspbian jessie 2017-04-10が出たのでこれで試してみます.

    $ unzip -l 2017-04-10-raspbian-jessie-lite.zip 
    Archive:  2017-04-10-raspbian-jessie-lite.zip
      Length      Date    Time    Name
    ---------  ---------- -----   ----
    1297862656  2017-04-10 18:58   2017-04-10-raspbian-jessie-lite.img
    ---------                     -------
    1297862656                     1 file
    $ time unzip 2017-04-10-raspbian-jessie-lite.zip
    Archive:  2017-04-10-raspbian-jessie-lite.zip
      inflating: 2017-04-10-raspbian-jessie-lite.img  
    
    real    2m58.438s
    user    0m27.512s
    sys     0m2.132s
     sudo /sbin/kpartx -av 2017-04-10-raspbian-jessie-lite.img
    add map loop0p1 (254:3): 0 83968 linear 7:0 8192
    add map loop0p2 (254:4): 0 2442728 linear 7:0 92160
    $ ls -lA /dev/mapper/
    合計 0
    crw------- 1 root root 10, 236  4月 11 23:37 control
    lrwxrwxrwx 1 root root       7  4月 12 06:07 loop0p1 -> ../dm-3
    lrwxrwxrwx 1 root root       7  4月 12 06:07 loop0p2 -> ../dm-4
    lrwxrwxrwx 1 root root       7  4月 11 23:37 sda3_crypt -> ../dm-0
    lrwxrwxrwx 1 root root       7  4月 11 23:37 x220--vg-root -> ../dm-1
    lrwxrwxrwx 1 root root       7  4月 11 23:37 x220--vg-swap_1 -> ../dm-2
    

    デバイスマッピングされています.これで簡単にmount出来ました.

    $ sudo mount -o ro /dev/mapper/loop0p1 /media/mk/pi-boot
    $ sudo mount -o ro /dev/mapper/loop0p2 /media/mk/pi-root/
    $ mount | grep /dev/mapper/loop0p
    /dev/mapper/loop0p1 on /media/mk/pi-boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
    /dev/mapper/loop0p2 on /media/mk/pi-root type ext4 (ro,relatime,data=ordered)
    $ ls /media/mk/pi-boot
    COPYING.linux     bcm2708-rpi-0-w.dtb     bcm2708-rpi-cm.dtb   bcm2710-rpi-cm3.dtb  config.txt    fixup_db.dat  kernel.img   start.elf     start_x.elf
    LICENCE.broadcom  bcm2708-rpi-b-plus.dtb  bcm2709-rpi-2-b.dtb  bootcode.bin         fixup.dat     fixup_x.dat   kernel7.img  start_cd.elf
    LICENSE.oracle    bcm2708-rpi-b.dtb       bcm2710-rpi-3-b.dtb  cmdline.txt          fixup_cd.dat  issue.txt     overlays     start_db.elf
    $ ls /media/mk/pi-root
    bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
    

    そしてchrootしてみたり

    $ sudo mount -o remount,rw /media/mk/pi-root
    $ sudo cp -p /usr/bin/qemu-arm-static /media/mk/pi-root/usr/bin
    $ sudo chroot /media/mk/pi-root/ /bin/bash
    # dpkg --get-selections "*" | wc -l
    427
    

    アンマウントして元に戻します.

    # exit
    $ sudo umount /media/mk/pi-*
    $ sudo kpartx -d /dev/mapper/loop0p1
    $ sudo kpartx -d /dev/mapper/loop0p2
    $ rm ./2017-04-10-raspbian-jessie-lite.img
    

    便利ですね :)
    後は圧縮ファイルをそのまま使えると便利なんですがムリカナ?

    ]]>
    https://matoken.org/blog/2017/04/12/try-kpartx-which-makes-it-easy-to-create-device-map-of-disk-image/feed/ 2
    Podcastが無くなって困る https://matoken.org/blog/2017/04/06/trouble-with-podcasts/ https://matoken.org/blog/2017/04/06/trouble-with-podcasts/#respond Wed, 05 Apr 2017 21:49:37 +0000 http://matoken.org/blog/?p=1590 現在Podcastをpodgetで取得して,

    2 * * * *       podget -s
    

    その中の新しいものだけをownCloudにコピーしてAndroidやPCで視聴しています.

    10 * * * *      cd ~mk/POD ; find . -mmin -2880 -type f | egrep -v 'm3u$|LOG\/' | rsync --delete --progress --files-from=- ~mk/POD/ /var/www/owncloud/data/matoken/files/podcast/; find /var/www/owncloud/data/matoken/files/podcast/ -ctime +7 -type f -print0 | xargs -0 rm ; find /var/www/owncloud/data/matoken/files/podcast/news/ -mmin +1`
    

    今日聞こうとしたらownCloud内のPodcastが0個になっていました.心当たりはUbuntu 14.04 LTSからUbuntu 16.04 LTSへのdist-upgrade.ownCloudは上げる前と後に動作確認してたんで他の部分が怪しいとログを見るとpodgetがエラーを吐いています.こんな感じ.

    $ podget -s
    /home/mk/.podget/podgetrc cannot be verified to be compatible with this version of podget.
    
    It is missing the version line that is included in configuration files created by newer versions of podget.
    
    Please create a new configuration file by running 'podget --create-config <FILENAME>',
    and then converting your old configuration to the new format.  Then move the new file
    in place of the old and podget will work as it used to.
    

    設定ファイルが使えなくなってるみたいですね.枯れてるのかと思ってたら結構変化があったようです.
    ちなみに更新前のバージョンがpodget 0.6.9-1で現在はpodget 0.7.9-1でした.

    てことで,設定ファイルの雛形を別の場所に書き出して,

    $ podget --create-config /tmp/podgetrc
    podget
    
    Configuration filename specified by -c or --create-config violates the following rules...
    
    Suggestion(s):
      1. Filenames should not include any directory configuration.
         Remove the directory configuration.
         If you need to specify a directory other than the default,
         use the -d or --dir_config command line options.
    
    Closing session.
    

    …….--dir_config付けて再度.

    $ podget --dir_config /tmp --create-config podgetrc
    podget
      Installing default user configuration file in /tmp/podgetrc
      Installing default server list configuration.
    
    Closing session.
    

    https://gist.github.com/1b5fba2e949409a87e1955e0c779b057

    diffを取ってみると設定項目自体はそう変わってない感じですが,設定値が大文字小文字が変わったりしています.
    比較しながら書き換えて叩くと動き始めたようです.

    $ podget
    podget
    
    
    Session directory not found, creating
    Session file not found.  Creating podget.18364 .
    
    -------------------------------------------------
    Category: tech                 Name: 電脳空間カウボーイズ
    
    Downloading feed index from http://feeds.feedburner.com/weblogs/csc
    2017-04-06 06:13:13 URL:http://feeds.feedburner.com/weblogs/csc [46549] -> "-" [1]
    
    Downloading csc_2017_design2.mp3 from http://onosendai.jp/csc
    2017-04-06 06:20:43 URL:http://onosendai.jp/csc/csc_2017_design2.mp3 [51781411/51781411] -> "/home/mk/POD/tech/電脳空間カウボーイズ/csc_2017_design2.mp3" [1]
    PLAYLIST: Adding tech/電脳空間カウボーイズ/csc_2017_design2.mp3 to /home/mk/POD/New-2017-04-06.m3u
    
    Downloading csc_2017_design1.mp3 from http://onosendai.jp/csc
    2017-04-06 06:25:04 URL:http://onosendai.jp/csc/csc_2017_design1.mp3 [37304885/37304885] -> "/home/mk/POD/tech/電脳空間カウボーイズ/csc_2017_design1.mp3" [1]
    PLAYLIST: Adding tech/電脳空間カウボーイズ/csc_2017_design1.mp3 to /home/mk/POD/New-2017-04-06.m3u
     :
    

    しかし,ダウンロード済みのファイルも取得しているような?
    新規のみの設定にしているつもりなんですが,初回は舐めちゃうのかな?2度目のときに確認してみます.

    # Force
    # 0 == Only download new material.
    # 1 == Force download all items even those you've downloaded before.
    FORCE=0
    

    とりあえず終わるまではsoundcloud辺りで聞いてます.

    その後2回目はちゃんと期待通りの動作するのを確認したのでcrontabに登録し直しました.

    ]]>
    https://matoken.org/blog/2017/04/06/trouble-with-podcasts/feed/ 0
    不正なUSBデバイスからPCを守るUSBGuardを試す https://matoken.org/blog/2016/10/08/try-usbguard-to-protect-the-pc-from-unauthorized-usb-device/ https://matoken.org/blog/2016/10/08/try-usbguard-to-protect-the-pc-from-unauthorized-usb-device/#respond Fri, 07 Oct 2016 17:38:50 +0000 http://matoken.org/blog/?p=1439 BadUSBなどの不正なUSBデバイスからPCが守れないかなちょっと設定すればできそう?そもそも作っている人がいるんじゃ?ということで探したらUSBGuardというソフトウェアを見つけました.

    このソフトウェアを導入しておくと,設定したルールに合致しないUSBデバイスはblockされます. デスクトップ利用の場合はGUIのアプレットを利用してUSB接続時にウィンドウがポップアップして接続するか選べたりもします. 便利.
    #USB KILLERは……USB配線を外したりUSBコネクタを塞ぐしかないですよね多分.

    導入

    Debian/Ubuntuにはパッケージがあるのでそちらから導入します.

    $ sudo apt install usbguard usbguard-applet-qt

    設定

    一般ユーザから利用する場合は設定ファイルを編集してユーザかグループを追加してデーモンの再起動を行います. 設定ファイルは/etc/usbguard/usbguard-daemon.confです.

    diff --git a/usbguard/usbguard-daemon.conf b/usbguard/usbguard-daemon.conf
    index 4a54ca0..7b3a165 100644
    --- a/usbguard/usbguard-daemon.conf
    +++ b/usbguard/usbguard-daemon.conf
    @@ -65,7 +65,7 @@ PresentControllerPolicy=keep
    #
    # IPCAllowedUsers=username1 username2 ...
    #
    -IPCAllowedUsers=root
    +IPCAllowedUsers=root user1 user2
    
    #
    # Groups allowed to use the IPC interface.
    @@ -75,7 +75,7 @@ IPCAllowedUsers=root
    #
    # IPCAllowedGroups=groupname1 groupname2 ...
    #
    -IPCAllowedGroups=root
    +IPCAllowedGroups=root users
    
    #
    # Generate device specific rules including the "via-port"

    ユーザの場合はIPCAllowedUsers,グループの場合はIPCAllowedGroupsにスペース区切りで書いていきます.

    デーモンの再起動

    設定を反映するためにデーモンを再起動します.

    $ sudo service usbguard restart

    CUIでの利用例

    usbguardが起動した後に接続されたデバイスはblockされています.

    $ usbguard list-devices| tail -2
    9: allow id 8087:0024 serial "" name "" hash "Zx7v0FMQEjScKSAFENAiobEs1OGPPB0YWR+yXDCVE04=" parent-hash "WwvSEwd+7257rAqUGLMQjffF7zyqygmmLeQTYnR9QzQ=" via-port "4-1" with-interface 09:00:00
    11: block id 1004:631c serial "03a809c94b4befd4" name "LGE Android Phone" hash "P5dSK5xxK4R5QTRzd7KlD8Agf/+28pztL077j1oWqPI=" parent-hash "Zx7v0FMQEjScKSAFENAiobEs1OGPPB0YWR+yXDCVE04=" via-port "4-1.1" with-interface ff:ff:00

    blockされている11番目のデバイスを許可してみます.(これは一時的です)

    $ usbguard allow-device 11
    $ usbguard list-devices| tail -1
    11: allow id 1004:631c serial "03a809c94b4befd4" name "LGE Android Phone" hash "P5dSK5xxK4R5QTRzd7KlD8Agf/+28pztL077j1oWqPI=" parent-hash "Zx7v0FMQEjScKSAFENAiobEs1OGPPB0YWR+yXDCVE04=" via-port "4-1.1" with-interface ff:ff:00

    状況の確認

    USBデバイスの認識状況を監視します.

    $ usbguard watch
    [IPC] Connected
    [device] Inserted: id=12 hash=vi38heJ4vKEdayxiqrQFylpwa3xkVYYUkZi2zbu3sWs= name=Mass Storage Device product_id=1336 serial=00000000000006 vendor_id=048d interface={ 08:06:50} rule_match=0 rule_id=4294967295
    [device] Blocked: id=12 name=Mass Storage Device product_id=1336 vendor_id=048d rule_match=0 rule_id=4294967295
    [device] Allowed: id=12 name=Mass Storage Device product_id=1336 vendor_id=048d rule_match=0 rule_id=4294967295

    GUI(usbguard-applet-qt)の利用例

    CUIだとちょっと面倒ですが,デスクトップ利用の場合はusbguard-applet-qtが便利です.

    usbguard-applet-qtが起動した状態でUSBデバイスを接続すると以下のようなダイヤログが表示されます.Allowボタンを押すことで利用できるようになります. このとき,Make the decision permanentにチェックを入れておくと,設定が永続化されます.この設定は/etc/usbguard/rules.confに記録されます.

    20161007_02:10:22-9078

    ダイヤログはタイムアウトすると消えてしまいますが,アプレットのウィンドウから設定画面を呼び出すことができます.ここから設定変更ができます.

    20161007_16:10:49-4107

    とりあえずはこれくらいで良さそうですが,ルールを書くといろいろ応用が効きそうです.

    とりあえずはどうもデーモン起動までに接続されていたデバイスは許可されるようなので内臓デバイスを明示的に許可してその他をblockしようと思います.

    ]]>
    https://matoken.org/blog/2016/10/08/try-usbguard-to-protect-the-pc-from-unauthorized-usb-device/feed/ 0
    ubuntuでpipが見当たらない状態を復旧 https://matoken.org/blog/2016/09/27/restore-the-state-do-not-see-the-pip-command-in-ubuntu/ https://matoken.org/blog/2016/09/27/restore-the-state-do-not-see-the-pip-command-in-ubuntu/#respond Mon, 26 Sep 2016 17:33:08 +0000 http://matoken.org/blog/?p=1408 鹿児島らぐのオフ会で @seoponさんからpipでjanome入れてみましょうって時に,以前sudo hogehogeしてからpip使えなくなっちゃって方が. 見てみるとpkgは入っているけどpipコマンド自体がいなくなってる感じみたいでした.恐らくオペミスで消したかパスのないところに移動しちゃった? (以下は多分こんなだったというのを再現.)

    $ pip
    プログラム 'pip' はまだインストールされていません。 次のように入力することでインストールできます:
    sudo apt install python-pip
    $ sudo apt install python-pip
    パッケージリストを読み込んでいます... 完了
    依存関係ツリーを作成しています
    状態情報を読み取っています... 完了
    python-pip はすでに最新バージョン (8.1.1-2ubuntu0.2) です。
    アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
    $ which pip
    $ dpkg -L python-pip | grep \/pip$
    /usr/bin/pip
    /usr/lib/python2.7/dist-packages/pip
    $ ls -l /usr/bin/pip
    ls: '/usr/bin/pip' にアクセスできません: そのようなファイルやディレクトリはありません

    pkgをreinstallして解決しました.

    $ sudo apt install --reinstall python-pip
    パッケージリストを読み込んでいます... 完了
    依存関係ツリーを作成しています
    状態情報を読み取っています... 完了
    アップグレード: 0 個、新規インストール: 0 個、再インストール: 1 個、削除: 0 個、保留: 0 個。
    144 kB のアーカイブを取得する必要があります。
    この操作後に追加で 0 B のディスク容量が消費されます。
    取得:1 http://jp.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-pip all 8.1.1-2ubuntu0.2 [144 kB]
    144 kB を 0秒 で取得しました (571 kB/s)
    (データベースを読み込んでいます ... 現在 902816 個のファイルとディレクトリがインストールされています。)
    .../python-pip_8.1.1-2ubuntu0.2_all.deb を展開する準備をしています ...
    python-pip (8.1.1-2ubuntu0.2) で (8.1.1-2ubuntu0.2 に) 上書き展開しています ...
    man-db (2.7.5-1) のトリガを処理しています ...
    python-pip (8.1.1-2ubuntu0.2) を設定しています ...
    mk@x201s:~$ !ls
    ls -l /usr/bin/pip
    -rwxr-xr-x 1 root root 292  8月 12 06:59 /usr/bin/pip
    $ which pip
    /usr/bin/pip
    $ pip -V
    pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)

    とりあえず.

    ]]>
    https://matoken.org/blog/2016/09/27/restore-the-state-do-not-see-the-pip-command-in-ubuntu/feed/ 0
    ブートUSBメモリなどを作るmkusbを試してみる https://matoken.org/blog/2016/02/24/try-mkusb-to-make-such-as-a-boot-usb-memory/ https://matoken.org/blog/2016/02/24/try-mkusb-to-make-such-as-a-boot-usb-memory/#comments Wed, 24 Feb 2016 00:03:35 +0000 http://matoken.org/blog/?p=1207

    USBメモリなどにisoを書き込んで起動デバイスを作れるとても便利なUNetbootinというツールがあります.
    しかし,Debian jessie/stretchに入っていません.

    なんでだろうとBTSを見るとうまく動かないバグがあるようです.(UEFI環境でNG?)

    ざざっと眺めていてmkusbという同じようなツールがあるのを見かけたので試してみました.

    環境

    Debian stretch testing amd64です.

    $ screenfetch
             _,met$$$$$gg.           mk@x220
          ,g$$$$$$$$$$$$$$$P.        OS: Debian testing-updates sid
        ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 4.3.0-1-amd64
       ,$$P'              `$$$.      Uptime: 9h 7m
      ',$$P       ,ggs.     `$$b:    Packages: 3622
      `d$$'     ,$P"'   .    $$$     Shell: bash 4.3.42
       $$P      d$'     ,    $$P     Resolution: 1366x768
       $$:      $$.   -    ,d$$'     WM: Awesome
       $$\;      Y$b._   _,d$P'      WM Theme: awesome
       Y$$.    `.`"Y$$$$P"'          CPU: Intel Core i5-2540M CPU @ 3.3GHz
       `$$b      "-.__               GPU: Mesa DRI Intel(R) Sandybridge Mobile
        `Y$$                         RAM: 9768MiB / 15934MiB
         `Y$$.                      
           `$$b.                    
             `Y$$b.                 
                `"Y$b._             
                    `""""           
     

    Ubuntuはppaがあります.DebianはUbuntuのppaが使えます.他のLinuxディストリビューションでは導入スクリプト( mkusb-installer )が用意されています.

    導入(ppa)

    source.listを登録します.apt edit-sourcesコマンドでdeb http://ppa.launchpad.net/mkusb/ppa/ubuntu trusty mainを登録します.

    $ sudo apt edit-sources mkusb
    $ sudo chmod +r /etc/apt/sources.list.d/mkusb.list
    $ cat /etc/apt/sources.list.d/mkusb.list
    # "mkusb/install-to-debian - Community Help Wiki"
    https://help.ubuntu.com/community/mkusb/install-to-debian
    deb http://ppa.launchpad.net/mkusb/ppa/ubuntu trusty main
    $ gpg --keyserver keyserver.ubuntu.com --recv-keys 54B8C8AC
    gpg: 鍵54B8C8ACをhkpからサーバkeyserver.ubuntu.comに要求
    gpg: 鍵54B8C8AC: 公開鍵"Launchpad PPA for MKUSB"をインポートしました
    gpg:           処理数の合計: 1
    gpg:             インポート: 1  (RSA: 1)
    $ gpg --fingerprint 54B8C8AC
    pub   4096R/54B8C8AC 2014-08-14
     フィンガー・プリント = 29D7 6ADA 2D15 A87B F4C6  8B82 3729 8274 54B8 C8AC
    uid                  Launchpad PPA for MKUSB
     
    $ gpg -a --export 54B8C8AC | sudo apt-key add -
    OK
    $ apt-key list|grep -A1 54B8C8AC
    pub   4096R/54B8C8AC 2014-08-14
    uid                  Launchpad PPA for MKUSB

    パッケージリストの更新とmkusbパッケージの導入

    $ sudo apt update
    $ sudo apt install mkusb mkusb-nox
    $ dpkg -L mkusb
    /.
    /usr
    /usr/share
    /usr/share/mkusb
    /usr/share/mkusb/mkusb-start
    /usr/share/mkusb/restore
    /usr/share/mkusb/mkusb-st2
    /usr/share/mkusb/usb-pack_efi.tar.gz
    /usr/share/mkusb/grub.cfg
    /usr/share/mkusb/maybe-problems.txt
    /usr/share/mkusb/backup
    /usr/share/icons
    /usr/share/icons/mkusb.svg
    /usr/share/icons/hicolor
    /usr/share/icons/hicolor/scalable
    /usr/share/icons/hicolor/scalable/apps
    /usr/share/icons/hicolor/scalable/apps/mkusb.svg
    /usr/share/icons/hicolor/48x48
    /usr/share/icons/hicolor/48x48/apps
    /usr/share/icons/hicolor/48x48/apps/mkusb.png
    /usr/share/doc
    /usr/share/doc/mkusb
    /usr/share/doc/mkusb/README.Debian
    /usr/share/doc/mkusb/copyright
    /usr/share/doc/mkusb/changelog.Debian.gz
    /usr/share/man
    /usr/share/man/man8
    /usr/share/man/man8/mkusb.8.gz
    /usr/share/applications
    /usr/share/applications/mkusb.desktop
    /usr/sbin
    /usr/sbin/mkusb
    $ dpkg -L mkusb-nox
    /.
    /usr
    /usr/share
    /usr/share/doc
    /usr/share/doc/mkusb-nox
    /usr/share/doc/mkusb-nox/copyright
    /usr/share/doc/mkusb-nox/changelog.Debian.gz
    /usr/sbin
    /usr/sbin/mkusb-nox

    実行例

    メニューから起動するか,

    $ sudo -H /usr/sbin/mkusb

    のようにして起動します.書き込むイメージが決まっている場合は引数に指定できます.イメージには.gzや.xzも指定可能なので展開の手間が省けます.

    $ sudo -H /usr/sbin/mkusb ./alpine-3.3.1-x86_64.iso

    スプラッシュが出て,

    20160224_06:02:32-32496
    20160224_06:02:36-32565

    メニューが出てきます.cloneやwipeも可能です.
    20160224_06:02:45-32658

    書き込み先のデバイスは間違えないようにしましょう.間違えるととても悲しいことになります.ちなみにSD Cardスロットの/dev/mmcblk0は検出されませんでした.USB-SDアダプタ経由だと出てきました.
    20160224_06:02:26-868
    20160224_06:02:43-1237

    確認画面でチェックを入れて「Go」ボタンで書き込みが始まります.
    20160224_06:02:05-2732
    20160224_06:02:13-2827
    20160224_06:02:17-2960

    実行例(nox)

    mkusb-noxコマンドを使うと端末で利用できます.nox版では複数のUSBメモリがある場合の選択方法はわかりませんでした.書き込むデバイスだけを差し込むようにするしか無いかもしれません.

    $ sudo /usr/sbin/mkusb-nox ./alpine-3.3.1-x86_64.iso
    The iso file SHOULD BE loop mounted on a temporary file READ-ONLY:
    mount: /dev/loop0 is write-protected, mounting read-only
    disk_name_type=label
    default grsec|label grsec| _found_ in iso-file
    default grsec|label grsec| _found_ in /dev/sdb
     Final checkpoint
    Install to /dev/sdb? (y/n)
    y
    pv "alpine-3.3.1-x86_64.iso"| dd of=/dev/sdb bs=4096 ...
      82MiB 0:00:00 [ 205MiB/s] [========================================================================================================================>] 100%            
    20992+0 records in
    20992+0 records out
    85983232 bytes (86 MB) copied, 4.84297 s, 17.8 MB/s
    syncing the drive ...
    The default grsec|label grsec| USB device is re-cloned  :-)

    問題なく利用できる場合はUNetbootinの方がマルチプラットホームだし使いやすそうです.状況により使い分けるのがいいのかもしれません.

    ]]>
    https://matoken.org/blog/2016/02/24/try-mkusb-to-make-such-as-a-boot-usb-memory/feed/ 1
    絵文字を入力する-Mozc&emojione-picker- https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker/ https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker/#comments Tue, 16 Feb 2016 22:55:08 +0000 http://matoken.org/blog/?p=1184

    Linux環境での絵文字入力方法です.新しい方法を知ったので紹介してみます.

    Mozc利用

    これまではこの方法を使っていました.Mozcの設定で「Unicode 6 絵文字変換」にチェックを付けると利用できるようになります.

    20160216_23:02:52-2121

    「えもじ」とか「ねこ」とか入力して変換出来ます.

    20160217_07:02:28-3105

    辞書に登録することも出来ます.

    20160217_07:02:07-5247

    emojione-picker for Ubuntu

    今回知ったUbuntu向けの絵文字ピッカーです.実行するとタスクバーに常駐して入力したい絵文字を選んでクリックするとその絵文字がクリップボードにコピーされるのでクリップボード貼り付けで入力できます.

    20160217_07:02:45-12768

    チキンがクリップボードにコピーされたところ.

    20160217_07:02:11-16960

    いちいちメニューを辿るのは面倒ですが,Recentに最近使った絵文字が入るのでよく使うものはここからアクセスできます.

    20160217_07:02:42-17641

    Debian stretch testing への導入例

    Ubuntu用ですがstretchにも入りました.ちなみにパッケージ化して導入しなくてもとりあえず動かすだけならgit cloneした後cd emojione-picker-ubuntu ; ./emojione-pickerとかでも動きました.

    $ sudo apt install equivsequivs gir1.2-rsvg-2.0
    $ git clone https://github.com/gentakojima/emojione-picker-ubuntu.git
    $ cd emojione-picker-ubuntu
    $ equivs-build debian_package.ctl
    $ sudo dpkg -i emojione-picker_0.1_all.deb

    という感じでLinux環境でも結構快適に絵文字が入力できるようになってきました.しかし絵文字は楽しいのですが環境によって見え方が大幅に変わるので意図したように伝わっているかとかが不安でもあります…….

    ]]>
    https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker/feed/ 2
    絵文字を入力する-Mozc&emojione-picker- https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker-2/ https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker-2/#comments Tue, 16 Feb 2016 22:55:08 +0000 http://matoken.org/blog/?p=1184

    Linux環境での絵文字入力方法です.新しい方法を知ったので紹介してみます.

    Mozc利用

    これまではこの方法を使っていました.Mozcの設定で「Unicode 6 絵文字変換」にチェックを付けると利用できるようになります.

    20160216_23:02:52-2121

    「えもじ」とか「ねこ」とか入力して変換出来ます.

    20160217_07:02:28-3105

    辞書に登録することも出来ます.

    20160217_07:02:07-5247

    emojione-picker for Ubuntu

    今回知ったUbuntu向けの絵文字ピッカーです.実行するとタスクバーに常駐して入力したい絵文字を選んでクリックするとその絵文字がクリップボードにコピーされるのでクリップボード貼り付けで入力できます.

    20160217_07:02:45-12768

    チキンがクリップボードにコピーされたところ.

    20160217_07:02:11-16960

    いちいちメニューを辿るのは面倒ですが,Recentに最近使った絵文字が入るのでよく使うものはここからアクセスできます.

    20160217_07:02:42-17641

    Debian stretch testing への導入例

    Ubuntu用ですがstretchにも入りました.ちなみにパッケージ化して導入しなくてもとりあえず動かすだけならgit cloneした後cd emojione-picker-ubuntu ; ./emojione-pickerとかでも動きました.

    $ sudo apt install equivsequivs gir1.2-rsvg-2.0
    $ git clone https://github.com/gentakojima/emojione-picker-ubuntu.git
    $ cd emojione-picker-ubuntu
    $ equivs-build debian_package.ctl
    $ sudo dpkg -i emojione-picker_0.1_all.deb

    という感じでLinux環境でも結構快適に絵文字が入力できるようになってきました.しかし絵文字は楽しいのですが環境によって見え方が大幅に変わるので意図したように伝わっているかとかが不安でもあります…….

    ]]>
    https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker-2/feed/ 2
    EncFSに似た暗号化ファイルシステムのCryFSを試す https://matoken.org/blog/2016/02/07/try-cryfs-of-the-encrypted-file-system-similar-to-encfs/ https://matoken.org/blog/2016/02/07/try-cryfs-of-the-encrypted-file-system-similar-to-encfs/#respond Sat, 06 Feb 2016 20:46:54 +0000 http://matoken.org/blog/?p=1121

    EncFSのMLで見かけたのですが,EncFSに似た暗号化FSのCryFSというものがあるようです.

    EncFSは平文のファイルと暗号化ファイルが一対一で対応づいているしタイムスタンプやパーミッションも引き継いでいるので推測されやすいという問題があります.CryFSはその辺りも隠蔽できるようです.
    面白そうなので少し試してみました.

    初めDebian stretchに導入しようと思ったのですが,jessieのapt-lineは用意されているのですが,これをstretchに導入しようとするとバージョンチェックで対応してないと言われ,sourceから導入しようと思ったらbiiという恐らくstretchのpkgに存在しないコマンドを要求されるので手っ取り早くUbuntu 14.04 LTSで試しました.

    $ linuxlogo -L ubuntu$ linuxlogo -L ubuntu
     
                  .-.
            .-'``(|||)
         ,`\ \    `-`.                 88                         88
        /   \ '``-.   `                88                         88
      .-.  ,       `___:      88   88  88,888,  88   88  ,88888, 88888  88   88
     (:::) :        ___       88   88  88   88  88   88  88   88  88    88   88
      `-`  `       ,   :      88   88  88   88  88   88  88   88  88    88   88
        \   / ,..-`   ,       88   88  88   88  88   88  88   88  88    88   88
         `./ /    .-.`        '88888'  '88888'  '88888'  88   88  '8888 '88888'
            `-..-(   )
                  `-`
     
     
    Linux Version 3.13.0-77-generic, Compiled #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016
          Two 800MHz AMD Athlon Processors, 7.9GB RAM, 5191.48 Bogomips Total
                                         micro

    #screenfetchがpkgに無いな

    導入

    このscriptで鍵やapt-lineの設定とCryFSの導入が行われます.

    $ wget -O - https://www.cryfs.org/install.sh | sudo bash
    $ cryfs -h
    CryFS Version 0.8.5
    WARNING! This version is not considered stable. Please backup your data frequently!
     
    Usage: cryfs [options] rootDir mountPoint [-- [FUSE Mount Options]]
     
    Allowed options:
      -h [ --help ]          show help message
      -c [ --config ] arg    Configuration file
      -f [ --foreground ]    Run CryFS in foreground.
      --cipher arg           Cipher to use for encryption. See possible values by
                             calling cryfs with --show-ciphers
      --show-ciphers         Show list of supported ciphers.
      --unmount-idle arg     Automatically unmount after specified number of idle
                             minutes.
      --extpass arg          External program to use for password input
      --logfile arg          Specify the file to write log messages to. If this is
                             not specified, log messages will go to stdout, or
                             syslog if CryFS is running in the background.
     

    利用例

    基本的な使い方はEncFSと同じ感じです.初回起動時は簡単な設定が必要.

    $ mkdir encdir
    $ mkdir mnt
    $ cryfs encdir mnt
    CryFS Version 0.8.5
    WARNING! This version is not considered stable. Please backup your data frequently!
     
    Use default settings?
    Your choice [y/n]: y
     
    Generating secure encryption key...done
    Password:
    Confirm Password:
    Creating config file...done
     
    Mounting filesystem. To unmount, call:

    アンマウントはfuseなのでfusermount -uで

    $ fusermount -u "/tmp/mnt"
    $ ls -lA encdir mnt
    encdir:
    合計 40
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:08 0C2B03AEBC6D01C0AAB861907CE361A6
    -rw-rw-r-- 1 mk mk  1134  2月  7 04:08 cryfs.config
     
    mnt:
    合計 0

    cryfs.configという設定ファイルが作成されます

    $ file encdir/cryfs.config
    encdir/cryfs.config: data
    $ od -xc encdir/cryfs.config|head
    0000000    7263    6679    2e73    6f63    666e    6769    303b    733b
              c   r   y   f   s   .   c   o   n   f   i   g   ;   0   ;   s
    0000020    7263    7079    0074    0000    0008    0000    0000    0001
              c   r   y   p   t  \0  \0  \0  \b  \0  \0  \0  \0  \0 001  \0
    0000040    0000    0001    0000    0020    0000    0000    0000    a86f
             \0  \0 001  \0  \0  \0      \0  \0  \0  \0  \0  \0  \0   o 250
    0000060    eac9    f71c    a592    8034    2f04    a2cb    c19e    78db
            311 352 034 367 222 245   4 200 004   / 313 242 236 301 333   x
    0000100    e526    e951    1548    6c59    8a1e    beaf    db19    c7ff
              & 345   Q 351   H 025   Y   l 036 212 257 276 031 333 377 307

    タイムスタンプは残らないようです.これはちょっと困る.

    $ cryfs encdir mnt
    $ cd mnt
    $ touch a b c d e f
    touch: `a' のタイムスタンプを設定中です: サポートされていない操作です
    touch: `b' のタイムスタンプを設定中です: サポートされていない操作です
    touch: `c' のタイムスタンプを設定中です: サポートされていない操作です
    touch: `d' のタイムスタンプを設定中です: サポートされていない操作です
    touch: `e' のタイムスタンプを設定中です: サポートされていない操作です
    touch: `f' のタイムスタンプを設定中です: サポートされていない操作です
    $ ls -lA
    合計 0
    -rw-rw-r-- 1 mk mk 0  1月  1  1970 a
    -rw-rw-r-- 1 mk mk 0  1月  1  1970 b
    -rw-rw-r-- 1 mk mk 0  1月  1  1970 c
    -rw-rw-r-- 1 mk mk 0  1月  1  1970 d
    -rw-rw-r-- 1 mk mk 0  1月  1  1970 e
    -rw-rw-r-- 1 mk mk 0  1月  1  1970 f

    10MBのファイルを作ってみると32kくらいで分割されたファイル群になっているようです.

    $ dd if=/dev/zero of=mnt/10M.dd bs=1M count=10
    $ ls -lA encdir mnt
     
    encdir:
    合計 11848
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 0015B9E50D707A660AC59BF6ABA4588B
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 00AB6551CD86FE4A5129ED330C86B7ED
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 00BBCEFD0A4150AD15842F356E184F94
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 00F8B1CCE5770E2D3DC4C47FA0583B80
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 048860D118BFD0F43A86B8F858456965
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 049D06A30EF07D80988B6D948E72250A
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 04FF722DB4ADFBD7F567966EC1244BD1
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 0599D02B12B1C9EAB554525482531D5F
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 05D56C792B76894E7194FB28A02F0FAB
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 06048941FF5F7E185BE3372400580A2C
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 077FE2E17E29826C6AB407578C5312CB
    〜中略〜
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 FE5879AFA516A816008C9ED4AEB847B5
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 FE6BB5A582CF60F7329645CF3FAB365B
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 FFD97AF585CD8DEE23C722076FF8CB94
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:12 FFFA9CCA10C0F7A455DA18B109024AA7
    -rw-rw-r-- 1 mk mk  1134  2月  7 04:08 cryfs.config
     
    mnt:
    合計 10240
    -rw-rw-r-- 1 mk mk 10485760  1月  1  1970 10M.dd
    -rw-rw-r-- 1 mk mk        0  1月  1  1970 a
    -rw-rw-r-- 1 mk mk        0  1月  1  1970 b
    -rw-rw-r-- 1 mk mk        0  1月  1  1970 c
    -rw-rw-r-- 1 mk mk        0  1月  1  1970 d
    -rw-rw-r-- 1 mk mk        0  1月  1  1970 e
    -rw-rw-r-- 1 mk mk        0  1月  1  1970 f
    $ rm mnt/10M.dd

    ディレクトリを掘ってもファイルとして保存されるので覗かれてもわかりません.

    $ mkdir mnt/dir
    $ echo hoge > mnt/dir/hoge
    $ ls -lA  encdir/
    合計 328
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:11 0A332D1A5E0B5C36C9FBCEAB81E6320A
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:38 0C2B03AEBC6D01C0AAB861907CE361A6
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:11 40C765A5F1D681FFAEC781502836F444
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:11 64CF16B73827485463657F2A6928346D
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:11 78AA36DEE59FE330861A6D9B1218B16E
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:40 A9A48DEB85E2619C2ECBF7490BF3F8C9
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:11 DB99D4AAAAA21302B400DA1F9E370EA4
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:40 E5FA0435A166231035B54AC0E4723D83
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:11 F9589623B409B2142141F79614A865BF
    -rw-rw-r-- 1 mk mk  1134  2月  7 04:08 cryfs.config
    $ rm mnt/*
    rm: `mnt/dir' を削除できません: ディレクトリです
    $ ls -lA  encdir
    合計 112
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:41 0C2B03AEBC6D01C0AAB861907CE361A6
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:40 A9A48DEB85E2619C2ECBF7490BF3F8C9
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:40 E5FA0435A166231035B54AC0E4723D83
    -rw-rw-r-- 1 mk mk  1134  2月  7 04:08 cryfs.config

    EncFSはファイル名自体にファイル名のメタデータを含むので利用できるファイル名長が短くなりますが,CryFSだとファイル中にメタデータを含むので元ファイルシステムの最大長のファイル名が利用できるようです.

    $ touch mnt/012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456789012
    $ ls -lA encdir
    合計 40
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:51 0C2B03AEBC6D01C0AAB861907CE361A6
    -rw-rw-r-- 1 mk mk  1134  2月  7 04:08 cryfs.config

    パーミッションの変更やオーナーやグループを変更してもメタデータ内に吸収されるようです.

    $ chmod 777 mnt/012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456789012
    $ sudo chown www-data.www-data mnt/012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456789012
    $ ls -lA encdir mnt
    encdir:
    合計 40
    -rw-rw-r-- 1 mk mk 32816  2月  7 04:51 0C2B03AEBC6D01C0AAB861907CE361A6
    -rw-rw-r-- 1 mk mk  1134  2月  7 04:08 cryfs.config
     
    mnt:
    合計 0
    -rwxrwxrwx 1 www-data www-data 0  2月  7 04:53 012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456789012

    オプションを少し見てみます.
    --show-ciphersで利用できる暗号が確認できます.規定値ではaes-256-gcmのようです.

    $ fusermount -u mnt
    $ ls -lA mnt
    合計 0
    $ cryfs --show-ciphers
    CryFS Version 0.8.5
    WARNING! This version is not considered stable. Please backup your data frequently!
     
    aes-256-gcm
    aes-256-cfb
    aes-128-gcm
    aes-128-cfb
    twofish-256-gcm
    twofish-256-cfb
    twofish-128-gcm
    twofish-128-cfb
    serpent-256-gcm
    serpent-256-cfb
    serpent-128-gcm
    serpent-128-cfb
    cast-256-gcm
    cast-256-cfb
    mars-448-gcm
    mars-448-cfb
    mars-256-gcm
    mars-256-cfb
    mars-128-gcm
    mars-128-cfb

    --extpassオプションで外部のプログラムからパスワードが受け取れます.

    $ cat << __EOF__ > pass
    #!/bin/bash
    echo 'passwd'
    __EOF__
    $ chmod +x pass
    $ ./pass
    passwd
    $ cryfs --extpass ./pass encdir mnt
    CryFS Version 0.8.5
    WARNING! This version is not considered stable. Please backup your data frequently!
     
    Loading config file...done
     
    Mounting filesystem. To unmount, call:
    $ fusermount -u "/tmp/mnt"
     

    --unmount-idleで一定時間利用されていない時に自動アンマウントされます.

    $ cryfs --extpass ./pass --unmount-idle 1 encdir mnt

    1分後

    $ ls -l mnt
    合計 0

    今のところベータで未実装の昨日もありますし,こういう怖いメッセージも出力される状態です.

    WARNING! This version is not considered stable. Please backup your data frequently!

    #そういえば数年前nilfs2もmount時に似たような警告出してましたね

    mount.nilfs2: WARNING! - The NILFS on-disk format may change at any time.
    mount.nilfs2: WARNING! - Do not place critical data on a NILFS filesystem.

    今はもう何も言われない :)

    [1109102.058384] NILFS version 2 loaded
    [1109102.077659] segctord starting. Construction interval = 5 seconds, CP frequency < 30 seconds

    実装が済んで安定すればEncFSの競合として便利に使えそうな感じです.
    興味のある方はCryFSのページのフォームでメールアドレスを登録しておくといいかもしれません.

    Let us notify you when CryFS is stable!


    ]]>
    https://matoken.org/blog/2016/02/07/try-cryfs-of-the-encrypted-file-system-similar-to-encfs/feed/ 0
    aptコマンドのedit-sourcesオプションが便利 https://matoken.org/blog/2016/02/01/convenient-edit-sources-option-of-apt-command/ https://matoken.org/blog/2016/02/01/convenient-edit-sources-option-of-apt-command/#comments Mon, 01 Feb 2016 10:25:20 +0000 http://matoken.org/blog/?p=1102

    Rasbianのパッケージサーバにjaistを指定していたのだけど最近遅いのでmirror listを見て

    $ w3m -dump https://www.raspbian.org/RaspbianMirrors|grep -i japan -A1
    Asia^*    Japan       JAIST                    (http|rsync)://ftp.jaist.ac.jp/pub/
                                                   Linux/raspbian-archive/raspbian
    --
    Asia^*    Japan       WIDE Project Tsukuba NOC raspbian/raspbian/
                                                   rsync://ftp.tsukuba.wide.ad.jp/
    --
    Asia^*    Japan       Yamagata University      http://ftp.yz.yamagata-u.ac.jp/pub/
                                                   linux/raspbian/raspbian/

    /etc/apt/sources.listをWIDEに変更した.

    -deb http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian/ jessie main contrib non-free rpi
    -deb-src http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian/ jessie main contrib non-free rpi
    +deb http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian/  jessie main contrib non-free rpi
    +deb-src http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian/  jessie main contrib non-free rpi

    ところでaptコマンドのedit-sourcesオプションが便利なのでぜひ使うべき.visudoとかみたいに間違えると教えてくれる.

    $ sudo apt edit-sources
    E: Type 'eb' is not known on line 3 in source list /etc/apt/sources.list
    Failed to parse /etc/apt/sources.list. Edit again?  [Y/n]

    引数を付けて/etc/apt/sources.list.d/以下の編集も出来る

    $ ls /etc/apt/sources.list.d/
    google-chrome.list  gyazo_gyazo-for-linux.list  owncloud-client.list
    $ sudo apt edit-sources owncloud-client

    Debian jessie以降,Rasbian jessie以降,Ubuntu vivid(15.04)以降でそれぞれ利用可能だと思う.

    apt (0.9.13.1) unstable; urgency=low
     
      [ Colin Watson ]
      * fix "apt-get  --purge build-dep" (closes: #720597)
      * fix regression that APT::Keep-Fds is not honored (closes: #730490)
     
      [ Michael Vogt ]
      * add "-f" option to "build-dep" as sbuild is using it to fix
        regression with cross-building (LP: #1255806)
      * add autopkgtest support for the integration testsuite
      * merge mvo/feature/short-list
      * merge mvo/feature/edit-sources
      * fix segfault in pkgDepCache::SetCandidateRelease() (closes: #709560)
      * reset terminal on error (closes: #730795)
      * fix apport report writing (LP: #1254499)
     
     -- Michael Vogt <mvo@debian.org>  Fri, 29 Nov 2013 20:50:17 +0100


    ]]>
    https://matoken.org/blog/2016/02/01/convenient-edit-sources-option-of-apt-command/feed/ 1
    Ubuntu 10.04 LTS そろそろeol https://matoken.org/blog/2015/02/06/ubuntu-10-04-lts-eol/ https://matoken.org/blog/2015/02/06/ubuntu-10-04-lts-eol/#respond Thu, 05 Feb 2015 22:26:11 +0000 http://matoken.org/blog/?p=720

    先日の所謂GHOST脆弱性騒ぎの時に Ubuntu 10.04 LTS の修正を見かけて気付いたのですが,Ubuntu 10.04 LTS サーバーのサポートが4月いっぱいまでです.デスクトップは既に2012年にサポートが終わっているので利用者は少ないでしょうがサーバで使っている人で移行していない人はそろそろ移行しないとですね.

    LTS の移行先としてはUbuntu 12.04 LTS が2017年04月迄.Ubuntu 14.04 LTS が2019年04月迄です.10.04 LTS から12.04 LTS には一気にアップグレードできるはずですが,10.04 LTS から14.04 LTS へは一気にアップグレードは出来ないと思います.環境によりますが新環境を14.04 LTS で作って移行したほうが楽かもですね.

    ]]> https://matoken.org/blog/2015/02/06/ubuntu-10-04-lts-eol/feed/ 0 Snappy Ubuntu Core on Raspberry Pi 2 https://matoken.org/blog/2015/02/05/snappy-ubuntu-core-on-raspberry-pi-2/ https://matoken.org/blog/2015/02/05/snappy-ubuntu-core-on-raspberry-pi-2/#respond Wed, 04 Feb 2015 22:53:29 +0000 http://matoken.org/blog/?p=718

    Screenshot from 2015-02-05 07:30:48

    Raspberry Pi のOS ダウンロードページに SNAPPY UBUNTU CORE が.未だAlpha 2 だけど.

    Snappy Ubuntu Core の要件はARMv7 128RAM なのでRaspberry Pi 2 以降でないとダメだけどRaspberry Pi で動かすのも面白そうですね.
    ちなみにBBB のSnappy Ubuntu Core はこの辺に

    Raspberry Pi な同人誌以下で頒布中です.

    ]]> https://matoken.org/blog/2015/02/05/snappy-ubuntu-core-on-raspberry-pi-2/feed/ 0